mirror of https://github.com/espruino/BangleApps
fix weather lib and remove prints
parent
d2faecf9ab
commit
5518c4848d
|
@ -160,7 +160,6 @@ E.on('notify',msg=>{
|
||||||
};
|
};
|
||||||
var replacer = ""; //(n)=>print('Unknown unicode '+n.toString(16));
|
var replacer = ""; //(n)=>print('Unknown unicode '+n.toString(16));
|
||||||
//if (appNames[msg.appId]) msg.a
|
//if (appNames[msg.appId]) msg.a
|
||||||
Terminal.println("'" + msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer) + "'");
|
|
||||||
if (msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer) === "BangleDumpCalendar") {
|
if (msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer) === "BangleDumpCalendar") {
|
||||||
// parse the message body into json:
|
// parse the message body into json:
|
||||||
const d = JSON.parse(msg.message);
|
const d = JSON.parse(msg.message);
|
||||||
|
@ -205,6 +204,7 @@ E.on('notify',msg=>{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer) === "BangleDumpWeather") {
|
if (msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer) === "BangleDumpWeather") {
|
||||||
|
Terminal.println("Weather");
|
||||||
const d = JSON.parse(msg.message);
|
const d = JSON.parse(msg.message);
|
||||||
/* Example:
|
/* Example:
|
||||||
{"temp":"291.07","hi":"293.02","lo":"288.18","hum":"49","rain":"0","uv":"0","wind":"1.54","code":"01d","txt":"Mostly Sunny","wdir":"303","loc":"Berlin"}
|
{"temp":"291.07","hi":"293.02","lo":"288.18","hum":"49","rain":"0","uv":"0","wind":"1.54","code":"01d","txt":"Mostly Sunny","wdir":"303","loc":"Berlin"}
|
||||||
|
@ -226,7 +226,6 @@ E.on('notify',msg=>{
|
||||||
loc: d.loc
|
loc: d.loc
|
||||||
}
|
}
|
||||||
require("weather").update(weatherEvent);
|
require("weather").update(weatherEvent);
|
||||||
Terminal.println("received weather data");
|
|
||||||
NRF.ancsAction(msg.uid, false);
|
NRF.ancsAction(msg.uid, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,12 @@ function update(weatherEvent) {
|
||||||
delete json.weather;
|
delete json.weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
storage.write('weather.json', json);
|
storage.write('weather.json', json);
|
||||||
scheduleExpiry(json);
|
scheduleExpiry(json);
|
||||||
exports.emit("update", json.weather);
|
exports.emit("update", json.weather);
|
||||||
}
|
}
|
||||||
|
exports.update = update;
|
||||||
const _GB = global.GB;
|
const _GB = global.GB;
|
||||||
global.GB = (event) => {
|
global.GB = (event) => {
|
||||||
if (event.t==="weather") update(event);
|
if (event.t==="weather") update(event);
|
||||||
|
|
Loading…
Reference in New Issue