From ab1da4278b091ffffd5f302f87ffbc91c963edc3 Mon Sep 17 00:00:00 2001 From: Marco H Date: Sun, 15 Jan 2023 15:46:54 +0100 Subject: [PATCH 1/2] Fix number of packets received --- apps/gpsinfo/ChangeLog | 1 + apps/gpsinfo/gps-info.js | 9 ++++++--- apps/gpsinfo/metadata.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/gpsinfo/ChangeLog b/apps/gpsinfo/ChangeLog index 827c13cdb..d5abdf5d6 100644 --- a/apps/gpsinfo/ChangeLog +++ b/apps/gpsinfo/ChangeLog @@ -8,3 +8,4 @@ 0.09: Fix FIFO_FULL error 0.10: Show satellites "in view" separated by GNS-system 0.11: Show number of packets received +0.12: Fix number of packets received diff --git a/apps/gpsinfo/gps-info.js b/apps/gpsinfo/gps-info.js index 28cb60d8d..6b83b02c5 100644 --- a/apps/gpsinfo/gps-info.js +++ b/apps/gpsinfo/gps-info.js @@ -61,6 +61,7 @@ function getMaidenHead(param1,param2){ return U[fLon]+U[fLat]+sqLon+sqLat+L[subLon]+L[subLat]+extLon+extLat; } function onGPS(fix) { + dataCounter++; if (lastFix.fix != fix.fix) { // if fix is different, change the layout if (fix.fix && leaveNofixLayout) { @@ -113,8 +114,12 @@ function onGPS(fix) { layout.time.label = "Time: "+formatTime(fix.time); layout.sat.label = "Satellites: "+satellites; layout.maidenhead.label = "Maidenhead: "+maidenhead; + layout.dataCounter.label = dataCounter; layout.render(); } else { + layout.clear(layout.dataCounter); + layout.dataCounter.label = dataCounter; + layout.render(layout.dataCounter); if (fix.satelites != lastFix.satelites) { layout.clear(layout.sat); layout.sat.label = fix.satellites; @@ -127,9 +132,6 @@ function onGPS(fix) { layout.progress.label = "in view GP/BD/GL: " + nofGP + " " + nofBD + " " + nofGL; // console.log("in view GP/BD/GL: " + nofGP + " " + nofBD + " " + nofGL); layout.render(layout.progress); - layout.clear(layout.dataCounter); - layout.dataCounter.label = ++dataCounter; - layout.render(layout.dataCounter); } } @@ -157,6 +159,7 @@ Bangle.on('GPS', onGPS); //Bangle.on('GPS-raw', onGPSraw); Bangle.setGPSPower(1, "app"); + function exitApp() { load(); } diff --git a/apps/gpsinfo/metadata.json b/apps/gpsinfo/metadata.json index e426f5740..815cdbf21 100644 --- a/apps/gpsinfo/metadata.json +++ b/apps/gpsinfo/metadata.json @@ -1,7 +1,7 @@ { "id": "gpsinfo", "name": "GPS Info", - "version": "0.11", + "version": "0.12", "description": "An application that displays information about latitude, longitude, altitude, speed, satellites and time", "icon": "gps-info.png", "type": "app", From 2551f02f2f1e4262740c3f006350da72ce14d3b3 Mon Sep 17 00:00:00 2001 From: Marco H Date: Sun, 15 Jan 2023 17:09:09 +0100 Subject: [PATCH 2/2] Only render when no fix --- apps/gpsinfo/gps-info.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/gpsinfo/gps-info.js b/apps/gpsinfo/gps-info.js index 6b83b02c5..bbe043913 100644 --- a/apps/gpsinfo/gps-info.js +++ b/apps/gpsinfo/gps-info.js @@ -114,12 +114,8 @@ function onGPS(fix) { layout.time.label = "Time: "+formatTime(fix.time); layout.sat.label = "Satellites: "+satellites; layout.maidenhead.label = "Maidenhead: "+maidenhead; - layout.dataCounter.label = dataCounter; layout.render(); } else { - layout.clear(layout.dataCounter); - layout.dataCounter.label = dataCounter; - layout.render(layout.dataCounter); if (fix.satelites != lastFix.satelites) { layout.clear(layout.sat); layout.sat.label = fix.satellites; @@ -133,6 +129,9 @@ function onGPS(fix) { // console.log("in view GP/BD/GL: " + nofGP + " " + nofBD + " " + nofGL); layout.render(layout.progress); } + layout.clear(layout.dataCounter); + layout.dataCounter.label = dataCounter; + layout.render(layout.dataCounter); } if (listenerGPSraw == 0 && !fix.fix) {