refactor(bot,ui): dedupe bot token parsing, drop redundant turnOn, fix comment

Post-review cleanups, no behaviour change:
- botScanCommands() parsed the command name and its two args with three
  near-identical read-token loops; extracted a single readToken() lambda.
- Fn+Esc lock branch turned the display on twice (the unlock arm repeated
  what the branch head already did); dropped the redundant call.
- setGpioMode()'s comment said "Cycle" (cycling lives in GpioScreen); now
  describes what it actually does — set a specific mode + persist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-25 00:00:07 +02:00
co-authored by Claude Opus 4.8
parent 0a61b7ef15
commit 5844fa2390
2 changed files with 16 additions and 18 deletions
+4 -3
View File
@@ -2146,7 +2146,6 @@ void UITask::pollCardKB() {
if (_locked) {
_lock_wake_until = millis() + 2000;
} else {
if (_display && !_display->isOn()) _display->turnOn();
uint32_t aoff = autoOffMillis();
if (aoff > 0) _auto_off = millis() + aoff;
}
@@ -3159,8 +3158,10 @@ static uint16_t readAnalogMv(uint32_t psel) {
}
#endif
// Cycle a user GPIO pin's mode (Off/In/Out-low/Out-high), apply it to the
// actual pin, and persist. Called by GpioScreen on Enter.
// Set a user GPIO pin to a specific mode (0=Off 1=In 2=Out-low 3=Out-high
// 4=Analog), apply it to the actual pin, and persist. The Off->In->Out->...
// cycling itself lives in GpioScreen; the bot's !gpioN on/off and boot
// restore also route through here.
void UITask::setGpioMode(int idx, uint8_t mode) {
#if defined(PIN_GPIO1)
if (!_node_prefs) return;