fix: allow 'reboot' to application when on on battery
Some checks failed
Build RPi Pico firmware image / Build-Firmware (push) Successful in 4m38s
Check code formatting / Check-C-Format (push) Successful in 8s
Check code formatting / Check-Python-Flake8 (push) Successful in 10s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Run pytests / Check-Pytest (push) Failing after 11s

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 <matthias@blankertz.org>
This commit is contained in:
2025-12-23 17:10:59 +01:00
parent f44e93f25e
commit 944b6b8f14
2 changed files with 6 additions and 5 deletions

View File

@@ -167,7 +167,7 @@
<div id="screen-config" class="screen"> <div id="screen-config" class="screen">
<h2>Configuration Editor</h2> <h2>Configuration Editor</h2>
<div id="config-container">Loading…</div> <div id="config-container">Loading…</div>
<button id="config-save-btn" disabled>Save</button> <button id="config-save-btn" disabled>Save &amp; Reboot</button>
</div> </div>
<!-- PLAYLIST EDITOR SCREEN 1: list of playlists --> <!-- PLAYLIST EDITOR SCREEN 1: list of playlists -->
@@ -316,7 +316,9 @@
return; 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) { } catch (err) {
alert("Error saving configuration: " + err); alert("Error saving configuration: " + err);
} }

View File

@@ -269,10 +269,9 @@ async def audiofile_delete(request):
@webapp.route('/api/v1/reboot/<method>', methods=['POST']) @webapp.route('/api/v1/reboot/<method>', methods=['POST'])
async def reboot(request, method): async def reboot(request, method):
if hwconfig.get_on_battery():
return 'not allowed: usb not connected', 403
if method == 'bootloader': if method == 'bootloader':
if hwconfig.get_on_battery():
return 'not possible: connect USB first', 403
leds.set_state(LedManager.REBOOTING) leds.set_state(LedManager.REBOOTING)
timer_manager.schedule(time.ticks_ms() + 1500, machine.bootloader) timer_manager.schedule(time.ticks_ms() + 1500, machine.bootloader)
elif method == 'application': elif method == 'application':