forked from jappel/VersaMCU
Add lightweight READ_STATUS command to avoid blocking LED updates during polling
CONFIG_READ was being (ab)used by the Windows viewer's Live-Sync feature to poll just the active profile every 1.5s, but the handler sends the full 740-byte config as ~124 blocking chunk packets from inside poll_vendor() -- which runs before updateLEDs() in the same loop iteration (see the loop-order comment at the top of CMainController.cpp). Every poll cycle stalled updateLEDs() long enough that running Pulse/Blink animations visibly stuttered, since their brightness is computed from an absolute millis() timestamp and jumps forward once the stall clears instead of catching up smoothly. Added USB_CMD_READ_STATUS (0x06) / USB_EVT_STATUS (0x86): a single NVM read (no serial I/O) and one 8-byte reply packet with the active profile in Data[1], no chunking. Documented in doc/07_serial_protocol.md alongside why CONFIG_READ is unsuitable for polling. CONFIG_READ stays as-is for actual full-dump use (e.g. "Vom Board laden"). Verified on hardware after flashing via env:versapad_usb: READ_STATUS returns the correct profile in ~well under CONFIG_READ's dump time, Live-Sync no longer visibly disturbs LED animations. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
01c5e0930e
commit
13c3e41c91
3 changed files with 34 additions and 0 deletions
|
|
@ -232,6 +232,18 @@ void CMainController::poll_vendor()
|
|||
usb_serial_send(USB_EVT_PONG, 0);
|
||||
break;
|
||||
|
||||
// Leichtgewichtiger Status (aktuell nur aktives Profil) – ein NVM-Read,
|
||||
// ein 8-Byte-Paket zurück. Für Polling (Live-Sync) statt CONFIG_READ,
|
||||
// das für den Dump ~124 blockierende Pakete braucht und dabei
|
||||
// updateLEDs() so lange verzögert, dass Pulse-Animationen sichtbar stottern.
|
||||
case USB_CMD_READ_STATUS:
|
||||
{
|
||||
SDeviceConfig cfg;
|
||||
nvm_config_load(cfg);
|
||||
usb_serial_send(USB_EVT_STATUS, cfg.active_profile);
|
||||
break;
|
||||
}
|
||||
|
||||
// Config-Übertragung: BEGIN → n×DATA → COMMIT
|
||||
case USB_CMD_CONFIG_BEGIN:
|
||||
// Neuen Empfang starten – bisherige Daten verwerfen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue