From 944b6b8f14c56310cf912abea9e4148cd2119a9c Mon Sep 17 00:00:00 2001 From: Matthias Blankertz Date: Tue, 23 Dec 2025 17:10:59 +0100 Subject: [PATCH] fix: allow 'reboot' to application when on on battery Having to press the power button again to wake up the device is less annoying to the user than not being able to apply settings when the device is on battery. Signed-off-by: Matthias Blankertz --- software/frontend/index.html | 6 ++++-- software/src/webserver.py | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/software/frontend/index.html b/software/frontend/index.html index 859c932..3b590a9 100644 --- a/software/frontend/index.html +++ b/software/frontend/index.html @@ -167,7 +167,7 @@

Configuration Editor

Loading…
- +
@@ -316,7 +316,9 @@ return; } - alert("Configuration saved successfully!"); + alert("Configuration saved successfully, device will now reboot/shutdown! " + + "On battery, press Power button after shutdown to restart."); + await fetch('/api/v1/reboot/application', {'method': 'POST'}); } catch (err) { alert("Error saving configuration: " + err); } diff --git a/software/src/webserver.py b/software/src/webserver.py index f87f467..3f26514 100644 --- a/software/src/webserver.py +++ b/software/src/webserver.py @@ -269,10 +269,9 @@ async def audiofile_delete(request): @webapp.route('/api/v1/reboot/', methods=['POST']) async def reboot(request, method): - if hwconfig.get_on_battery(): - return 'not allowed: usb not connected', 403 - if method == 'bootloader': + if hwconfig.get_on_battery(): + return 'not possible: connect USB first', 403 leds.set_state(LedManager.REBOOTING) timer_manager.schedule(time.ticks_ms() + 1500, machine.bootloader) elif method == 'application':