chargerot: attempt `Bangle.uiRedraw()` if possible (optimisation)

master
Rob Pilling 2025-08-17 20:32:18 +01:00 committed by Bryan
parent 49cf18bde5
commit 15c7467985
3 changed files with 8 additions and 2 deletions

View File

@ -1,2 +1,3 @@
0.01: New App! 0.01: New App!
0.02: Handle missing settings (e.g. first-install) 0.02: Handle missing settings (e.g. first-install)
0.03: Use Bangle.uiRedraw() if available as an optimisation

View File

@ -5,9 +5,14 @@
Bangle.on('charging', (charging) => { Bangle.on('charging', (charging) => {
if (charging) { if (charging) {
g.setRotation(chargingRotation&3,chargingRotation>>2).clear(); g.setRotation(chargingRotation&3,chargingRotation>>2).clear();
Bangle.showClock();
} else { } else {
g.setRotation(defaultRotation&3,defaultRotation>>2).clear(); g.setRotation(defaultRotation&3,defaultRotation>>2).clear();
}
if (Bangle.uiRedraw) {
Bangle.uiRedraw();
Bangle.drawWidgets();
} else {
Bangle.showClock(); Bangle.showClock();
} }
}); });

View File

@ -1,7 +1,7 @@
{ {
"id": "chargerot", "id": "chargerot",
"name": "Charge LCD rotation", "name": "Charge LCD rotation",
"version": "0.02", "version": "0.03",
"description": "When charging, this app can rotate your screen and revert it when unplugged. Made for all sort of cradles.", "description": "When charging, this app can rotate your screen and revert it when unplugged. Made for all sort of cradles.",
"icon": "icon.png", "icon": "icon.png",
"tags": "battery", "tags": "battery",