Merge pull request #2438 from myxor/gpsinfo

GPSInfo: Show number of packets received
pull/2448/head^2
Gordon Williams 2023-01-05 10:21:09 +00:00 committed by GitHub
commit 5409e4907f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -7,3 +7,4 @@
0.08: Leave GPS power switched on on exit (will switch off after 0.5 seconds anyway)
0.09: Fix FIFO_FULL error
0.10: Show satellites "in view" separated by GNS-system
0.11: Show number of packets received

View File

@ -5,7 +5,7 @@ function satelliteImage() {
var Layout = require("Layout");
var layout;
//Bangle.setGPSPower(1, "app");
E.showMessage(/*LANG*/"Loading..."); // avoid showing rubbish on screen
E.showMessage(/*LANG*/"Waiting for GNS data..."); // avoid showing rubbish on screen
var lastFix = {
fix: -1,
@ -19,6 +19,7 @@ var lastFix = {
var SATinView = 0, lastSATinView = -1, nofGP = 0, nofBD = 0, nofGL = 0;
const leaveNofixLayout = 1; // 0 = stay on initial screen for debugging (default = 1)
var listenerGPSraw = 0;
var dataCounter = 0;
function formatTime(now) {
if (now == undefined) {
@ -80,11 +81,15 @@ function onGPS(fix) {
type:"v", c: [
{type:"txt", font:"6x8:2", label:"GPS Info" },
{type:"img", src:satelliteImage, pad:4 },
{type:"txt", font:"6x8", label:"Waiting for GPS" },
{type:"txt", font:"6x8", label:"Waiting for GPS fix" },
{type:"h", c: [
{type:"txt", font:"10%", label:fix.satellites, pad:2, id:"sat" },
{type:"txt", font:"6x8", pad:3, label:"Satellites used" }
]},
{type:"h", c: [
{type:"txt", font:"10%", label:dataCounter, pad:2, id:"dataCounter" },
{type:"txt", font:"6x8", pad:3, label:"packets received" }
]},
{type:"txt", font:"6x8", label:"", fillx:true, id:"progress" }
]},{lazy:false});
}
@ -122,6 +127,9 @@ 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);
}
}

View File

@ -1,11 +1,11 @@
{
"id": "gpsinfo",
"name": "GPS Info",
"version": "0.10",
"description": "An application that displays information about altitude, lat/lon, satellites and time",
"version": "0.11",
"description": "An application that displays information about latitude, longitude, altitude, speed, satellites and time",
"icon": "gps-info.png",
"type": "app",
"tags": "gps,outdoors",
"tags": "gps,outdoors,tools",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"gpsinfo.app.js","url":"gps-info.js"},