From 7905d3cffc5a268635e13baa0b05cbdd97b9ddc1 Mon Sep 17 00:00:00 2001 From: BartS23 <10829389+BartS23@users.noreply.github.com> Date: Mon, 10 Jan 2022 16:11:09 +0100 Subject: [PATCH 1/3] Reduce FIFO_FULL messages 1. the lazy layout rendering takes too much time. 2. enable the gps at the end of the file. 3. save SATinView to detect changes. --- apps/gpsinfo/gps-info.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/gpsinfo/gps-info.js b/apps/gpsinfo/gps-info.js index fdac3d403..79acc05fe 100644 --- a/apps/gpsinfo/gps-info.js +++ b/apps/gpsinfo/gps-info.js @@ -4,7 +4,7 @@ function satelliteImage() { var Layout = require("Layout"); var layout; -Bangle.setGPSPower(1, "app"); +//Bangle.setGPSPower(1, "app"); E.showMessage("Loading..."); // avoid showing rubbish on screen var lastFix = { @@ -19,7 +19,7 @@ var lastFix = { var SATinView = 0; var nofBD = 0; var nofGP = 0; -var listenerGPSraw = 1; +var listenerGPSraw = 0; function formatTime(now) { if (now == undefined) { @@ -87,12 +87,12 @@ function onGPS(fix) { {type:"txt", font:"6x8", pad:3, label:"Satellites used" } ]}, {type:"txt", font:"6x8", label:"", fillx:true, id:"progress" } - ]},{lazy:true}); + ]},{lazy:false}); } g.clearRect(0,24,g.getWidth(),g.getHeight()); layout.render(); } - lastFix = fix; + //lastFix = fix; if (fix.fix) { if (listenerGPSraw == 1) { Bangle.removeListener('GPS-raw', onGPSraw); @@ -108,6 +108,7 @@ function onGPS(fix) { layout.time.label = "Time: "+formatTime(fix.time); layout.sat.label = "Satellites: "+satellites; layout.maidenhead.label = "Maidenhead: "+maidenhead; + layout.render(); } else { if (listenerGPSraw == 0) { Bangle.on('GPS-raw', onGPSraw); @@ -116,7 +117,15 @@ function onGPS(fix) { layout.sat.label = fix.satellites; layout.progress.label = "in view: " + SATinView; } - layout.render(); + //layout.render(); + + if (listenerGPSraw == 0 && !fix.fix) { + setTimeout(() => Bangle.on('GPS-raw', onGPSraw), 10); + listenerGPSraw = 1; + } + + lastFix = fix; + lastFix.SATinView = SATinView; } function onGPSraw(nmea) { @@ -129,7 +138,8 @@ function onGPSraw(nmea) { Bangle.loadWidgets(); Bangle.drawWidgets(); Bangle.on('GPS', onGPS); -Bangle.on('GPS-raw', onGPSraw); +//Bangle.on('GPS-raw', onGPSraw); +Bangle.setGPSPower(1, "app"); function exitApp() { load(); From 8053de33079cc96be65ed2bb1f82557dc1dc0006 Mon Sep 17 00:00:00 2001 From: BartS23 <10829389+BartS23@users.noreply.github.com> Date: Mon, 10 Jan 2022 20:37:22 +0100 Subject: [PATCH 2/3] Fix layout and double enabling of event GPS-raw --- apps/gpsinfo/gps-info.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/gpsinfo/gps-info.js b/apps/gpsinfo/gps-info.js index 79acc05fe..f4521f265 100644 --- a/apps/gpsinfo/gps-info.js +++ b/apps/gpsinfo/gps-info.js @@ -110,12 +110,16 @@ function onGPS(fix) { layout.maidenhead.label = "Maidenhead: "+maidenhead; layout.render(); } else { - if (listenerGPSraw == 0) { - Bangle.on('GPS-raw', onGPSraw); - listenerGPSraw = 1; + if (fix.satelites != lastFix.satelites) { + layout.clear(layout.sat); + layout.sat.label = fix.satellites; + layout.render(layout.sat); + } + if (SATinView != lastFix.SATinView) { + layout.clear(layout.progress); + layout.progress.label = "in view: " + SATinView; + layout.render(layout.progress); } - layout.sat.label = fix.satellites; - layout.progress.label = "in view: " + SATinView; } //layout.render(); From 0c0d7e9dd17ee2565aebe20682a82af66944bc94 Mon Sep 17 00:00:00 2001 From: Romek Date: Tue, 11 Jan 2022 11:10:54 +0100 Subject: [PATCH 3/3] Update changelog and version --- apps.json | 2 +- apps/gpsinfo/ChangeLog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 02076497e..57934dff3 100644 --- a/apps.json +++ b/apps.json @@ -1520,7 +1520,7 @@ { "id": "gpsinfo", "name": "GPS Info", - "version": "0.08", + "version": "0.09", "description": "An application that displays information about altitude, lat/lon, satellites and time", "icon": "gps-info.png", "type": "app", diff --git a/apps/gpsinfo/ChangeLog b/apps/gpsinfo/ChangeLog index 8d428ce85..414b9d9fb 100644 --- a/apps/gpsinfo/ChangeLog +++ b/apps/gpsinfo/ChangeLog @@ -5,3 +5,4 @@ 0.06: Add number of satellites in view and fix crash with GPS time 0.07: Resolve one FIFO_FULL case and exit App with button press 0.08: Leave GPS power switched on on exit (will switch off after 0.5 seconds anyway) +0.09: Fix FIFO_FULL error