Further improvements
parent
4dba48f0ac
commit
da9261446f
|
|
@ -49,9 +49,11 @@
|
||||||
saveSetting(key, tsNow);
|
saveSetting(key, tsNow);
|
||||||
}
|
}
|
||||||
if (v == 2) {
|
if (v == 2) {
|
||||||
|
// save timestamp of the future so that we do not warn again for the same event until then
|
||||||
saveSetting(key, tsNow + 60 * setting('dismissDelayMin'));
|
saveSetting(key, tsNow + 60 * setting('dismissDelayMin'));
|
||||||
}
|
}
|
||||||
if (v == 3) {
|
if (v == 3) {
|
||||||
|
// save timestamp of the future so that we do not warn again for the same event until then
|
||||||
saveSetting(key, tsNow + 60 * setting('pauseDelayMin'));
|
saveSetting(key, tsNow + 60 * setting('pauseDelayMin'));
|
||||||
}
|
}
|
||||||
load();
|
load();
|
||||||
|
|
@ -196,8 +198,8 @@
|
||||||
var mid = median.length >> 1;
|
var mid = median.length >> 1;
|
||||||
medianPressure = Math.round(E.sum(median.slice(mid - 4, mid + 5)) / 9);
|
medianPressure = Math.round(E.sum(median.slice(mid - 4, mid + 5)) / 9);
|
||||||
if (medianPressure > 0) {
|
if (medianPressure > 0) {
|
||||||
turnOff();
|
turnOff();
|
||||||
checkForAlarms(medianPressure);
|
checkForAlarms(medianPressure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -208,7 +210,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function turnOff() {
|
function turnOff() {
|
||||||
Bangle.setBarometerPower(false, "widbaroalarm");
|
if (Bangle.isBarometerOn())
|
||||||
|
Bangle.setBarometerPower(false, "widbaroalarm");
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
|
|
@ -228,15 +231,16 @@
|
||||||
if (setting("show")) {
|
if (setting("show")) {
|
||||||
g.setFont("6x8", 1).setFontAlign(1, 0);
|
g.setFont("6x8", 1).setFontAlign(1, 0);
|
||||||
if (medianPressure == undefined) {
|
if (medianPressure == undefined) {
|
||||||
check();
|
check();
|
||||||
const x = this.x, y = this.y;
|
const x = this.x,
|
||||||
g.drawString("...", x + 24, y + 6);
|
y = this.y;
|
||||||
setTimeout(function() {
|
g.drawString("...", x + 24, y + 6);
|
||||||
g.setFont("6x8", 1).setFontAlign(1, 0);
|
setTimeout(function() {
|
||||||
g.drawString(Math.round(medianPressure), x + 24, y + 6);
|
g.setFont("6x8", 1).setFontAlign(1, 0);
|
||||||
}, 10000);
|
g.drawString(Math.round(medianPressure), x + 24, y + 6);
|
||||||
|
}, 10000);
|
||||||
} else {
|
} else {
|
||||||
g.drawString(Math.round(medianPressure), this.x + 24, this.y + 6);
|
g.drawString(Math.round(medianPressure), this.x + 24, this.y + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threeHourAvrPressure != undefined && threeHourAvrPressure > 0) {
|
if (threeHourAvrPressure != undefined && threeHourAvrPressure > 0) {
|
||||||
|
|
@ -245,7 +249,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check();
|
|
||||||
if (interval > 0) {
|
if (interval > 0) {
|
||||||
setInterval(check, interval * 60000);
|
setInterval(check, interval * 60000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue