Answer sweep-thread commands at once while a keypad is open

Remote editing of a file name with tinySA-App became very slow after a
character or two, and the shell could end up not reading any input.
CMD_WAIT_MUTEX commands are run by the sweep thread, but while a keypad
is open that thread stays in ui_process_keypad() and never picks them
up, so the shell waited 4 x 5 s for each before "Command timeout". The
app polls vbat every 6 s outside live remote control, and every touch
queued behind those waits; local editing was not affected.

ui_process_keypad() now sets keypad_open while it waits for input, and
VNAShell_executeLine() answers a CMD_WAIT_MUTEX command with "keypad
active" instead of waiting, like "usb disk mode active". touch, release,
text, refresh, version and capture (CMD_RUN_IN_UI) run as before.

Tested on HW V0.4.5.1: with a keypad open vbat, pause and sweep answer
in 1 ms, capture rle and remote typing work, and after closing vbat and
sweep answer normally. tinySA-App clicking the screen without live
remote control (vbat polls every 6 s) typed all 8 characters, each poll
answered within 3 ms; before, the first poll stalled the rest.
Flash: ULTRA +44 bytes, BASIC +52.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
copilot/add-multi-platform-rf-scan-exports
erikkaashoek 2 weeks ago
parent 83aeea8ce7
commit 4bfb7558dc

@ -962,6 +962,7 @@ VNA_SHELL_FUNCTION(cmd_menu)
}
uint8_t remote_text = false;
uint8_t keypad_open = false; // set by ui.c while the sweep thread waits for keypad input
VNA_SHELL_FUNCTION(cmd_text)
{
if (argc!= 1)
@ -3212,6 +3213,11 @@ static void VNAShell_executeLine(char *line)
return;
}
#endif
// The sweep thread stays in an open keypad until it closes: answer at once instead of a 20 s timeout
if ((cmd_flag & CMD_WAIT_MUTEX) && keypad_open) {
shell_printf("keypad active" VNA_SHELL_NEWLINE_STR VNA_SHELL_PROMPT_STR);
return;
}
if (cmd_flag & CMD_WAIT_MUTEX) {
chSysLock();
shell_function = scp->sc_function;

@ -8106,6 +8106,7 @@ keypad_apply_touch(void)
extern uint8_t in_menu_command;
extern uint8_t remote_text;
extern uint8_t keypad_open;
static void
ui_process_keypad(void)
@ -8127,6 +8128,7 @@ ui_process_keypad(void)
else
draw_numeric_input(kp_buf);
}
keypad_open = true; // shell commands for the sweep thread are refused now
while (TRUE) {
status = btn_check();
if (status & (EVT_UP|EVT_DOWN)) {
@ -8160,6 +8162,7 @@ ui_process_keypad(void)
break;
}
}
keypad_open = false;
kp_help_text = NULL;
redraw_frame();
if (current_menu_is_form()) {

Loading…
Cancel
Save

Powered by TurnKey Linux.