commit
b522f51f3f
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,15 +108,28 @@ 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);
|
||||
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();
|
||||
//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 +142,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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue