clock_info 0.19: Fix Altitude ClockInfo after BLE added

Make this kind of bug less likely to happen in future by searching for the correct clockinfo
master
Gordon Williams 2025-07-21 10:36:52 +01:00
parent 1fae42ff84
commit a5e3330f7d
3 changed files with 8 additions and 6 deletions

View File

@ -17,3 +17,4 @@
0.16: Add BLE clkinfo entry
0.17: Fix BLE icon alignment and border on some clocks
0.18: Tweak BLE icon to add gap and ensure middle of B isn't filled
0.19: Fix Altitude ClockInfo after BLE added

View File

@ -39,22 +39,23 @@ exports.load = function() {
var hrm = 0;
var alt = "--";
// callbacks (needed for easy removal of listeners)
function batteryUpdateHandler() { bangleItems[0].emit("redraw"); }
function stepUpdateHandler() { bangleItems[1].emit("redraw"); }
function batteryUpdateHandler() { bangleItems.find(i=>i.name=="Battery").emit("redraw"); }
function stepUpdateHandler() { bangleItems.find(i=>i.name=="Steps").emit("redraw"); }
function hrmUpdateHandler(e) {
if (e && e.confidence>60) hrm = Math.round(e.bpm);
bangleItems[2].emit("redraw");
bangleItems.find(i=>i.name=="HRM").emit("redraw");
}
function altUpdateHandler() {
try {
Bangle.getPressure().then(data=>{
if (!data) return;
alt = Math.round(data.altitude) + "m";
bangleItems[3].emit("redraw");
bangleItems.find(i=>i.name=="Altitude").emit("redraw");
});
} catch (e) {
print("Caught "+e+"\n in function altUpdateHandler in module clock_info");
bangleItems[3].emit('redraw');}
bangleItems.find(i=>i.name=="Altitude").emit('redraw');
}
}
// actual menu
var menu = [{

View File

@ -1,7 +1,7 @@
{ "id": "clock_info",
"name": "Clock Info Module",
"shortName": "Clock Info",
"version":"0.18",
"version":"0.19",
"description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)",
"icon": "app.png",
"type": "module",