diff --git a/apps/gpsservice/README.md b/apps/gpsservice/README.md index 169113978..7630144b4 100644 --- a/apps/gpsservice/README.md +++ b/apps/gpsservice/README.md @@ -1,35 +1,37 @@ # GPS Service -A configurable GPS widget that runs in the background. +A configurable, low power GPS widget that runs in the background. ## Goals -The goals of this project were to develop a GPS widget that could be -ran in low power mode in the background and could be used to display -a OS grid reference in a watch face. +To develop a low power GPS widget that runs in the background and to +facilitate an OS grid reference display in a watch face. -* Using an App that turns on the GPS and constantly displays the - screen will use around 75mA, the battery will last between 3-4 - hours. +* An app that turns on the GPS and constantly displays the screen + will use around 75mA, the battery will last between 3-4 hours. * Using the GPS in a Widget in Super-E Power Saving Mode (PSM) with - the screen off (most of the time) will consume around 35mA and you + the screen off most of the time, will consume around 35mA and you might get 10hrs before a recharge. * Using the GPS in Power Saving Mode On/Off (PSMOO) with suitable - settings can reduce the average consumption to around 15mA. - + settings can reduce the average consumption to around 15mA. A + simple test using a 120s update period, 6s search period was still + running with 45% battery 20 hours after it started. + + ## Settings -The Settings App enables you set the following options for the GPS Service. +The Settings App enables you set the following options for the GPS +Service. Go to Settings, select App/Widgets and then 'GPS Service'. * GPS - On/Off. When this value is changed the GPS Service will be powered on or off and the GPS Widget will be displayed. * Power Mode: -** PSM-Super-E - the factory default setup for the GPS. The +** Super-E - the factory default setup for the GPS. The recommended power saving mode. ** PSMOO - On/Off power saving mode. Configured by interval and @@ -41,4 +43,21 @@ The Settings App enables you set the following options for the GPS Service. you within a 6 digit grid refernce sqaure. +## Screenshots +* GPS Watch face +![](gps_face.jpg) + +* Grid Reference Watch face +![](osref_face.jpg) + + +## To Do List +* add a logging option with options for interval between log points +* add graphics and icons to the watch faces to make them look nicer + + +## References +* data sheet +* power saving PDF +* other code diff --git a/apps/gpsservice/app.js b/apps/gpsservice/app.js index aa0c4c846..52e574bce 100644 --- a/apps/gpsservice/app.js +++ b/apps/gpsservice/app.js @@ -16,8 +16,7 @@ function reloadWidget() { } function showMainMenu() { - var powerV = [0,1]; - var powerN = ["PMS","PSMOO"]; + var power_options = ["SuperE","PSMOO"]; const mainmenu = { '': { 'title': 'GPS Service' }, @@ -26,18 +25,18 @@ function showMainMenu() { value: !!settings.service, format: v =>v?'On':'Off', onchange: v => { - settings.service = v; + settings.gpsservice = v; updateSettings(); reloadWidget(); // only when we change On/Off status }, }, 'Power Mode': { - value: 0 | powerV.indexOf(settings.power), + value: 0 | power_options.indexOf(settings.power_mode), min: 0, max: 1, - format: v => powerN[v], + format: v => power_options[v], onchange: v => { - settings.power = powerV[v]; + settings.power_mode = power_options[v]; updateSettings(); }, }, @@ -58,7 +57,7 @@ function showMainMenu() { max: 65, step: 1, onchange: v => { - settings.ontime = v; + settings.search = v; updateSettings(); } }, diff --git a/apps/gpsservice/gps_face.jpg b/apps/gpsservice/gps_face.jpg new file mode 100644 index 000000000..839d86895 Binary files /dev/null and b/apps/gpsservice/gps_face.jpg differ diff --git a/apps/gpsservice/osref_face.jpg b/apps/gpsservice/osref_face.jpg new file mode 100644 index 000000000..ff1cece7c Binary files /dev/null and b/apps/gpsservice/osref_face.jpg differ diff --git a/apps/gpsservice/settings.json b/apps/gpsservice/settings.json index 089cb1df4..b8283d5f9 100644 --- a/apps/gpsservice/settings.json +++ b/apps/gpsservice/settings.json @@ -1 +1 @@ -{"service":false, "power":"PSMOO", "update":120, "search":6} +{"gps_service":false, "power_mode":"Super-E", "update":120, "search":6} diff --git a/apps/gpsservice/widget.js b/apps/gpsservice/widget.js index 20d27cde8..1f29a3a0d 100644 --- a/apps/gpsservice/widget.js +++ b/apps/gpsservice/widget.js @@ -15,20 +15,20 @@ function gps_get_fix() { return last_fix; } function gps_get_status() { return WIDGETS.gpsservice.width === 24 ? true : false;} - function gps_get_version() { return "0.2"; } + function gps_get_version() { return "0.1"; } // Called by the GPS widget settings to reload settings and decide what to do function reload() { settings = require("Storage").readJSON("gpsservice.settings.json",1)||{}; - settings.service = settings.service||false; + settings.gpsservice = settings.gpsservice||false; settings.update = settings.update||120; - settings.search = settings.search||5; - settings.power = settings.power||0; - console.log(settings); + settings.search = settings.search||5; + settings.power_mode = settings.power_mode||"SuperE"; + //console.log(settings); Bangle.removeListener('GPS',onGPS); - if (settings.service) { + if (settings.gpsservice) { gps_power_on(); } else { gps_power_off(); @@ -61,11 +61,10 @@ function setupGPS() { Bangle.setGPSPower(1); - console.log(settings); + //console.log(settings); - // 1 == PMSOO, 0 == PSM - if (settings.power === 1) { - console.log("setupGPS() PSMOO"); + if (settings.power_mode === "PSMOO") { + //console.log("setupGPS() PSMOO"); UBX_CFG_RESET(); wait(100); @@ -78,7 +77,7 @@ UBX_CFG_SAVE(); wait(20); } else { - console.log("setupGPS() PMS"); + //console.log("setupGPS() Super-E"); UBX_CFG_RESET(); wait(100); @@ -187,7 +186,7 @@ // draw the widget function draw() { - if (!settings.service) return; + if (!settings.gpsservice) return; g.reset(); g.drawImage(atob("GBgCAAAAAAAAAAQAAAAAAD8AAAAAAP/AAAAAAP/wAAAAAH/8C9AAAB/8L/QAAAfwv/wAAAHS//wAAAAL//gAAAAf/+AAAAAf/4AAAAL//gAAAAD/+DwAAAB/Uf8AAAAfA//AAAACAf/wAAAAAH/0AAAAAB/wAAAAAAfAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),this.x,this.y); if (gps_get_status() === true && have_fix) {