Merge pull request #316 from Purple-Tentacle/master

Compass 0.02 - show text if uncalibrated
pull/312/head
Gordon Williams 2020-04-17 15:52:11 +01:00 committed by GitHub
commit 745e4d38a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 35 deletions

View File

@ -235,7 +235,7 @@
{ "id": "compass",
"name": "Compass",
"icon": "compass.png",
"version":"0.01",
"version":"0.02",
"description": "Simple compass that points North",
"tags": "tool,outdoors",
"storage": [

2
apps/compass/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: New App!
0.02: Show text if uncalibrated

View File

@ -20,10 +20,19 @@ Bangle.on('mag', function(m) {
if (!Bangle.isLCDOn()) return;
g.setFont("6x8",3);
g.setColor(0);
g.fillRect(70,0,170,24);
g.fillRect(0,0,230,40);
g.setColor(0xffff);
g.setFontAlign(0,0);
g.drawString(isNaN(m.heading)?"---":Math.round(m.heading),120,12);
if (isNaN(m.heading)) {
g.setFontAlign(-1,-1);
g.setFont("6x8",2);
g.drawString("Uncalibrated",50,12);
g.drawString("turn 360° around",25,26);
}
else {
g.setFontAlign(0,0);
g.setFont("6x8",3);
g.drawString(Math.round(m.heading),120,12);
}
g.setColor(0,0,0);
arrow(oldHeading,0);
arrow(oldHeading+180,0);