From 72b00e1829c5fc0b2d2c4d3775a99ec6854497d9 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 18 Mar 2026 13:09:58 +0100 Subject: [PATCH] Review comments --- src/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a9710f7c..75bf69c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -347,11 +347,6 @@ void loop() { powerManager.setPowerSaving(false); // Restore normal CPU frequency on user activity } - // Refresh the battery icon immediately when USB is plugged or unplugged - if (gpio.wasUsbStateChanged()) { - activityManager.requestUpdate(); - } - static bool screenshotButtonsReleased = true; if (gpio.isPressed(HalGPIO::BTN_POWER) && gpio.isPressed(HalGPIO::BTN_DOWN)) { if (screenshotButtonsReleased) { @@ -384,6 +379,12 @@ void loop() { return; } + // Refresh the battery icon when USB is plugged or unplugged. + // Placed after sleep guards so we never queue a render that won't be processed. + if (gpio.wasUsbStateChanged()) { + activityManager.requestUpdate(); + } + const unsigned long activityStartTime = millis(); activityManager.loop(); const unsigned long activityDuration = millis() - activityStartTime;