weather: Convert Gadgetbridge temperature from Kelvin to Celsius

master
Richard de Boer 2020-04-22 11:00:16 +02:00
parent 6d07882eae
commit c3940972b5
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@
g.setColor(-1); g.setColor(-1);
const temp = locale.temp(w.temp).match(/^(\D*\d*)(.*)$/); const temp = locale.temp(w.temp-273.15).match(/^(\D*\d*)(.*)$/);
let width = g.setFont("Vector", 40).stringWidth(temp[1]); let width = g.setFont("Vector", 40).stringWidth(temp[1]);
width += g.setFont("Vector", 20).stringWidth(temp[2]); width += g.setFont("Vector", 20).stringWidth(temp[2]);
g.setFont("Vector", 40).setFontAlign(-1, -1, 0); g.setFont("Vector", 40).setFontAlign(-1, -1, 0);

View File

@ -8,7 +8,7 @@
require('weather').drawIcon(w.txt, this.x+10, this.y+8, 8); require('weather').drawIcon(w.txt, this.x+10, this.y+8, 8);
} }
if (w.temp) { if (w.temp) {
let t = require('locale').temp(w.temp); // applies conversion let t = require('locale').temp(w.temp-273.15); // applies conversion
t = t.substr(0, t.length-2); // but we have no room for units t = t.substr(0, t.length-2); // but we have no room for units
g.setFontAlign(0, 1); // center horizontally at bottom of widget g.setFontAlign(0, 1); // center horizontally at bottom of widget
g.setFont('6x8', 1); g.setFont('6x8', 1);