1
0
Fork 0

Adding current weather to lcars

master
Jon Warrington 2022-01-10 11:31:37 -07:00
parent 1d793a037f
commit 0f2a58ddde
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,6 @@
const SETTINGS_FILE = "lcars.setting.json";
const Storage = require("Storage");
const weather = require('weather');
// ...and overwrite them with any saved values
@ -145,6 +146,14 @@ function printData(key, y, c){
text = "VREF";
value = E.getAnalogVRef().toFixed(2) + "V";
} else if (key == "Weather"){
text = "TEMP";
const w = weather.get();
if (!w) {
value = "ERR";
} else {
value = require('locale').temp(w.temp-273.15); // applies conversion
}
}
g.setColor(c);

View File

@ -18,7 +18,7 @@
storage.write(SETTINGS_FILE, settings)
}
var data_options = ["Battery", "Steps", "Temp.", "HRM", "VREF"];
var data_options = ["Battery", "Steps", "Temp.", "HRM", "VREF", "Weather"];
E.showMenu({
'': { 'title': 'LCARS Clock' },