Merge pull request #3840 from bobrippling/feat/clkinfo-ble

clock_info: add BLE icon
master
thyttan 2025-06-04 00:33:05 +02:00 committed by GitHub
commit 122a8c592f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 1 deletions

View File

@ -14,3 +14,4 @@
0.13: Cache loaded ClockInfos so if we have clockInfoWidget and a clock, we don't load them twice (saves ~300ms)
0.14: Check for .clkinfocache and use that if exists (from boot 0.64)
0.15: Fix error when displaying a category with only one clockinfo (fix #3728)
0.16: Add BLE clkinfo entry

View File

@ -118,6 +118,30 @@ exports.load = function() {
}
hrm = 0;
},
},
{ name: "BLE",
hasRange: false,
isOn: () => {
const s = NRF.getSecurityStatus();
return s.advertising || s.connected;
},
get: function() {
return {
text: this.isOn() ? "On" : "Off",
img: atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA==")
};
},
run: function() {
if (this.isOn()) {
NRF.sleep();
} else {
NRF.wake();
Bluetooth.setConsole(1);
}
setTimeout(() => this.emit("redraw"), 250);
},
show: function(){},
hide: function(){},
}
],
}];

View File

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