Update widalt.wid.js

master
xxDUxx 2022-08-02 16:24:44 +02:00 committed by GitHub
parent 5023dc09d9
commit 3832eaa6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -5,9 +5,9 @@
function readAltitude() { function readAltitude() {
try {Bangle.getPressure().then((p)=>{ try {Bangle.getPressure().then((p)=>{
print("pressure read, altitude "+p.altitude.toFixed(0)); //print("pressure read, altitude "+p.altitude.toFixed(0));
if (Math.floor(p.altitude)!=lastAlt) { if (Math.floor(p.altitude)!=lastAlt) {
print("altitude changed!"); //print("altitude changed!");
lastAlt=Math.floor(p.altitude); lastAlt=Math.floor(p.altitude);
alt=p.altitude.toFixed(0); alt=p.altitude.toFixed(0);
var w = WIDGETS["widalt"].width; var w = WIDGETS["widalt"].width;
@ -18,7 +18,7 @@
} }
});} });}
catch(err) { catch(err) {
print("ERROR"); //print("ERROR");
setTimeout(readAltitude,1000); setTimeout(readAltitude,1000);
} }
} }
@ -29,7 +29,7 @@
//if (Date().getTime()-lastDraw<6000) return;//!!!!! //if (Date().getTime()-lastDraw<6000) return;//!!!!!
if (!Bangle.isLCDOn()) return; if (!Bangle.isLCDOn()) return;
//lastDraw=Date().getTime(); //lastDraw=Date().getTime();
print("drawing"); //print("drawing");
g.reset(); g.reset();
g.setColor(g.theme.bg); g.setColor(g.theme.bg);
g.fillRect(this.x, this.y, this.x + this.width, this.y + 23); g.fillRect(this.x, this.y, this.x + this.width, this.y + 23);