From 82ffaf63830aae6959f2fbab3c30658a06fd5900 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:02:35 +1300 Subject: [PATCH 01/67] Update ChangeLog --- apps/speedalt/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/speedalt/ChangeLog b/apps/speedalt/ChangeLog index debc08453..47f335b6f 100644 --- a/apps/speedalt/ChangeLog +++ b/apps/speedalt/ChangeLog @@ -10,3 +10,4 @@ 1.05 : Memory optimisation. Stopped loading entire waypoint list into memory. 1.06 : Save display settings and restore when app restarted. 1.07 : Memory optimisation. +2.01 : Integrate with Low Power GPS service From ded3b115bd38f54addd6fa9e84a97426e50f4892 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:04:05 +1300 Subject: [PATCH 02/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index f22a88ee1..ea91d4981 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"1.07", + "version":"2.01", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From d79336d212c0f7518c67b894f57383633d7502ff Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:06:09 +1300 Subject: [PATCH 03/67] Low Power widget branch --- apps/speedalt/app.js | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index b80c923bd..672bada49 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -1,6 +1,6 @@ /* Speed and Altitude [speedalt] -Ver : 1.07 +Ver : 1.07b low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ @@ -208,7 +208,12 @@ function onGPS(fix) { } if (fix.fix) lf = fix; + doFix(); + +} +function doFix() { + var m; var sp = '---'; @@ -249,21 +254,21 @@ function onGPS(fix) { if ( settings.modeA ) { if ( showMax ) { // Speed and alt maximums - drawFix(max.spd,settings.spd_unit,fix.satellites,max.alt,settings.alt_unit,age,fix.fix); + drawFix(max.spd,settings.spd_unit,lf.satellites,max.alt,settings.alt_unit,age,lf.fix); } else { // Show speed/altitude - drawFix(sp,settings.spd_unit,fix.satellites,al,settings.alt_unit,age,fix.fix); + drawFix(sp,settings.spd_unit,lf.satellites,al,settings.alt_unit,age,lf.fix); } } else { // Show speed/distance if ( di <= 0 ) { // No WP selected - drawFix(sp,settings.spd_unit,fix.satellites,'','',age,fix.fix); + drawFix(sp,settings.spd_unit,lf.satellites,'','',age,lf.fix); } else { - drawFix(sp,settings.spd_unit,fix.satellites,di,settings.dist_unit,age,fix.fix); + drawFix(sp,settings.spd_unit,lf.satellites,di,settings.dist_unit,age,lf.fix); } } @@ -332,6 +337,7 @@ function updateClock() { function startDraw(){ canDraw=true; + setLpMode(0); // off g.clear(); Bangle.drawWidgets(); onGPS(lf); // draw app screen @@ -339,12 +345,28 @@ function startDraw(){ function stopDraw() { canDraw=false; + setLpMode(1); // on } function savSettings() { require("Storage").write('speedalt.json',settings); } +// Is low power GPS service available to use? +function isLP() { + if (WIDGETS.gpsservice == undefined) return(0); + return(1); +} + +function setLpMode(on) { + if ( !lp ) return; + var settings = WIDGETS.gpsservice.gps_get_settings(); + settings.gpsservice = on; + settings.power_mode = (on)?'PSMOO':'SuperE'; + WIDGETS.gpsservice.gps_set_settings(settings); + WIDGETS.gpsservice.reload(); +} + // =Main Prog // Read settings. @@ -398,6 +420,10 @@ Bangle.on('lcdPower',function(on) { g.clear(); Bangle.loadWidgets(); Bangle.drawWidgets(); + +var lp = isLP(); // Low power GPS widget installed. + + Bangle.setGPSPower(1); onGPS(lf); Bangle.on('GPS', onGPS); From f290969ea1708e789f4912dcf580a2be8eec55da Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:06:36 +1300 Subject: [PATCH 04/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 672bada49..4fc027664 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -1,6 +1,6 @@ /* Speed and Altitude [speedalt] -Ver : 1.07b low power gps widget +Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ From e803faf71bc7c5693e7e889424f9401286abe801 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:47:59 +1300 Subject: [PATCH 06/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 4fc027664..a55a65659 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -361,7 +361,7 @@ function isLP() { function setLpMode(on) { if ( !lp ) return; var settings = WIDGETS.gpsservice.gps_get_settings(); - settings.gpsservice = on; + settings.gpsservice = true; settings.power_mode = (on)?'PSMOO':'SuperE'; WIDGETS.gpsservice.gps_set_settings(settings); WIDGETS.gpsservice.reload(); From 19186dfae4ac4f99f0f1a8ce8a40bac2075b3848 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 08:48:47 +1300 Subject: [PATCH 07/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index ea91d4981..efae93f7c 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.01", + "version":"2.02", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 961c5e47180bc7f55b99724967f69bbe3140c5c4 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:01:14 +1300 Subject: [PATCH 08/67] Update app.js --- apps/speedalt/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index a55a65659..6c14972d4 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -221,6 +221,8 @@ function doFix() { var di = '---'; var age = '---'; +print(lf.fix+' '+lf.alt); + if (lf.fix == 1 ) { // Speed if ( settings.spd == 0 ) { @@ -360,9 +362,12 @@ function isLP() { function setLpMode(on) { if ( !lp ) return; - var settings = WIDGETS.gpsservice.gps_get_settings(); - settings.gpsservice = true; - settings.power_mode = (on)?'PSMOO':'SuperE'; + var s = WIDGETS.gpsservice.gps_get_settings(); + s.gpsservice = true; + s.power_mode = (on)?'PSMOO':'SuperE'; + +print( s.power_mode ); + WIDGETS.gpsservice.gps_set_settings(settings); WIDGETS.gpsservice.reload(); } From cc47b51c1ce58029322d09b903d0be4c616c4ce3 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:01:55 +1300 Subject: [PATCH 09/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index efae93f7c..8b26252e1 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.02", + "version":"2.03", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 7044a12c6389b78ceaa454d29d0f3f13867fbe14 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:14:47 +1300 Subject: [PATCH 10/67] Update app.js --- apps/speedalt/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 6c14972d4..d27d441c6 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -360,6 +360,10 @@ function isLP() { return(1); } +function lpGetFix() { + onGPS(WIDGETS.gpsservice.gps_get_fix()); +} + function setLpMode(on) { if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); @@ -431,6 +435,9 @@ var lp = isLP(); // Low power GPS widget installed. Bangle.setGPSPower(1); onGPS(lf); -Bangle.on('GPS', onGPS); + +if ( lp ) setInterval(lpGetFix, 1000); +else Bangle.on('GPS', onGPS); + setButtons(); setInterval(updateClock, 30000); From 2bcfc725363d391abc41929b3985c9fb4689cb35 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:15:33 +1300 Subject: [PATCH 11/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 8b26252e1..f5064fc77 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.03", + "version":"2.04", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 0dc34edf3bca8f75fa03ebd15d8e63e2b444576b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:23:56 +1300 Subject: [PATCH 12/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index d27d441c6..03641a952 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -372,7 +372,7 @@ function setLpMode(on) { print( s.power_mode ); - WIDGETS.gpsservice.gps_set_settings(settings); + WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); } From d228eb3c2b19fdd90e4425562908d45677b9f72a Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:24:39 +1300 Subject: [PATCH 13/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index f5064fc77..6406ebf7b 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.04", + "version":"2.05", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 7fb03ff9003b87ce98cba89fba2ea0568cb5c79f Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:35:29 +1300 Subject: [PATCH 14/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 03641a952..ecf54dde3 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -370,7 +370,7 @@ function setLpMode(on) { s.gpsservice = true; s.power_mode = (on)?'PSMOO':'SuperE'; -print( s.power_mode ); +print( s ); WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); From 45e55e48ccfcf7a34155391cbacba12fc59f7812 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:36:02 +1300 Subject: [PATCH 15/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 6406ebf7b..e636cf4bb 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.05", + "version":"2.06", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 1116b4400a18153e9036ea7c554e6344296464bb Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:44:48 +1300 Subject: [PATCH 16/67] Update app.js --- apps/speedalt/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index ecf54dde3..625df8447 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -347,7 +347,9 @@ function startDraw(){ function stopDraw() { canDraw=false; - setLpMode(1); // on +// setLpMode(1); // on +setLpMode(0); // off + } function savSettings() { From af83dafee4d956c1ac1ff668e799f92e37be57a4 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 09:45:43 +1300 Subject: [PATCH 17/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index e636cf4bb..fa3ab83c4 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.06", + "version":"2.07", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From b3357b2efaa1c43a0b6cdcdb62cee29d6849baf5 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 10:19:49 +1300 Subject: [PATCH 18/67] Update app.js --- apps/speedalt/app.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 625df8447..3ebba0bb0 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -347,9 +347,7 @@ function startDraw(){ function stopDraw() { canDraw=false; -// setLpMode(1); // on -setLpMode(0); // off - + setLpMode(1); // on } function savSettings() { @@ -372,7 +370,7 @@ function setLpMode(on) { s.gpsservice = true; s.power_mode = (on)?'PSMOO':'SuperE'; -print( s ); +print('[a] '+s.power_mode); WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); From 569b08200c2cd0cf1b9edd473974cbf9418bd2e4 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 10:31:26 +1300 Subject: [PATCH 19/67] Update app.js --- apps/speedalt/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 3ebba0bb0..7a7cb7ec4 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -207,6 +207,10 @@ function onGPS(fix) { fix.time = new Date(); } + +print(fix.fix+' '+fix.alt); + + if (fix.fix) lf = fix; doFix(); @@ -220,10 +224,8 @@ function doFix() { var al = '---'; var di = '---'; var age = '---'; - -print(lf.fix+' '+lf.alt); - - if (lf.fix == 1 ) { + + if (lf.fix == 1 ) { // Speed if ( settings.spd == 0 ) { m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units @@ -370,7 +372,7 @@ function setLpMode(on) { s.gpsservice = true; s.power_mode = (on)?'PSMOO':'SuperE'; -print('[a] '+s.power_mode); +print('[b] '+s.power_mode); WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); From 0520d9a2074fb2840aedb9abfb7f0737435192b4 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 10:43:15 +1300 Subject: [PATCH 20/67] Update app.js --- apps/speedalt/app.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 7a7cb7ec4..6398e377f 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -206,10 +206,6 @@ function onGPS(fix) { fix.satellites = 12; fix.time = new Date(); } - - -print(fix.fix+' '+fix.alt); - if (fix.fix) lf = fix; doFix(); @@ -371,9 +367,6 @@ function setLpMode(on) { var s = WIDGETS.gpsservice.gps_get_settings(); s.gpsservice = true; s.power_mode = (on)?'PSMOO':'SuperE'; - -print('[b] '+s.power_mode); - WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); } From 40346cfb6f094247affa6fd5faa67b76a5b1e7fc Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 10:47:54 +1300 Subject: [PATCH 21/67] Update app.js --- apps/speedalt/app.js | 99 +++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 6398e377f..530f064b0 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -208,12 +208,7 @@ function onGPS(fix) { } if (fix.fix) lf = fix; - doFix(); - -} -function doFix() { - var m; var sp = '---'; @@ -221,56 +216,56 @@ function doFix() { var di = '---'; var age = '---'; - if (lf.fix == 1 ) { - // Speed - if ( settings.spd == 0 ) { - m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units - sp = parseFloat(m[1]); - settings.spd_unit = m[2]; - } - else { - // Calculate for selected units - sp = lf.speed; - sp = parseFloat(sp)/parseFloat(settings.spd); - } - if ( sp < 10 ) sp = sp.toFixed(1); - else sp = Math.round(sp); - if (parseFloat(sp) > parseFloat(max.spd) ) max.spd = parseFloat(sp); - - // Altitude - al = lf.alt; - al = Math.round(parseFloat(al)/parseFloat(settings.alt)); - if (parseFloat(al) > parseFloat(max.alt) ) max.alt = parseFloat(al); - - // Distance to waypoint - di = distance(lf,wp); - if (isNaN(di)) di = 0; - - // Age of last fix (secs) - age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); - if ( age > 90 ) age = '>90'; - } - - if ( settings.modeA ) { - if ( showMax ) { - // Speed and alt maximums - drawFix(max.spd,settings.spd_unit,lf.satellites,max.alt,settings.alt_unit,age,lf.fix); - } - else { - // Show speed/altitude - drawFix(sp,settings.spd_unit,lf.satellites,al,settings.alt_unit,age,lf.fix); - } +// if (lf.fix == 1 ) { + // Speed + if ( settings.spd == 0 ) { + m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units + sp = parseFloat(m[1]); + settings.spd_unit = m[2]; } else { - // Show speed/distance - if ( di <= 0 ) { - // No WP selected - drawFix(sp,settings.spd_unit,lf.satellites,'','',age,lf.fix); - } - else { - drawFix(sp,settings.spd_unit,lf.satellites,di,settings.dist_unit,age,lf.fix); - } + // Calculate for selected units + sp = lf.speed; + sp = parseFloat(sp)/parseFloat(settings.spd); } + if ( sp < 10 ) sp = sp.toFixed(1); + else sp = Math.round(sp); + if (parseFloat(sp) > parseFloat(max.spd) ) max.spd = parseFloat(sp); + + // Altitude + al = lf.alt; + al = Math.round(parseFloat(al)/parseFloat(settings.alt)); + if (parseFloat(al) > parseFloat(max.alt) ) max.alt = parseFloat(al); + + // Distance to waypoint + di = distance(lf,wp); + if (isNaN(di)) di = 0; + + // Age of last fix (secs) + age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); + if ( age > 90 ) age = '>90'; +// } + + if ( settings.modeA ) { + if ( showMax ) { + // Speed and alt maximums + drawFix(max.spd,settings.spd_unit,lf.satellites,max.alt,settings.alt_unit,age,lf.fix); + } + else { + // Show speed/altitude + drawFix(sp,settings.spd_unit,lf.satellites,al,settings.alt_unit,age,lf.fix); + } + } + else { + // Show speed/distance + if ( di <= 0 ) { + // No WP selected + drawFix(sp,settings.spd_unit,lf.satellites,'','',age,lf.fix); + } + else { + drawFix(sp,settings.spd_unit,lf.satellites,di,settings.dist_unit,age,lf.fix); + } + } } From 2e34b4f030e9c364628cab72fcb186bb9d5af2c7 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 11:14:34 +1300 Subject: [PATCH 22/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 530f064b0..97e84548e 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -216,7 +216,7 @@ function onGPS(fix) { var di = '---'; var age = '---'; -// if (lf.fix == 1 ) { + if (lf.fix == 1 ) { // Speed if ( settings.spd == 0 ) { m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units @@ -244,7 +244,7 @@ function onGPS(fix) { // Age of last fix (secs) age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); if ( age > 90 ) age = '>90'; -// } + } if ( settings.modeA ) { if ( showMax ) { From fae839f86cf9ddd666bec9d64943a31d9c2e7b5b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 11:23:12 +1300 Subject: [PATCH 23/67] Update app.js --- apps/speedalt/app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 97e84548e..eac8d186c 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -90,9 +90,11 @@ function drawFix(speed,units,sats,alt,alt_units,age,fix) { drawWP(); //Sats - if ( fix ) drawSats('Sats:'+sats); - else drawSats('Age:'+age); - +// if ( fix ) drawSats('Sats:'+sats); +// else drawSats('Age:'+age); + if ( age > 10 ) drawSats('Age:'+age); + else drawSats('Sats:'+sats); + g.reset(); g.drawImage(img,0,40); @@ -242,7 +244,9 @@ function onGPS(fix) { if (isNaN(di)) di = 0; // Age of last fix (secs) - age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); + //age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); + var time = formatTime(lf.time); + age = timeSince(time); if ( age > 90 ) age = '>90'; } From 0f8af3e8eced769c3d816bec0638fb29fe6269ba Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 11:27:07 +1300 Subject: [PATCH 24/67] Update app.js --- apps/speedalt/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index eac8d186c..398ac5adf 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -244,9 +244,7 @@ function onGPS(fix) { if (isNaN(di)) di = 0; // Age of last fix (secs) - //age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); - var time = formatTime(lf.time); - age = timeSince(time); + age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); if ( age > 90 ) age = '>90'; } From c284a9c999d356390a93a53de9392101c0b69154 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 11:55:25 +1300 Subject: [PATCH 25/67] Update app.js --- apps/speedalt/app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 398ac5adf..23d2fa62f 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -209,8 +209,6 @@ function onGPS(fix) { fix.time = new Date(); } - if (fix.fix) lf = fix; - var m; var sp = '---'; @@ -218,7 +216,9 @@ function onGPS(fix) { var di = '---'; var age = '---'; - if (lf.fix == 1 ) { + if (fix.fix) { + lf = fix; + // Speed if ( settings.spd == 0 ) { m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units @@ -342,7 +342,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - setLpMode(1); // on + if (lf.fix) setLpMode(1); // on. Keep lp mode off until we have a first fix. } function savSettings() { From 0e2c518efd78a513f834d50be967bdf69f4de291 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 13:22:00 +1300 Subject: [PATCH 26/67] Update app.js --- apps/speedalt/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 23d2fa62f..3e579f7cb 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -15,6 +15,7 @@ var showMax = 0; // 1 = display the max values. 0 = display the cur fix var maxPress = 0; // Time max button pressed. Used to calculate short or long press. var canDraw = 1; var time = ''; // Last time string displayed. Re displayed in background colour to remove before drawing new time. +var tmrLP; // Timer for delay in switching to low power after screen turns off var max = {}; max.spd = 0; @@ -334,6 +335,10 @@ function updateClock() { function startDraw(){ canDraw=true; + if (tmrLP) { + clearInterval(tmrLP); // Stop any scheduled drop to low power + tmrLP = false; + } setLpMode(0); // off g.clear(); Bangle.drawWidgets(); @@ -342,7 +347,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - if (lf.fix) setLpMode(1); // on. Keep lp mode off until we have a first fix. + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode(1);}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. } function savSettings() { From 40604b93a31b2aecd86b390367c33cc316a80e0b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 13:27:24 +1300 Subject: [PATCH 27/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 3e579f7cb..7f29dbd79 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ - +var v = '2'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts From c7aec562d96d197341b4101587256d56b330e90c Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 13:54:04 +1300 Subject: [PATCH 28/67] Update app.js --- apps/speedalt/app.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 7f29dbd79..dc5aa9f83 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '2'; +var v = '3'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -335,10 +335,6 @@ function updateClock() { function startDraw(){ canDraw=true; - if (tmrLP) { - clearInterval(tmrLP); // Stop any scheduled drop to low power - tmrLP = false; - } setLpMode(0); // off g.clear(); Bangle.drawWidgets(); @@ -365,6 +361,7 @@ function lpGetFix() { } function setLpMode(on) { + if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); s.gpsservice = true; From 92f9a8e1c341441fdc9ad62745a6dc5fd97a160b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 14:03:07 +1300 Subject: [PATCH 29/67] Update app.js --- apps/speedalt/app.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index dc5aa9f83..0fd924bc5 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '3'; +var v = '4'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -91,9 +91,10 @@ function drawFix(speed,units,sats,alt,alt_units,age,fix) { drawWP(); //Sats -// if ( fix ) drawSats('Sats:'+sats); -// else drawSats('Age:'+age); - if ( age > 10 ) drawSats('Age:'+age); + if ( age > 10 ) { + if ( age > 90 ) age = '>90'; + drawSats('Age:'+age); + } else drawSats('Sats:'+sats); g.reset(); @@ -164,13 +165,10 @@ function drawTime() { function drawWP() { var nm = wp.name; - if ( nm == undefined ) nm = ''; - if ( nm == 'NONE' ) nm = ''; - if ( settings.modeA ) nm=''; + if ( nm == undefined || nm == 'NONE' || settings.modeA ) nm = ''; - buf.setFontAlign(-12,1); //left, bottom + buf.setFontAlign(-1,1); //left, bottom buf.setColor(2); -// buf.setFont("6x8", 1); buf.setFontVector(20); buf.drawString(nm.substring(0,6),77,160); @@ -246,7 +244,6 @@ function onGPS(fix) { // Age of last fix (secs) age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); - if ( age > 90 ) age = '>90'; } if ( settings.modeA ) { From 6f79080f8c7f840f8c0041f0cb9ad5098018bbff Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 14:31:24 +1300 Subject: [PATCH 30/67] Update app.js --- apps/speedalt/app.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 0fd924bc5..71bf28563 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '4'; +var v = '5'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -65,22 +65,18 @@ function drawFix(speed,units,sats,alt,alt_units,age,fix) { var u=''; // Primary Display - v = speed.toString(); - if ( !settings.primSpd ) v = alt.toString(); + v = (settings.primSpd)?speed.toString():alt.toString(); // Primary Units - u = settings.spd_unit; - if ( !settings.primSpd ) u = alt_units; + u = (settings.primSpd)?settings.spd_unit:alt_units; drawPrimary(v,u); // Secondary Display - v = alt.toString(); - if ( !settings.primSpd ) v = speed.toString(); + v = (settings.primSpd)?alt.toString():speed.toString(); // Secondary Units - u = alt_units; - if ( !settings.primSpd ) u = settings.spd_unit; + u = (settings.primSpd)?alt_units:settings.spd_unit; drawSecondary(v,u); From acaf6d32b73ce3258fc73256744b137f48529f93 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 14:44:12 +1300 Subject: [PATCH 31/67] Update app.js --- apps/speedalt/app.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 71bf28563..493e9119f 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '5'; +var v = '6'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -328,7 +328,7 @@ function updateClock() { function startDraw(){ canDraw=true; - setLpMode(0); // off + setLpMode('SuperE'); // off g.clear(); Bangle.drawWidgets(); onGPS(lf); // draw app screen @@ -336,7 +336,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode(1);}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. } function savSettings() { @@ -353,14 +353,16 @@ function lpGetFix() { onGPS(WIDGETS.gpsservice.gps_get_fix()); } -function setLpMode(on) { +function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); - s.gpsservice = true; - s.power_mode = (on)?'PSMOO':'SuperE'; - WIDGETS.gpsservice.gps_set_settings(s); - WIDGETS.gpsservice.reload(); + if ( m <> s.power_mode ) { + s.gpsservice = true; + s.power_mode = (on)?'PSMOO':'SuperE'; + WIDGETS.gpsservice.gps_set_settings(s); + WIDGETS.gpsservice.reload(); + } } // =Main Prog From f4815c5ff8a5855245aed020a285d45d5d8b9d60 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 14:46:26 +1300 Subject: [PATCH 32/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 493e9119f..426d35f3a 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -359,7 +359,7 @@ function setLpMode(m) { var s = WIDGETS.gpsservice.gps_get_settings(); if ( m <> s.power_mode ) { s.gpsservice = true; - s.power_mode = (on)?'PSMOO':'SuperE'; + s.power_mode = m; WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); } From 2c4f83d0504035c57e57463c410369a799b812d9 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 14:51:49 +1300 Subject: [PATCH 33/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 426d35f3a..f974d75a2 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '6'; +var v = '7'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -357,7 +357,7 @@ function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); - if ( m <> s.power_mode ) { + if ( m !== s.power_mode ) { s.gpsservice = true; s.power_mode = m; WIDGETS.gpsservice.gps_set_settings(s); From cae0222b94df682620ed42e9ce2ee739871afe55 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 15:20:17 +1300 Subject: [PATCH 34/67] Update app.js --- apps/speedalt/app.js | 45 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index f974d75a2..7d2cf5795 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -4,7 +4,7 @@ Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com process.memory() */ -var v = '7'; +var v = '8'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -220,11 +220,8 @@ function onGPS(fix) { sp = parseFloat(m[1]); settings.spd_unit = m[2]; } - else { - // Calculate for selected units - sp = lf.speed; - sp = parseFloat(sp)/parseFloat(settings.spd); - } + else sp = parseFloat(lf.speed)/parseFloat(settings.spd); // Calculate for selected units + if ( sp < 10 ) sp = sp.toFixed(1); else sp = Math.round(sp); if (parseFloat(sp) > parseFloat(max.spd) ) max.spd = parseFloat(sp); @@ -243,24 +240,13 @@ function onGPS(fix) { } if ( settings.modeA ) { - if ( showMax ) { - // Speed and alt maximums - drawFix(max.spd,settings.spd_unit,lf.satellites,max.alt,settings.alt_unit,age,lf.fix); - } - else { - // Show speed/altitude - drawFix(sp,settings.spd_unit,lf.satellites,al,settings.alt_unit,age,lf.fix); - } - } + if ( showMax ) drawFix(max.spd,settings.spd_unit,lf.satellites,max.alt,settings.alt_unit,age,lf.fix); // Speed and alt maximums + else drawFix(sp,settings.spd_unit,lf.satellites,al,settings.alt_unit,age,lf.fix); // Show speed/altitude + } else { // Show speed/distance - if ( di <= 0 ) { - // No WP selected - drawFix(sp,settings.spd_unit,lf.satellites,'','',age,lf.fix); - } - else { - drawFix(sp,settings.spd_unit,lf.satellites,di,settings.dist_unit,age,lf.fix); - } + if ( di <= 0 ) drawFix(sp,settings.spd_unit,lf.satellites,'','',age,lf.fix); // No WP selected + else drawFix(sp,settings.spd_unit,lf.satellites,di,settings.dist_unit,age,lf.fix); } } @@ -303,18 +289,11 @@ function btnReleased() { var dur = getTime()-maxPress; if ( settings.modeA ) { // Spd+Alt mode - Switch between fix and MAX - if ( dur < 2 ) { - showMax = !showMax; // Short press toggle fix/max display - } - else { - max.spd = 0; // Long press resets max values. - max.alt = 0; - } - } - else { - // Spd+Dist mode - Select next waypoint - nxtWp(1); + if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display + else { max.spd = 0; max.alt = 0; } // Long press resets max values. } + else nxtWp(1); // Spd+Dist mode - Select next waypoint + onGPS(lf); } From 2d935f77f80f3169fd76f429d87128264df6f994 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 17:23:33 +1300 Subject: [PATCH 35/67] Update ChangeLog --- apps/speedalt/ChangeLog | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/speedalt/ChangeLog b/apps/speedalt/ChangeLog index 47f335b6f..2c77ccafa 100644 --- a/apps/speedalt/ChangeLog +++ b/apps/speedalt/ChangeLog @@ -5,9 +5,4 @@ 0.05 : Add setting to turn vibrate on/off. 0.06 : Tweaks to vibration settings. 0.07 : Switch to BTN1 for Max toggle and reset function. -1.00 : New feature. Added waypoints file and distance to selected waypoint display -1.04 : Misc tweaks. -1.05 : Memory optimisation. Stopped loading entire waypoint list into memory. -1.06 : Save display settings and restore when app restarted. -1.07 : Memory optimisation. -2.01 : Integrate with Low Power GPS service +1.00 : New features. Added waypoints file and distance to selected waypoint display. Added integration with Low Power GPS service. Save display settings and restore when app restarted. From b019b7e6f822c5c8f7251376905dfdca182942f9 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 17:24:51 +1300 Subject: [PATCH 36/67] Update app.js --- apps/speedalt/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 7d2cf5795..3de66926b 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -1,10 +1,8 @@ /* Speed and Altitude [speedalt] -Ver : 2.01 low power gps widget Mike Bennett mike[at]kereru.com -process.memory() */ -var v = '8'; +var v = '1.00'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts From 3e5fcbfdf076fb5a5c999caa790062df6e496a66 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 17:45:03 +1300 Subject: [PATCH 37/67] Update README.md --- apps/speedalt/README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index f9db449f4..2c8d5917a 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -31,9 +31,13 @@ Settings:
Developed for my use in sailing, cycling and motorcycling. If you find this software useful or have feedback drop me a line mike[at]kereru.com. Enjoy! -Thanks: -Many thanks to Gordon Williams. Awesome job. -Also to @jeffmer, the developer of the 'GPS Navigation' app. +Low Power GPS Service : + +This app will work quite happily without this service but will use the Low power GPS Service if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significant longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. + +When using the Low Power GPS Service this app switches the GPS to SuperE ( default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off. This delay gives an opportunity to restore the display before the power mode is switched. + +There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. Waypoints: @@ -103,3 +107,11 @@ Sample waypoints.json } ] + +Thanks: + +Many thanks to Gordon Williams. Awesome job. + +Special thanks also to @jeffmer, for the 'GPS Navigation' app and @hughbarney for the 'Low power GPS Service' work. + + From c618ebfdccc3e42d05db4ce842a93ed2b6bca629 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 17:56:37 +1300 Subject: [PATCH 38/67] Update README.md --- apps/speedalt/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index 2c8d5917a..c5f8883a5 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -33,17 +33,19 @@ Developed for my use in sailing, cycling and motorcycling. If you find this soft Low Power GPS Service : -This app will work quite happily without this service but will use the Low power GPS Service if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significant longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. +This app will work quite happily without this service but will use the Low power GPS Service if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. -When using the Low Power GPS Service this app switches the GPS to SuperE ( default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off. This delay gives an opportunity to restore the display before the power mode is switched. +When using the Low Power GPS Service this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off. This delay gives an opportunity to restore the display before the power mode is switched. -There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. +There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will also contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. Waypoints: -Create a file waypoints.json and write to storage on the Bangle.js using the IDE. The first 6 characters of the name are displyed in Speed+[D]istance mode. +Waypoints are used in [D]istance mode. Create a file waypoints.json and write to storage on the Bangle.js using the IDE. The first 6 characters of the name are displayed in Speed+[D]istance mode. -Sample waypoints.json +The GPS Navigation app in the App Loader has a really nice waypoints file editor. + +Sample waypoints.json (My sailing waypoints)
 [

From f610ce521cab3748b1df25569cff75b82fbf5184 Mon Sep 17 00:00:00 2001
From: nujw 
Date: Fri, 5 Feb 2021 18:08:33 +1300
Subject: [PATCH 39/67] Update README.md

---
 apps/speedalt/README.md | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md
index c5f8883a5..cdffa483d 100644
--- a/apps/speedalt/README.md
+++ b/apps/speedalt/README.md
@@ -1,10 +1,12 @@
-Displays the GPS speed, altitude and distance to selected waypoint. One is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. 
+# GPS Speed, Altimeter and Distance to Waypoint
 
-You can chose between two modes. One showing speed and altitude (A) and one showing speed and distance to waypoint (D). 
+You can switch between two display modes. One showing speed and altitude (A) and one showing speed and distance to waypoint (D). 
+
+Within each display mode one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. 
 
 The waypoints list is the same as that used with the [GPS Navigation] app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information.
 
-Left Display Tap : Swaps the displays. You can have either speed or [A]ltitude/[D]istance on the large primary display.
+Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display.
 
 BTN1 : [Speed+Altitude] Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded.
 
@@ -14,9 +16,9 @@ BTN1 : [Speed+Distance] Select next waypoint. Last fix distance from selected wa
 
 BTN3 : Swaps the modes between Speed+[A]ltitude or Speed+[D]istance.
 
-App Settings : Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance caqn be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default, high contrast (all white on black) or night ( all red on black ). 
+App Settings : Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). 
 
-Loss of fix : When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats'  or 'Age' indicates whether the GPS has a fix or not.  
+Loss of fix : When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats'  or 'Age' indicates whether the GPS has a current fix or not.  
 
 Speed and Altitude:
![](screen1.png)

@@ -31,7 +33,7 @@ Settings:
Developed for my use in sailing, cycling and motorcycling. If you find this software useful or have feedback drop me a line mike[at]kereru.com. Enjoy! -Low Power GPS Service : +## Low Power GPS Service This app will work quite happily without this service but will use the Low power GPS Service if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. @@ -39,7 +41,7 @@ When using the Low Power GPS Service this app switches the GPS to SuperE (defaul There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will also contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. -Waypoints: +## Waypoints Waypoints are used in [D]istance mode. Create a file waypoints.json and write to storage on the Bangle.js using the IDE. The first 6 characters of the name are displayed in Speed+[D]istance mode. @@ -110,7 +112,7 @@ Sample waypoints.json (My sailing waypoints) ]

-Thanks: +## Thanks Many thanks to Gordon Williams. Awesome job. From de21b9b57013346c7f045e9278bf6e8048c74dc5 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 18:09:32 +1300 Subject: [PATCH 40/67] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index fa3ab83c4..b5a98ec85 100644 --- a/apps.json +++ b/apps.json @@ -2625,7 +2625,7 @@ "name": "GPS Speedo and Altimeter", "shortName":"GPS Speed Alt", "icon": "app.png", - "version":"2.07", + "version":"1.00", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From fd17073693f5309a704acae47291309ebbce9416 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 18:22:25 +1300 Subject: [PATCH 41/67] Update README.md --- apps/speedalt/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index cdffa483d..13e840bfb 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -4,7 +4,7 @@ You can switch between two display modes. One showing speed and altitude (A) and Within each display mode one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. -The waypoints list is the same as that used with the [GPS Navigation] app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. +The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. @@ -35,9 +35,9 @@ Developed for my use in sailing, cycling and motorcycling. If you find this soft ## Low Power GPS Service -This app will work quite happily without this service but will use the Low power GPS Service if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. +This app will work quite happily without this service but will use the [Low power GPS Service](https://banglejs.com/apps/#low%20power%20gps%20service) if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. -When using the Low Power GPS Service this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off. This delay gives an opportunity to restore the display before the power mode is switched. +When using the Low Power GPS Service this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off and the delay gives an opportunity to restore the display before the GPS power mode is switched. There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will also contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. @@ -45,7 +45,7 @@ There are a couple of things to consider when using the Low Power GPS Service. T Waypoints are used in [D]istance mode. Create a file waypoints.json and write to storage on the Bangle.js using the IDE. The first 6 characters of the name are displayed in Speed+[D]istance mode. -The GPS Navigation app in the App Loader has a really nice waypoints file editor. +The [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app in the App Loader has a really nice waypoints file editor. (Must be connected to your Bangle.JS and then click on the Download icon.) Sample waypoints.json (My sailing waypoints) @@ -116,6 +116,6 @@ Sample waypoints.json (My sailing waypoints) Many thanks to Gordon Williams. Awesome job. -Special thanks also to @jeffmer, for the 'GPS Navigation' app and @hughbarney for the 'Low power GPS Service' work. +Special thanks also to @jeffmer, for the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app and @hughbarney for the [Low power GPS Service](https://banglejs.com/apps/#low%20power%20gps%20service) work. From 256cb4f6c32200e9991ad3b1cf238ced5c5f660b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 21:48:15 +1300 Subject: [PATCH 42/67] Update app.js --- apps/speedalt/app.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 3de66926b..09b8d69e0 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.00'; +var v = '1.01'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -10,6 +10,7 @@ require("Font7x11Numeric7Seg").add(Graphics); var lf = {fix:0,satellites:0}; var showMax = 0; // 1 = display the max values. 0 = display the cur fix +var pwrSav = 1; // 1 = default power saving with watch screen off and GPS to PMOO mode. 0 = screen kept on. var maxPress = 0; // Time max button pressed. Used to calculate short or long press. var canDraw = 1; var time = ''; // Last time string displayed. Re displayed in background colour to remove before drawing new time. @@ -262,6 +263,19 @@ function toggleAltDist() { onGPS(lf); } +function togglePwrSav() { + pwrSav=!pwrSav; + if ( pwrSav ) { + var s = require('Storage').readJSON('setting.json',1)||{}; + var t = s.timeout||10; + Bangle.setLCDTimeout(t); + } + else { + Bangle.setLCDTimeout(0); + Bangle.setLCDPower(1); + } +} + function setButtons(){ // Spd+Dist : Select next waypoint @@ -277,6 +291,9 @@ function setButtons(){ // Touch left screen to toggle display setWatch(toggleDisplay, BTN4, {repeat:true,edge:"falling"}); + // Touch right screen to toggle pwrSav + setWatch(togglePwrSav, BTN5, {repeat:true,edge:"falling"}); + } function btnPressed() { From 91935f4ebe6c9b12a0f96ee66802e7828c0400b3 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 21:58:14 +1300 Subject: [PATCH 43/67] Update app.js --- apps/speedalt/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 09b8d69e0..eb81d417b 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.01'; +var v = '1.02'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -266,6 +266,7 @@ function toggleAltDist() { function togglePwrSav() { pwrSav=!pwrSav; if ( pwrSav ) { + LED1.reset(); var s = require('Storage').readJSON('setting.json',1)||{}; var t = s.timeout||10; Bangle.setLCDTimeout(t); @@ -273,6 +274,7 @@ function togglePwrSav() { else { Bangle.setLCDTimeout(0); Bangle.setLCDPower(1); + LED1.set(); } } From 10539c251629fa998ebc647106c433928e83af6d Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 22:07:31 +1300 Subject: [PATCH 44/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index eb81d417b..40712b061 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.02'; +var v = '1.00'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts From c8dfac215d044ab5585641c485256f7a7a6f8c08 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 5 Feb 2021 22:11:02 +1300 Subject: [PATCH 45/67] Update README.md --- apps/speedalt/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index 13e840bfb..00062269d 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -6,7 +6,9 @@ Within each display mode one figure is displayed on the watch face using the lar The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. -Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. +BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. + +BTN5 : Right Display Tap : Disables/Restores power saving timeout. Locks the screen on to enable reading for longer periods but maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Tap again to restore power saving timeouts. BTN1 : [Speed+Altitude] Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. From 24afa000bdb4efc841048562cebee6b8b3faddc4 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 09:17:33 +1300 Subject: [PATCH 46/67] Update app.js --- apps/speedalt/app.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 40712b061..24838ccf1 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.00'; +var v = '1.01'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -345,9 +345,11 @@ function isLP() { return(1); } +/* function lpGetFix() { onGPS(WIDGETS.gpsservice.gps_get_fix()); } +*/ function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power @@ -414,15 +416,15 @@ Bangle.on('lcdPower',function(on) { g.clear(); Bangle.loadWidgets(); Bangle.drawWidgets(); - var lp = isLP(); // Low power GPS widget installed. - - -Bangle.setGPSPower(1); onGPS(lf); - -if ( lp ) setInterval(lpGetFix, 1000); -else Bangle.on('GPS', onGPS); - +if ( lp ) { + setLpMode('SuperE'); + setInterval(onGPS(WIDGETS.gpsservice.gps_get_fix()), 1000); +} +else { + Bangle.setGPSPower(1); + Bangle.on('GPS', onGPS); +} setButtons(); setInterval(updateClock, 30000); From d6afa194a944f5093046cbd6bbf157e71ad8e5b6 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 09:26:41 +1300 Subject: [PATCH 47/67] Update app.js --- apps/speedalt/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 24838ccf1..630a69a84 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -416,15 +416,17 @@ Bangle.on('lcdPower',function(on) { g.clear(); Bangle.loadWidgets(); Bangle.drawWidgets(); -var lp = isLP(); // Low power GPS widget installed. onGPS(lf); + +var lp = isLP(); // Low power GPS widget installed? if ( lp ) { setLpMode('SuperE'); - setInterval(onGPS(WIDGETS.gpsservice.gps_get_fix()), 1000); + setInterval(()=>onGPS(WIDGETS.gpsservice.gps_get_fix()), 1000); } else { Bangle.setGPSPower(1); Bangle.on('GPS', onGPS); } + setButtons(); setInterval(updateClock, 30000); From 7bd7f371066fd3a94c48dcbb5eb2a9d3c481e334 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 10:28:20 +1300 Subject: [PATCH 48/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 630a69a84..0cc435544 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.01'; +var v = '1.02'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -355,7 +355,7 @@ function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); - if ( m !== s.power_mode ) { + if ( m !== s.power_mode || !s.gpsservice ) { s.gpsservice = true; s.power_mode = m; WIDGETS.gpsservice.gps_set_settings(s); From 3b3c1da0ea400f14a637a32eaa06abe022ed87fb Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 10:31:39 +1300 Subject: [PATCH 49/67] Update app.js --- apps/speedalt/app.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 0cc435544..8041dc095 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.02'; +var v = '1.03'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -345,12 +345,6 @@ function isLP() { return(1); } -/* -function lpGetFix() { - onGPS(WIDGETS.gpsservice.gps_get_fix()); -} -*/ - function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; From aa6bcb11deff0169335bf15a1e13577e5a36f81d Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 10:59:36 +1300 Subject: [PATCH 50/67] Update app-icon.js --- apps/speedalt/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app-icon.js b/apps/speedalt/app-icon.js index 6c03df55b..f4f24a18b 100644 --- a/apps/speedalt/app-icon.js +++ b/apps/speedalt/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("m02xH+AH4AJlgAMGWQ4lEw1Wq2BAAgHBG8QhFq+C1nXABGswQ4GGjhkBGJIAHOQI2ZDIcyGaQ3EmQ3WNAiaKABusNyoUDNCxuGGySdDNDBuGUoY0e2etAAWzGzoOCGheJxNlAA2J1o2LGprTNGRAAFbZw0LqwZI1pkGAAgJDUxdWGxTULFAmJFJGzURjaET6Q0DGZKYIrqjRT5Q0EGZwpEUZZqPaYaRMGg6LINhBJKNK40JAAI1Iq6fJGjDrIUQoVCwRqJDhA0OXYQRGwRsEAgWsNTCeIDYTwG1g1GqygJNROsq0ymVWq7TI2ZRJUQg1JUARkMAAg0FDhY1GDAxOKQwgAEKI6IKKAQ1KeAQ1IJ4VXAog1gC4Q1ImQVBAwYFBmQ1K1o1fMoQ1ORIQ1Ua5ahD1uzrqnEULo1L1gVBAAusGrDxHC4NlEY4aDAAZQGDhiHCGpZOJNodWmUyqxpIRBY1GQw7wCURAAPKIWtXhI1EwSFJNhIAMNQSgHwQ1EGwVXKBJsWDJSgENgjyKGyg0CNQ/XNQo1DwIRGbIS+HABYWLwI1GGwVWKhZtQChigGNhg2TCRhqIGwcy1g2YCBmsmQ0INgajIYgY1PdRKfCGpCjMG4ShNBxSfKGwyjIADOsGho1DbRI0YagQ1MG0Y0RGwjbLACLTDGh42FqxuY1lWGig2FmRuWwKdDGiZuHG6WBNC42JHAWCVBWswQyEGjQ3IHAJyBAAgHBCAwzbG5QAMGb44SGUgAkA")) +require("heatshrink").decompress(atob("mEwxH+AH4A/AE+sFtoABF12swItsF9QuFR4IwmFwwvnFw4vCGEYuIF4JgjFxIvkFxQvCGBfOAAQvqFwYwRFxYvDGBIvUFxgv/F6IuNF4n+0nB4TvXFxwvF4XBAALlPF7ZfBGC4uPF4rABGAYAGTQwvad4YwKFzYvIGBQvfFwgAE3Qvt4IvEFzgvCLxO7Lx7vULzIzTFwIvgGZheFRAiNRGSQvpGYouesYAGmQAKq3CE4PIC4wviq2eFwPCroveCRSGEC6Qv0DAwRLcoouWC4VdVYQXkr1eAgVdAoIABroNEB4gHHC5QvHwQSDAAOCA74vH1uICQIABxGtA74vIAEwv/F/4vXAH4A/AHY")) From 464317aecbe50674d02d102d3e1c058e48fc91e5 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 11:00:09 +1300 Subject: [PATCH 51/67] Add files via upload --- apps/speedalt/app.png | Bin 3356 -> 1639 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/apps/speedalt/app.png b/apps/speedalt/app.png index 41849d3072b2e9625782fb0ae0d61b931b312373..93d8e57dcbfaf905321fffcf06df042aa49d7dc8 100644 GIT binary patch literal 1639 zcmV-t2AKJYP)@pC8}P=li+m^Env72)@5?yIePa+S>ZbmYsjOa=2m` z!{OB3)^@Gi>3mz!4w$0Hsk)+sbUjipG!&a5|mi z0)`wD_))?j-{$=p(Hmdb{pQ4>#*6Vi6tc_Zs;~=3feFd%R;{|DPtl#K#zRAi7Y`X1 z;B-32+0egXk^BI1gjay&Ter42GL0Dz85MB$^yxyo$U$Iys+>m`&vy%a=qU``n@P+> zNP8DjRdIK?-TImuq^&ql&*I#FWmi3gE><5sB1FaOuOpr#vV?n<_ z(dFmE1qqjs%jGHp7J&{q>2Qby*D7qRpED;gC=2aCEBXiDExut%@3&{)$jNhX)r2YG z^dnNg&zDjGMkx7$Y$pHGo;N24gYr|qS+FpfUBG`~4S=I0`nS$#h_+3*gamysqb!pk zXv%7YEpd4d5ubDqMVujc>)h5J>qvFn-dc4qzLwO;v4OF4uHK zDiy5+ZXrpN_sZ@=#Xj{d&k>z5AX5;YnD;7bECtO;8eHUgNwAw_bgd#HLExkQ@!Xj+ zXB>X7_a+mwQjkhu24U}4pZZo9%HcI2rhoVL=_y*H6IEB8WWWn~`V z-Tpy)d;4g+$ZY~Y$B;^am0~yN4W?9AbqDCW6kH$2X1iauedJGMVA;$qJ+`S27!^;a zLFHfD)9b&=?EzjY{WpaYdh*?c4qo{24Fn`I6~AH7lb74K>t{82$^4}<13f@#JcasV z&KF6MZz%O8J%h>nRCsynRJse|UsOmac2ZauAatVf3o!C+e}8AsYqKqV^h0Z_b|Kt1 z@O_l9{PWVHU!u&4Ymd6Dd|G#zCMOdsSK06%Q^1oACnNf8o85N^@B&=+bs3j^T{fWdc+A|x(cEZ$IG!5wbnEk_ zzpY`zq1m!&pEnc#(LQ5#p(i)~!vyvkhHU0Pfl~n8(?8u^c&_xWf^(r)p||8Ly(MS& zk3BghbW*$AKFu`sF)m((MDVTj>G)q)J0s$u#}x4D?$7k|?)Yu_xT{0E#ii6gwD`J+ zoMU#ODHE@txF{F*m*+X}3AOBn4m;z^3mIFQ4{*u#;fR@m_fLG4-4jffF?;5ih@6Mz lPrm;rMhY0g2u5&e@jt$gS?$`E2( zQGB(1IH>AZQJX2$l-t1=JTD#C!BQd=kzAciDB`1xoR5FStYkpzMykRK#L z#Yb{)Lby4*f1LZ{+;GmhH$U`sruqK0&%SG~z4qFBuf6u#>%tI*FoYre14De1oh@`e z8LvoBij;B^2#1i;0U(8NfpiHWE~z4-=0NF|)^AFtuT=p#Im_-*BSpTHA`_So#DytU z8KjqHcJ2*38nPq9S!L z5FGav^==)qvJ(78NK^eAgV&JAKN1nFt1%$;*T8R;`fN=!fq>n^2~T)xu4 z|9*Ow508G#>9bWx89Y{rIAX)|qssD~X9p_#Kouae78kq*{09)}t8_T*I2S)kUhX4| zi5oqj4qDr;QNDX0AC&LG?e5h7bV~~H(*tGORx^Or&~F9IbvlQ|s8O4dPSJ`^(x89WEDJi%TfpS%$~s(f{;;$1a{aylq=YfB5!G0lB$_akms%0nGN* zrA|xcwU=KYF=1?fScZ*;#wJ#+SxZ&Tg+QegCn6<_ckkYIt*`w0tN`!ej{qs4?eoW% z=kv_>R$#LY)Zm8)kEe%sH~oq2C1pDMAgd!)WnN#E&?kxKI-SE5Z2N#T07X%FJFDzL?8MUF>2IiU>1PQ zX5(i+eU-W2xxY`sU%v@gUGQZWbbC+qCI2)P9o<`sNbNd5@gIlun5t1OSYZWaDe4OL$T*Qbtz`{E(xE{HN& zcilZua~*2Gf-!b@Sl3NwR~IqS)_dael}4U_X(b*{4**h#6$i?;ZMAA+xdn=fij;#XaVrWRW8T9Ln$mZxu>OoT03VWu!S|;@W+KGf!Dew-*c6Rs`be!EXs+=)8-CBv zUw?zzi*;nqd&so?h&zYV)!D_l>hk~yM9QVws&!Ulv^=}CTb*{XiFG)5e3|*amuNFz zcOy{u;63nSI!qjH)r&c#l>BDxMs}7~0C4Q%lXP}jThSGTOR?Kyd>m$EEh=zY(T6y^ z<+HxhlEpce?(M;b;AOvLA{0yprJv5WHuw#c?XL9KEp;vmxea1t9XJ=~1S$m2np0aS zV4?HLcqw@Vv}12^PL?T?Yn__G^WlNJVL^hWoR*MM^49v_QMP-Zzb-dBlOI0&bXe{4 zaVw6hvwBh6K7*%~>+Tx6)?>cx(QEAq*WMZO_O!(1IID z;}cCgI{kT|d|$k|Kzbbc@E9ef71Vxq34ke+?e& z@5K|0`GiR%UzOxt3XXVQ;81|cdm)4g@)r{}|b;F%exA!B2AYt5CF4TSofO<#7 zRNyuR7;XVoRsDJ$H})RW!CZ9(%1Oh_Jv<+de0c1(!S_bm%;|@p++ zAYoiUcG1H`BN{^m2!wwp4<8n5+JW8(-5G|@UgC9V0A_tFoh_Tzvt`qI;>QHyhEkOw zV+;DetZtXFv3l86L+fOs0Q@?Rws1Ty>Ab#hZhF2w53usbFED!4NJftu$veM((?8?B zC2NJ@x+ULb(XS&W#$Q$y5xxS#hVGsf&dDcCsHBdO2*Y*M3mqcL-X~r?xovktS($WwCMV>3ZVtdt{5u7 za0MueQtvA_HD5LDAW>&ynq0RBKYHV#2Opr|u{_h?pL()@`(|ZW^6;q8tQ%LNxs9f= zso7taHtLLM3|D|EB5DM;0BC4xMoMXTEDej&;&xwjX~B&1*CBP3rTjeigMTJ%(uLpvuaWR3YQg28pX=(~gUZjWfMs$V>I8eH!H7l>6 z4apdn%T4{|1}07zZ`e^r92{uS%12v5D*&{W@X&(~geEk=G2Mbpw|I4{tG|ppU;|pr z-V4l60m)%s@src$Z;-Rc1WthJFQK7d4^-jdO1riKKV&FR?PTK-z_~_`z{<6@Gr8i6!VDt3s1Uvwr zo;gQL>uqkdAGs4W{~R=9SYB^R+HaKBL8EtdMJn)Uk~wW_+cnNs)%ZR=YDDBNGg?yx zXg4QO37SEv*t6fX!!a?z0v&FI|86oDu&+4WsKo(%$W5}I{axjI1CJzvJytnKmY$$g z)D6CJX~kYTT;?~A`Qu=Q&H#RJNsAPz1K19#)OeKY4zRS*FwY{~*52O1u8Ke$QAn}D zoH~R89-cL`RKPg^m&?u8;u3R40-j0<4u~9T)S@@n%$-S7TBKO&kv2O}2Ks zH^09_Z~f2gE8k|i{2_z_ii(OEA8;^IjdfbvGJVN z)`yv+;Q5)_{x?JYv06ZQKtJbXbzq}YBN`a@RX<>1n zVI0Vz5TR(io}O+!culr(S%B&u*!T{JM)(AsQov`m zHEs7!o!$v#15}@{W%Q_#Owrx$jNpibq~U!ZJZQJPq~RKmP$=KCpWnatXaBd9^3?;o zi>*UXUWA9RgCE@HoWMzNERlaV&_8_N^&cs#7zxQX9w+8mT5<*`L(9p1V1 zE6c{c(El_!K{-PDpI=gvr?B$n7ryo_QGfXgtJb{3`Pz&6>f;_IGVk!NEuWjUGef^4 zYV!*VVLMa+EYHtlMd4CnV;%ivZHV^v4mQ8PgOXhpy^rA?%B`61S604f z5g<3mz*A)xE&nk>{3qa#3fk>4I2Y%T_h`1|qiQ&4X>FsdqLN(|m3j{kpj%4$lLHmo zf6MJ1T#{n@z8g)Wa)`XAi> z{Ahpq*6M-EKFI0vg^vr#zk{4%L}0hakT7m6iQ~rNh;{gr9Xh+ZaCNw7XlkahvAOq5 z>v2ZF>s}AsNGH> zMW*+OI?VTDT7W}Ba!`1BN{wE12MgcmpQdti3*)*KnF4Z>B8f!^EvPMJhg3wnl+;D3 mqNYDt-$NL}5QZ>>e&BBr{h5vNHZoHH0000 Date: Sat, 6 Feb 2021 11:00:47 +1300 Subject: [PATCH 52/67] Update app.js --- apps/speedalt/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 8041dc095..c6421df98 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.03'; +var v = '1.04'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts From 3a63458834daffe3b7879ed23a00ddb0f46e34ed Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 11:07:50 +1300 Subject: [PATCH 53/67] Major functionality update to speedalt. Renamed to GPS Adventure Sports. Added distance to waypoint. Added Low Power GPS Service. Many minor tweaks. --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index b5a98ec85..c85bf25d4 100644 --- a/apps.json +++ b/apps.json @@ -2622,8 +2622,8 @@ ] }, { "id": "speedalt", - "name": "GPS Speedo and Altimeter", - "shortName":"GPS Speed Alt", + "name": "GPS Adventure Sports", + "shortName":"GPS Adv", "icon": "app.png", "version":"1.00", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", From 083ce365deafe7504b2fed40aa54d084e91252f6 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 11:17:07 +1300 Subject: [PATCH 54/67] Update README.md --- apps/speedalt/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index 00062269d..03c4a0f17 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -37,7 +37,7 @@ Developed for my use in sailing, cycling and motorcycling. If you find this soft ## Low Power GPS Service -This app will work quite happily without this service but will use the [Low power GPS Service](https://banglejs.com/apps/#low%20power%20gps%20service) if it is installed. In this case the GPS Service must be On for this app to obtain a fix. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. +This app will work quite happily without this service but will use the [Low power GPS Service](https://banglejs.com/apps/#low%20power%20gps%20service) if it is installed. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. When using the Low Power GPS Service this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off and the delay gives an opportunity to restore the display before the GPS power mode is switched. From 417ebad08cc547872759a33dd99d3cdf61ab6033 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 12:09:14 +1300 Subject: [PATCH 55/67] Update app.js --- apps/speedalt/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index c6421df98..6c9f4aa3e 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.04'; +var v = '1.05'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -391,8 +391,8 @@ var img = { palette:new Uint16Array([0,0x4FE0,0xEFE0,0x07DB]) }; -if ( settings.colour == 1 ) img.palette = new Uint16Array([0,0xFFFF,0xFFFF,0xFFFF]); -if ( settings.colour == 2 ) img.palette = new Uint16Array([0,0xFF800,0xF800,0xF800]); +if ( settings.colour == 1 ) img.palette = new Uint16Array([0,0xFFFF,0xFFF6,0xDFFF]); +if ( settings.colour == 2 ) img.palette = new Uint16Array([0,0xFF800,0xFAE0,0xF813]); var SCREENACCESS = { withApp:true, From f5dcf7b0e66fe67286a35d39a2dcb4cdce66643f Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 17:10:17 +1300 Subject: [PATCH 56/67] Update app.js --- apps/speedalt/app.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 6c9f4aa3e..f9d69f64e 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.05'; +var v = '1.06'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -11,7 +11,7 @@ require("Font7x11Numeric7Seg").add(Graphics); var lf = {fix:0,satellites:0}; var showMax = 0; // 1 = display the max values. 0 = display the cur fix var pwrSav = 1; // 1 = default power saving with watch screen off and GPS to PMOO mode. 0 = screen kept on. -var maxPress = 0; // Time max button pressed. Used to calculate short or long press. +// var maxPress = 0; // Time max button pressed. Used to calculate short or long press. var canDraw = 1; var time = ''; // Last time string displayed. Re displayed in background colour to remove before drawing new time. var tmrLP; // Timer for delay in switching to low power after screen turns off @@ -281,9 +281,20 @@ function togglePwrSav() { function setButtons(){ // Spd+Dist : Select next waypoint - setWatch(btnPressed, BTN1,{repeat:true,edge:"rising"}); - setWatch(btnReleased, BTN1,{repeat:true,edge:"falling"}); - +// setWatch(btnPressed, BTN1,{repeat:true,edge:"rising"}); +// setWatch(btnReleased, BTN1,{repeat:true,edge:"falling"}); + setWatch(function(e) { + var dur = e.time - e.lastTime; + if ( settings.modeA ) { + // Spd+Alt mode - Switch between fix and MAX + if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display + else { max.spd = 0; max.alt = 0; } // Long press resets max values. + } + else nxtWp(1); // Spd+Dist mode - Select next waypoint + onGPS(lf); + }, BTN1, { edge:"falling",repeat:true}); + + // Show launcher when middle button pressed setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); @@ -298,10 +309,12 @@ function setButtons(){ } +/* function btnPressed() { maxPress = getTime(); } + function btnReleased() { var dur = getTime()-maxPress; if ( settings.modeA ) { @@ -313,6 +326,7 @@ function btnReleased() { onGPS(lf); } +*/ function updateClock() { if (!canDraw) return; From 7ae823f6391806c49864480bd1bc1bb46abcaae4 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 17:15:13 +1300 Subject: [PATCH 57/67] Update app.js --- apps/speedalt/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index f9d69f64e..17d55e516 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.06'; +var v = '1.07'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -292,20 +292,20 @@ function setButtons(){ } else nxtWp(1); // Spd+Dist mode - Select next waypoint onGPS(lf); - }, BTN1, { edge:"falling",repeat:true}); + }, BTN1, { edge:"falling",repeat:true,debounce:50}); // Show launcher when middle button pressed setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); // Toggle between alt or dist - setWatch(toggleAltDist, BTN3, {repeat:true,edge:"falling"}); + setWatch(toggleAltDist, BTN3, {repeat:true,edge:"falling",debounce:50}); // Touch left screen to toggle display - setWatch(toggleDisplay, BTN4, {repeat:true,edge:"falling"}); + setWatch(toggleDisplay, BTN4, {repeat:true,edge:"falling",debounce:50}); // Touch right screen to toggle pwrSav - setWatch(togglePwrSav, BTN5, {repeat:true,edge:"falling"}); + setWatch(togglePwrSav, BTN5, {repeat:true,edge:"falling",debounce:50}); } From 39accb63b393d8d91ae64e97f731c6d5053a1da6 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 17:23:17 +1300 Subject: [PATCH 58/67] Update app.js --- apps/speedalt/app.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 17d55e516..76091f20b 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -11,7 +11,6 @@ require("Font7x11Numeric7Seg").add(Graphics); var lf = {fix:0,satellites:0}; var showMax = 0; // 1 = display the max values. 0 = display the cur fix var pwrSav = 1; // 1 = default power saving with watch screen off and GPS to PMOO mode. 0 = screen kept on. -// var maxPress = 0; // Time max button pressed. Used to calculate short or long press. var canDraw = 1; var time = ''; // Last time string displayed. Re displayed in background colour to remove before drawing new time. var tmrLP; // Timer for delay in switching to low power after screen turns off @@ -281,8 +280,6 @@ function togglePwrSav() { function setButtons(){ // Spd+Dist : Select next waypoint -// setWatch(btnPressed, BTN1,{repeat:true,edge:"rising"}); -// setWatch(btnReleased, BTN1,{repeat:true,edge:"falling"}); setWatch(function(e) { var dur = e.time - e.lastTime; if ( settings.modeA ) { @@ -309,25 +306,6 @@ function setButtons(){ } -/* -function btnPressed() { - maxPress = getTime(); -} - - -function btnReleased() { - var dur = getTime()-maxPress; - if ( settings.modeA ) { - // Spd+Alt mode - Switch between fix and MAX - if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display - else { max.spd = 0; max.alt = 0; } // Long press resets max values. - } - else nxtWp(1); // Spd+Dist mode - Select next waypoint - - onGPS(lf); -} -*/ - function updateClock() { if (!canDraw) return; drawTime(); From 3f5552170d0b081ccdd47e0cf45c9197490a6111 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 20:31:31 +1300 Subject: [PATCH 59/67] Update app.js --- apps/speedalt/app.js | 63 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 76091f20b..1603d5548 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.07'; +var v = '1.08'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -249,34 +249,6 @@ function onGPS(fix) { } - -function toggleDisplay() { - settings.primSpd = !settings.primSpd; - savSettings(); - onGPS(lf); // Update display -} - -function toggleAltDist() { - settings.modeA = !settings.modeA; - savSettings(); - onGPS(lf); -} - -function togglePwrSav() { - pwrSav=!pwrSav; - if ( pwrSav ) { - LED1.reset(); - var s = require('Storage').readJSON('setting.json',1)||{}; - var t = s.timeout||10; - Bangle.setLCDTimeout(t); - } - else { - Bangle.setLCDTimeout(0); - Bangle.setLCDPower(1); - LED1.set(); - } -} - function setButtons(){ // Spd+Dist : Select next waypoint @@ -293,17 +265,38 @@ function setButtons(){ // Show launcher when middle button pressed - setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); + // setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); + // Power saving on/off + setWatch(function(e){ + pwrSav=!pwrSav; + if ( pwrSav ) { + LED1.reset(); + var s = require('Storage').readJSON('setting.json',1)||{}; + var t = s.timeout||10; + Bangle.setLCDTimeout(t); + } + else { + Bangle.setLCDTimeout(0); + Bangle.setLCDPower(1); + LED1.set(); + } + }, BTN2, {repeat:true,edge:"falling",debounce:50}); + // Toggle between alt or dist - setWatch(toggleAltDist, BTN3, {repeat:true,edge:"falling",debounce:50}); + setWatch(function(e){ + settings.modeA = !settings.modeA; + savSettings(); + onGPS(lf); + }, BTN3, {repeat:true,edge:"falling",debounce:50}); // Touch left screen to toggle display - setWatch(toggleDisplay, BTN4, {repeat:true,edge:"falling",debounce:50}); + setWatch(function(e){ + settings.primSpd = !settings.primSpd; + savSettings(); + onGPS(lf); // Update display + }, BTN4, {repeat:true,edge:"falling",debounce:50}); - // Touch right screen to toggle pwrSav - setWatch(togglePwrSav, BTN5, {repeat:true,edge:"falling",debounce:50}); - } function updateClock() { From 64c1adeaf6db3aaa71b9e5bff548cc0bc4637f6b Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 20:33:57 +1300 Subject: [PATCH 60/67] Update README.md --- apps/speedalt/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index 03c4a0f17..54d7f0f94 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -8,16 +8,18 @@ The waypoints list is the same as that used with the [GPS Navigation](https://ba BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. -BTN5 : Right Display Tap : Disables/Restores power saving timeout. Locks the screen on to enable reading for longer periods but maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Tap again to restore power saving timeouts. - BTN1 : [Speed+Altitude] Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. BTN1 : [Speed+Altitude] Long press > 2 secs resets the recorded maximum values. BTN1 : [Speed+Distance] Select next waypoint. Last fix distance from selected waypoint is displayed. +BTN2 : Disables/Restores power saving timeout. Locks the screen on to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Tap again to restore power saving timeouts. + BTN3 : Swaps the modes between Speed+[A]ltitude or Speed+[D]istance. +BTN3 : Long press exit and return to watch. + App Settings : Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). Loss of fix : When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats' or 'Age' indicates whether the GPS has a current fix or not. From 90ae9f0f8c2198599e67112c906e31c400ec5245 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 20:42:01 +1300 Subject: [PATCH 61/67] Update app.js --- apps/speedalt/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 1603d5548..d25d95f64 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.08'; +var v = '1.09'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -261,7 +261,7 @@ function setButtons(){ } else nxtWp(1); // Spd+Dist mode - Select next waypoint onGPS(lf); - }, BTN1, { edge:"falling",repeat:true,debounce:50}); + }, BTN1, { edge:"falling",repeat:true}); // Show launcher when middle button pressed @@ -281,21 +281,21 @@ function setButtons(){ Bangle.setLCDPower(1); LED1.set(); } - }, BTN2, {repeat:true,edge:"falling",debounce:50}); + }, BTN2, {repeat:true,edge:"falling"}); // Toggle between alt or dist setWatch(function(e){ settings.modeA = !settings.modeA; savSettings(); onGPS(lf); - }, BTN3, {repeat:true,edge:"falling",debounce:50}); + }, BTN3, {repeat:true,edge:"falling"}); // Touch left screen to toggle display setWatch(function(e){ settings.primSpd = !settings.primSpd; savSettings(); onGPS(lf); // Update display - }, BTN4, {repeat:true,edge:"falling",debounce:50}); + }, BTN4, {repeat:true,edge:"falling"}); } From 48a6d29d608ab529e991b8a6f8334c9585e395b8 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 21:08:13 +1300 Subject: [PATCH 62/67] Update app.js --- apps/speedalt/app.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index d25d95f64..85ed5e75b 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.09'; +var v = '1.10'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -269,17 +269,21 @@ function setButtons(){ // Power saving on/off setWatch(function(e){ - pwrSav=!pwrSav; - if ( pwrSav ) { - LED1.reset(); - var s = require('Storage').readJSON('setting.json',1)||{}; - var t = s.timeout||10; - Bangle.setLCDTimeout(t); - } - else { - Bangle.setLCDTimeout(0); - Bangle.setLCDPower(1); - LED1.set(); + var dur = e.time - e.lastTime; + if ( dur < 2 ) { // Short press. + pwrSav=!pwrSav; + if ( pwrSav ) { + LED1.reset(); + var s = require('Storage').readJSON('setting.json',1)||{}; + var t = s.timeout||10; + Bangle.setLCDTimeout(t); + } + else { + Bangle.setLCDTimeout(0); + Bangle.setLCDPower(1); + LED1.set(); + } + else setLpMode('SuperE',false); // long press, power off LP GPS } }, BTN2, {repeat:true,edge:"falling"}); @@ -309,7 +313,7 @@ function updateClock() { function startDraw(){ canDraw=true; - setLpMode('SuperE'); // off + setLpMode('SuperE',true); // off g.clear(); Bangle.drawWidgets(); onGPS(lf); // draw app screen @@ -317,7 +321,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO',true);}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. } function savSettings() { @@ -330,12 +334,12 @@ function isLP() { return(1); } -function setLpMode(m) { +function setLpMode(m,p) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); if ( m !== s.power_mode || !s.gpsservice ) { - s.gpsservice = true; + s.gpsservice = p; s.power_mode = m; WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); @@ -399,7 +403,7 @@ onGPS(lf); var lp = isLP(); // Low power GPS widget installed? if ( lp ) { - setLpMode('SuperE'); + setLpMode('SuperE',true); setInterval(()=>onGPS(WIDGETS.gpsservice.gps_get_fix()), 1000); } else { From 0e2e17229a0eee4125a0a27a6531858be4708f4b Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 21:24:13 +1300 Subject: [PATCH 63/67] Update README.md --- apps/speedalt/README.md | 50 +++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/apps/speedalt/README.md b/apps/speedalt/README.md index 54d7f0f94..f4a679574 100644 --- a/apps/speedalt/README.md +++ b/apps/speedalt/README.md @@ -6,23 +6,39 @@ Within each display mode one figure is displayed on the watch face using the lar The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. -BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. - -BTN1 : [Speed+Altitude] Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. - -BTN1 : [Speed+Altitude] Long press > 2 secs resets the recorded maximum values. - -BTN1 : [Speed+Distance] Select next waypoint. Last fix distance from selected waypoint is displayed. - -BTN2 : Disables/Restores power saving timeout. Locks the screen on to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Tap again to restore power saving timeouts. +## Buttons and Controls BTN3 : Swaps the modes between Speed+[A]ltitude or Speed+[D]istance. +### [A]ltitude mode + +BTN1 : Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. + +BTN1 : Long press > 2 secs resets the recorded maximum values. + +### [D]istance mode + +BTN1 : Select next waypoint. Last fix distance from selected waypoint is displayed. + +### Both modes + +BTN2 : Short press < 2 secs Disables/Restores power saving timeout. Locks the screen on to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Tap again to restore power saving timeouts. + +BTN2 : Long press > 2 secs turns off the low power GPS service and GPS. Exit and restart the app to turn back on. If you are using the low power gps service it will keep the GPS powered on after exiting the app. This is a convenient way to turn it off. + BTN3 : Long press exit and return to watch. -App Settings : Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). +BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. -Loss of fix : When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats' or 'Age' indicates whether the GPS has a current fix or not. +## App Settings + +Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). + +## Loss of fix + +When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats' or 'Age' indicates whether the GPS has a current fix or not. + +## Screens Speed and Altitude:
![](screen1.png)

@@ -35,15 +51,17 @@ MAX Values instead:
Settings:
![](screen4.png)

-Developed for my use in sailing, cycling and motorcycling. If you find this software useful or have feedback drop me a line mike[at]kereru.com. Enjoy! - ## Low Power GPS Service This app will work quite happily without this service but will use the [Low power GPS Service](https://banglejs.com/apps/#low%20power%20gps%20service) if it is installed. You may choose to use the Low Power GPS Service to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Service Readme to understand what this does. When using the Low Power GPS Service this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 30 seconds after the display is blanked by the watch this app will switch the GPS to PMOO mode and will only attempt to get a fix every minute or two. This improves power saving while the display is off and the delay gives an opportunity to restore the display before the GPS power mode is switched. -There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will also contribute to this. The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. +There are a couple of things to consider when using the Low Power GPS Service. This app plus the LP GPS service together use a considerable chunk of the Bangle.JS memory. A large waypoints file will also contribute to this. + +The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. + +When exiting this app the Low Power GPS Service will keep the GPS powered on, using battery. It can be manually turned off using the gps service settings menu. As a convenience, long press BTN2 for 2 seconds will turn it off while using this GPS Adv app. ## Waypoints @@ -116,6 +134,10 @@ Sample waypoints.json (My sailing waypoints) ] +## Comments and Feedback + +Developed for my use in sailing, cycling and motorcycling. If you find this software useful or have feedback drop me a line mike[at]kereru.com. Enjoy! + ## Thanks Many thanks to Gordon Williams. Awesome job. From 9ee180cf4121f46597a829307d372243b1a24222 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 21:29:54 +1300 Subject: [PATCH 64/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 85ed5e75b..bd123173a 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.10'; +var v = '1.11'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -283,8 +283,8 @@ function setButtons(){ Bangle.setLCDPower(1); LED1.set(); } - else setLpMode('SuperE',false); // long press, power off LP GPS } + else setLpMode('SuperE',false); // long press, power off LP GPS }, BTN2, {repeat:true,edge:"falling"}); // Toggle between alt or dist From bafc1b5b48b10c358be08b2781d8c71ebcca8575 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 21:45:54 +1300 Subject: [PATCH 65/67] Update app.js --- apps/speedalt/app.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index bd123173a..62464f34c 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.11'; +var v = '1.12'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -284,7 +284,7 @@ function setButtons(){ LED1.set(); } } - else setLpMode('SuperE',false); // long press, power off LP GPS + else gpsOff(); // long press, power off LP GPS }, BTN2, {repeat:true,edge:"falling"}); // Toggle between alt or dist @@ -313,7 +313,7 @@ function updateClock() { function startDraw(){ canDraw=true; - setLpMode('SuperE',true); // off + setLpMode('SuperE'); // off g.clear(); Bangle.drawWidgets(); onGPS(lf); // draw app screen @@ -321,7 +321,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO',true);}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. } function savSettings() { @@ -334,18 +334,27 @@ function isLP() { return(1); } -function setLpMode(m,p) { +function setLpMode(m) { if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); if ( m !== s.power_mode || !s.gpsservice ) { - s.gpsservice = p; + s.gpsservice = true; s.power_mode = m; WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); } } +function gpsOff() { + if ( !lp ) return; + var s = WIDGETS.gpsservice.gps_get_settings(); + s.gpsservice = true; + s.power_mode = 'SuperE'; + WIDGETS.gpsservice.gps_set_settings(s); + WIDGETS.gpsservice.reload(); +} + // =Main Prog // Read settings. @@ -403,7 +412,7 @@ onGPS(lf); var lp = isLP(); // Low power GPS widget installed? if ( lp ) { - setLpMode('SuperE',true); + setLpMode('SuperE'); setInterval(()=>onGPS(WIDGETS.gpsservice.gps_get_fix()), 1000); } else { From e033a7bcab08d1a9ef2f33ed88586942ed7718c5 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 6 Feb 2021 21:52:57 +1300 Subject: [PATCH 66/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index 62464f34c..b533b1fbe 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.12'; +var v = '1.13'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -349,7 +349,7 @@ function setLpMode(m) { function gpsOff() { if ( !lp ) return; var s = WIDGETS.gpsservice.gps_get_settings(); - s.gpsservice = true; + s.gpsservice = false; s.power_mode = 'SuperE'; WIDGETS.gpsservice.gps_set_settings(s); WIDGETS.gpsservice.reload(); From a167a17d3e224c4f4ed99149eb43f32b2f886269 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 10 Feb 2021 08:10:06 +1300 Subject: [PATCH 67/67] Update app.js --- apps/speedalt/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt/app.js b/apps/speedalt/app.js index b533b1fbe..9b1886cd2 100644 --- a/apps/speedalt/app.js +++ b/apps/speedalt/app.js @@ -2,7 +2,7 @@ Speed and Altitude [speedalt] Mike Bennett mike[at]kereru.com */ -var v = '1.13'; +var v = '1.14'; var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts @@ -321,7 +321,7 @@ function startDraw(){ function stopDraw() { canDraw=false; - if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 30000); //Drop to low power in 30 secs. Keep lp mode off until we have a first fix. + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 10000); //Drop to low power in 10 secs. Keep lp mode off until we have a first fix. } function savSettings() {