Improve widget drawing code & fix some typos

master
Marco H 2022-06-12 11:24:29 +02:00
parent d77bddbbed
commit b5f3930c41
3 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,5 @@
0.01: Initial version
0.02: Do not warn multiple times for the same exceedance
0.02: Do not warn multiple times for the same exceed
0.03: Fix crash
0.04: Use Prompt with dismiss and pause
Improve barometer value median calculation

View File

@ -16,10 +16,10 @@ Get a notification when the pressure reaches defined thresholds.
* Show widget: Enable/disable widget visibility
* Buzz on alarm: Enable/disable buzzer on alarm
* Dismiss delay: Delay added before the next alert if the alert is dismissed. From 5 to 60 min
* Pause delay: Same as Dismiss delay but longer (usefull for meetings and such). From 30 to 240 min
* Pause delay: Same as Dismiss delay but longer (useful for meetings and such). From 30 to 240 min
## Widget
The widget shows the last median pressure value
The widget shows two rows: pressure value of last measurement and pressure average of the the last three hours.
## Creator
Marco ([myxor](https://github.com/myxor))

View File

@ -227,11 +227,24 @@
draw: draw
};
}
g.reset();
if (setting("show") && medianPressure != undefined) {
if (setting("show")) {
g.setFont("6x8", 1).setFontAlign(1, 0);
g.drawString(Math.round(medianPressure), this.x + 24, this.y + 6);
if (medianPressure == undefined) {
check();
const x = this.x, y = this.y;
g.drawString("...", x + 24, y + 6);
setTimeout(function() {
g.setFont("6x8", 1).setFontAlign(1, 0);
g.drawString(Math.round(medianPressure), x + 24, y + 6);
}, 10000);
} else {
g.drawString(Math.round(medianPressure), this.x + 24, this.y + 6);
}
if (threeHourAvrPressure != undefined && threeHourAvrPressure > 0) {
g.drawString(Math.round(threeHourAvrPressure), this.x + 24, this.y + 6 + 10);
}
}
}