sixths: save night pressure to watch trend.

master
Pavel Machek 2024-08-14 22:29:26 +02:00
parent 08870ec31a
commit a27f40c9f6
1 changed files with 8 additions and 3 deletions

View File

@ -28,13 +28,13 @@ let fmt = {
fmtTemp: function(c) { return c.toFixed(1) + this.icon_c; }, fmtTemp: function(c) { return c.toFixed(1) + this.icon_c; },
fmtPress: function(p) { fmtPress: function(p) {
if (p < 900 || p > 1100) if (p < 900 || p > 1100)
return p.toFixed(1) + this.icon_hpa; return p.toFixed(0) + this.icon_hpa;
if (p < 1000) { if (p < 1000) {
p -= 900; p -= 900;
return this.icon_9 + p.toFixed(1) + this.icon_hpa; return this.icon_9 + p.toFixed(0) + this.icon_hpa;
} }
p -= 1000; p -= 1000;
return this.icon_10 + p.toFixed(1) + this.icon_hpa; return this.icon_10 + p.toFixed(0) + this.icon_hpa;
}, },
draw_dot : 1, draw_dot : 1,
add0: function(i) { add0: function(i) {
@ -228,6 +228,7 @@ var is_level = false;
// For altitude handling. // For altitude handling.
var cur_altitude = 0; var cur_altitude = 0;
var cur_temperature = 0; var cur_temperature = 0;
var night_pressure = 0;
function toMorse(x) { function toMorse(x) {
let r = ""; let r = "";
@ -771,6 +772,10 @@ function draw() {
let o = Bangle.getOptions(); let o = Bangle.getOptions();
let pr = o.seaLevelPressure; let pr = o.seaLevelPressure;
if (now.hour < 6)
night_pressure = pr;
if (night_pressure)
msg += (pr-night_pressure).toFixed(1) + fmt.icon_hpa + " ";
if (pr) if (pr)
msg += fmt.fmtPress(pr) + "\n"; msg += fmt.fmtPress(pr) + "\n";
} }