parent
8412ac52ba
commit
bc33c03312
|
|
@ -9,3 +9,5 @@
|
||||||
0.06: Fix exception
|
0.06: Fix exception
|
||||||
0.07: Ensure barometer gets turned off after a few readings (isBarometerOn broken in 2v16)
|
0.07: Ensure barometer gets turned off after a few readings (isBarometerOn broken in 2v16)
|
||||||
0.08: Compatibility with hideable Widgets
|
0.08: Compatibility with hideable Widgets
|
||||||
|
0.09: Do not immediately measure on start, keep interval
|
||||||
|
Add plot history to settings
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "widbaroalarm",
|
"id": "widbaroalarm",
|
||||||
"name": "Barometer Alarm Widget",
|
"name": "Barometer Alarm Widget",
|
||||||
"shortName": "Barometer Alarm",
|
"shortName": "Barometer Alarm",
|
||||||
"version": "0.08",
|
"version": "0.09",
|
||||||
"description": "A widget that can alarm on when the pressure reaches defined thresholds.",
|
"description": "A widget that can alarm on when the pressure reaches defined thresholds.",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
return x + " min";
|
return x + " min";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Log graph': () => {E.showMenu(); draw();},
|
'Plot history': () => {E.showMenu(); draw();},
|
||||||
};
|
};
|
||||||
E.showMenu(menu);
|
E.showMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,8 +293,18 @@ WIDGETS["baroalarm"] = {
|
||||||
draw : draw
|
draw : draw
|
||||||
};
|
};
|
||||||
|
|
||||||
if (interval > 0) {
|
// delay pressure measurement by interval-lastrun
|
||||||
setInterval(getPressureValue, interval * 60000);
|
const lastRun = history3.length > 0 ? history3[history3.length-1].ts : 0;
|
||||||
|
const lastRunAgo = Math.round(Date.now() / 1000) - lastRun;
|
||||||
|
let diffNextRun = interval*60-lastRunAgo;
|
||||||
|
if (diffNextRun < 0) {
|
||||||
|
diffNextRun = 0; // run asap
|
||||||
}
|
}
|
||||||
getPressureValue();
|
setTimeout(() => {
|
||||||
|
if (interval > 0) {
|
||||||
|
setInterval(getPressureValue, interval * 60000);
|
||||||
|
}
|
||||||
|
getPressureValue();
|
||||||
|
}, diffNextRun*1000);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue