diff --git a/testing/GPS-comms.js b/testing/GPS-comms.js new file mode 100644 index 000000000..67df178f8 --- /dev/null +++ b/testing/GPS-comms.js @@ -0,0 +1,67 @@ +/* This code allows you to communicate with the GPS +receiver in Bangle.js in order to set it up. + +Protocol spec: + +https://cdn.sparkfun.com/assets/0/b/0/f/7/u-blox8-M8_ReceiverDescrProtSpec__UBX-13003221__Public.pdf + +*/ + +Bangle.setGPSPower(1) +//Bangle.on('GPS',print); + +Bangle.on('GPS-raw',function (d) { + if (d[0]=="$") return; + if (d.startsWith("\xB5\x62\x05\x01")) print("GPS ACK"); + else if (d.startsWith("\xB5\x62\x05\x00")) print("GPS NACK"); + // 181,98 sync chars + else print("GPS",E.toUint8Array(d).join(",")); +}); +function writeGPScmd(cmd) { + var d = [0xB5,0x62]; // sync chars + d = d.concat(cmd); + var a=0,b=0; + for (var i=2;i