forked from FOSS/BangleApps
widbaroalarm: Compatibility with hideable Widgets
parent
4777d98c10
commit
7e28e75295
|
@ -8,3 +8,4 @@
|
|||
Only use valid pressure values
|
||||
0.06: Fix exception
|
||||
0.07: Ensure barometer gets turned off after a few readings (isBarometerOn broken in 2v16)
|
||||
0.08: Compatibility with hideable Widgets
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "widbaroalarm",
|
||||
"name": "Barometer Alarm Widget",
|
||||
"shortName": "Barometer Alarm",
|
||||
"version": "0.07",
|
||||
"version": "0.08",
|
||||
"description": "A widget that can alarm on when the pressure reaches defined thresholds.",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -226,7 +226,7 @@ function barometerPressureHandler(e) {
|
|||
medianPressure = Math.round(E.sum(median.slice(mid - 4, mid + 5)) / 9);
|
||||
if (medianPressure > 0) {
|
||||
turnOff();
|
||||
draw();
|
||||
WIDGETS.baroalarm.draw();
|
||||
handlePressureValue(medianPressure);
|
||||
}
|
||||
}
|
||||
|
@ -253,13 +253,6 @@ function turnOff() {
|
|||
}
|
||||
|
||||
function draw() {
|
||||
if (global.WIDGETS != undefined && typeof global.WIDGETS === "object") {
|
||||
global.WIDGETS["baroalarm"] = {
|
||||
width : setting("show") ? 24 : 0,
|
||||
area : "tr",
|
||||
draw : draw
|
||||
};
|
||||
}
|
||||
g.reset();
|
||||
|
||||
if (this.x == undefined || this.y != 0)
|
||||
|
@ -270,9 +263,6 @@ function draw() {
|
|||
if (setting("show")) {
|
||||
g.setFont("6x8", 1).setFontAlign(1, 0);
|
||||
if (medianPressure == undefined) {
|
||||
// trigger a new check
|
||||
getPressureValue();
|
||||
|
||||
// lets load last value from log (if available)
|
||||
if (history3.length > 0) {
|
||||
medianPressure = history3[history3.length - 1]["p"];
|
||||
|
@ -297,6 +287,12 @@ function draw() {
|
|||
}
|
||||
}
|
||||
|
||||
WIDGETS["baroalarm"] = {
|
||||
width : setting("show") ? 24 : 0,
|
||||
area : "tr",
|
||||
draw : draw
|
||||
};
|
||||
|
||||
if (interval > 0) {
|
||||
setInterval(getPressureValue, interval * 60000);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue