From 15c7467985b1c6cb2ac519d4909ae18686c8b709 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sun, 17 Aug 2025 20:32:18 +0100 Subject: [PATCH] chargerot: attempt `Bangle.uiRedraw()` if possible (optimisation) --- apps/chargerot/ChangeLog | 1 + apps/chargerot/boot.js | 7 ++++++- apps/chargerot/metadata.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/chargerot/ChangeLog b/apps/chargerot/ChangeLog index 07029aebd..f720ec147 100644 --- a/apps/chargerot/ChangeLog +++ b/apps/chargerot/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Handle missing settings (e.g. first-install) +0.03: Use Bangle.uiRedraw() if available as an optimisation diff --git a/apps/chargerot/boot.js b/apps/chargerot/boot.js index 2daeb3d50..8ec8c75c2 100644 --- a/apps/chargerot/boot.js +++ b/apps/chargerot/boot.js @@ -5,9 +5,14 @@ Bangle.on('charging', (charging) => { if (charging) { g.setRotation(chargingRotation&3,chargingRotation>>2).clear(); - Bangle.showClock(); } else { g.setRotation(defaultRotation&3,defaultRotation>>2).clear(); + } + + if (Bangle.uiRedraw) { + Bangle.uiRedraw(); + Bangle.drawWidgets(); + } else { Bangle.showClock(); } }); diff --git a/apps/chargerot/metadata.json b/apps/chargerot/metadata.json index 8174836be..98cd9683d 100644 --- a/apps/chargerot/metadata.json +++ b/apps/chargerot/metadata.json @@ -1,7 +1,7 @@ { "id": "chargerot", "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.", "icon": "icon.png", "tags": "battery",