Repository navigation
Built-in Safe Mode page, retry of refused web requests, serial first-command fix - #9
Merged
Merged
Conversation
In Safe Mode, / (and /index.html, /ccu) answered 404 or 503 when the SD card was missing or failing or safemode.html was not on it, so the page with the exit button was out of reach. v3.8 announced a built-in page, but SafeMode::printFallbackPage() was never called. - SdUtils::serveFile(): optional 'unreadable' out-parameter. When given, a file that cannot be read (missing, SD not available, read failure before anything was sent) is not answered and the caller answers instead. Other callers are unchanged; a busy 503 stays. - WebServer::serveSafeModePage(): safemode.html, or the built-in page from flash (200, text/html, Cache-Control: no-store). - The built-in page: what Safe Mode turns off, reason, last reset, failed boots (only after boot failures), uptime, firmware version, the Restart in normal mode button (POST /safemode-exit with X-TallyCCU, then the main page; clear messages for 404 when the board already left Safe Mode and for no answer while it restarts) and normalboot. - Scenario 'sm' (fast set): file missing, file back, SD failing (also after a remount), normal mode still 503, exit request, script syntax (node --check) and exact restart count. It fails on 3.8.1 (404/503). - README: Safe Mode section, Unreleased changelog, v3.8 line corrected; v3.8 release notes file corrected (not republished). Flash +2.1 KB, static RAM unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWAWkD3MqtdyPvo7NYXQ6D
With nearly every W5500 socket in use (vMix, Companion, two pages with the stream, a page reloading), port 80 is left with one socket. While it closes the previous request there is no listener for a moment and the next connection is refused (RST to the SYN): the request never reaches TallyCCU and sendCcu() got no answer. Reset to Defaults then stopped at that value and the rest were never sent (shown unknown), and Load or Save preset failed. Reproduced in the emulator with that socket load: the first Reset stopped at 10 of 16. - sendCcu() opts.retry: a fetch that fails within 2.5 s (Windows itself retries a refused connection for 1-2 s) is tried again after 50, 150 and 400 ms, within the same timeout. Only for idempotent requests: parameter writes (absolute values), getJson reads, load and save preset. Not for actions, motion, toggles or reboot. - Reset names the value it stopped at and how many were not sent; errors of Reset and Load stay on screen for 8 s (2-2.5 s before). Same topology with this page: 6 of 6 Reset and 6 of 6 Load complete. No firmware or protocol change: Companion is not affected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWAWkD3MqtdyPvo7NYXQ6D
Since v3.8 the serial configurator opens the port without restarting
the board. Opening the USB port can deliver a garbage byte (0x00, 0xFF)
to the running sketch; it was glued to the first command ("\xffstatus":
unknown command; a 0x00 cut it to an empty line, ignored silently), so
Get Config did nothing until another command consumed it.
- Configurator: a newline before each command ends any partial line.
Every firmware version ignores an empty line, so this also fixes it
with the v3.8 and v3.8.1 firmware.
- Firmware: control bytes other than CR, LF and tab, and bytes from
0x7F up, are dropped from the serial console.
- Scenario 'ser' (fast set): 0x00, 0xFF, 0xF0 and a CRLF-ended garbage
byte before 'status', and the configurator's leading newline.
- README changelog (Unreleased): this and the web retry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TWAWkD3MqtdyPvo7NYXQ6D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes for the next version. No release:
FIRMWARE_VERSIONstays 3.8.1 and the README changelog lists them under Unreleased. The Companion protocol (port 8098, HTTP API) is unchanged.1. Safe Mode: built-in page when
safemode.htmlcannot be read (BOOT-13)In Safe Mode,
/(and/index.html,/ccu) answered404or503when the SD card was missing or failing, orsafemode.htmlwasn't on it. That put the page with the exit button out of reach. v3.8 announced a built-in page, butSafeMode::printFallbackPage()was never called.SdUtils::serveFile()gets an optionalunreadableout-parameter. When it's given, a file that can't be read gets no answer and the caller answers instead. The other callers are unchanged, and a busy503still goes out as before.WebServer::serveSafeModePage()servessafemode.html, or the built-in page from flash (200,text/html,no-store).POST /safemode-exitwithX-TallyCCU, then/), with clear messages for a404(already left Safe Mode) and for no answer (restarting);normalbooton the serial console.sm:503, the exit request, the script syntax (node --check) and the exact number of restarts;2. Web page: retry a request refused at once
With nearly every W5500 socket in use (vMix, Companion, two pages with the stream, a page reloading), port 80 is left with one socket. While that socket closes the previous request there is no listener for a moment, so the next connection is refused. That request never reaches TallyCCU.
Reproduced in the emulator with that socket load: the first Reset stopped at 10 of 16, and those values stayed
?in both tabs.The fix:
sendCcu()opts.retry: a fetch that fails within 2.5 s is retried after 50, 150 and 400 ms, within the same timeout. It is used only for idempotent requests: parameter writes,getJsonreads, and load/save preset.With the same topology and this page, 6 of 6 Resets and 6 of 6 Loads complete. This came out of a 3-hypothesis investigation (real shield timing, socket pressure, page-logic races); only socket pressure reproduced. In the user's setup the
?that remain are the intentional ones (lens position, video format, unticked groups).3. Serial: the first command after connecting without a reset was lost
Since v3.8 the configurator opens the port without restarting the board. The USB-serial chip can then deliver a garbage byte (
0x00,0xFF), which gets glued to the first command. So Get Config did nothing until another command (for examplehelp) consumed the byte, as reported by the user. Reproduced in the emulator.0x7Fare dropped from the serial console.ser(fast set) covers this.Tests
tests/host/run.sh,check_version.pyandcheck_pages.pypass.smandser.404case is handled.🤖 Generated with Claude Code
https://claude.ai/code/session_01TWAWkD3MqtdyPvo7NYXQ6D