Speedo app: Allow widgets

This allows e.g. GPS Recorder to work in the background while running Speedo
master
Erik Andresen 2020-05-07 07:23:20 +02:00
parent 51bf1d4ae4
commit 3dcd5820fc
2 changed files with 4 additions and 2 deletions

View File

@ -286,7 +286,7 @@
{ "id": "speedo", { "id": "speedo",
"name": "Speedo", "name": "Speedo",
"icon": "speedo.png", "icon": "speedo.png",
"version":"0.01", "version":"0.02",
"description": "Show the current speed according to the GPS", "description": "Show the current speed according to the GPS",
"tags": "tool,outdoors,gps", "tags": "tool,outdoors,gps",
"storage": [ "storage": [

View File

@ -1,12 +1,14 @@
Bangle.loadWidgets();
Bangle.setGPSPower(1); Bangle.setGPSPower(1);
Bangle.setLCDMode("doublebuffered"); Bangle.setLCDMode("doublebuffered");
var lastFix = {fix:0,satellites:0}; var lastFix = {fix:0,satellites:0};
function onGPS(fix) { function onGPS(fix) {
lastFix = fix; lastFix = fix;
g.clear(); g.clear();
Bangle.drawWidgets();
g.setFontAlign(0,0); g.setFontAlign(0,0);
g.setFont("6x8"); g.setFont("6x8");
g.drawString(fix.satellites+" satellites",120,6); g.drawString(fix.satellites+" satellites",120,36);
if (fix.fix) { if (fix.fix) {
var txt = (fix.speed<20) ? fix.speed.toFixed(1) : Math.round(fix.speed); var txt = (fix.speed<20) ? fix.speed.toFixed(1) : Math.round(fix.speed);
var s = 80; var s = 80;