Repository navigation
docs(bench): add the 2026-11-01 record - #84
Merged
Merged
Conversation
This was referenced Nov 1, 2026
CameronBrooks11
added a commit
that referenced
this pull request
Nov 2, 2026
Fixes #81, the GET_STATE replies cut short on the gen2 Nano. The 2026-11-01 bisect (#84) traced the cut-short replies to how often the loop masks interrupts. With `main.cpp`'s masked windows removed, or with the loop slowed by 300 us a pass, the bad-reply rate went from 187 in 300 s to 0. `relayControlLogic()` opened four masked windows on every pass: three snapshots and the on-time commit. What changes: - `relayControlLogic()` takes its snapshot, runs the PIDs and publishes the on-times only on a new thermocouple reading, or once `RLHT_SNAPSHOT_INTERVAL_MS` (default 10, a `-D` override) has passed. In between, `actuateRelay()` drives from the last snapshot. - The PIDs still compute once per reading (#76), since a reading always triggers a snapshot. - The e-stop, watchdog-trip and fault hold is checked on every pass with no masked window. Each flag is one byte and only the main loop sets them. The relay state fields are written only when they change. - A command now waits up to the interval to reach a relay: 10 ms, next to a 1000 ms relay period. - An invalid mode now holds both relays off through drives of 0, where before it returned early from each pass. I rejected a per-command "changed" flag set by every handler: a handler that missed setting it would leave a stale setpoint or mode. A fixed interval can't miss anything. ## Test `test_mask_rate` counts `noInterrupts()` calls through the host stub over 3 s of closed-loop heating: | | Passes that opened a masked window | | --- | --- | | main's `relayControlLogic()` | 1500 of 1500: the check fails | | this branch | 302 of 1500, against an allowance of 312 (one per 10 ms plus one per reading) | It also checks that a duty change reaches relay 1 within the interval (10 ms) and that the e-stop drops relay 1 on the next pass. `make -C test/host`: 732 ok, 0 failed, across the four envs. That's main's 696 plus `test_mask_rate`'s 36. `pio run`, 0 warnings: | env | Flash | RAM | Flash vs main | | --- | --- | --- | --- | | `gen1_nano` | 23018 B | 918 B | | | `gen2_nano` | 24246 B | 934 B | +208 B, +12 B RAM | | `gen1_nanoevery` | 24505 B | 996 B | | | `gen2_nanoevery` | 25717 B | 1014 B | | ## Bench gen2 Nano on the backplane, Pi 4 at 50 kHz, `replylog.py 19 1 300` with retries off: | Build | Bad replies in 300 s | | --- | --- | | main `a251158` (2026-11-01, two captures) | 187 / 2552 and 175 / 2552 | | this branch (2026-11-02) | 1 / 2551 | The one bad frame went to 0xFF at the CRC byte and was caught. That's the rate Slice_DCMT's gen2 Nano showed on the same bus on 2026-10-31 (1 / 2555). Not run on the board: the heaters under closed-loop control on this build. The host tests cover the control paths.
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.
Adds the 2026-11-01 bench record, on
mainata251158, gen2 Nano.R1a, the watchdog trip: status LED amber, red with the e-stop, amber after the release, green after the clear. Verifies feat(firmware): show amber on a watchdog trip or heater fault #83.
R2, PID timing: the derivative adds 21 ms per 0.25 C reading step, not about 64 ms, and on-time changes once per reading. Verifies fix(firmware): compute the heater PIDs once per thermocouple reading #76.
R3:
tcsel 2 2is refused with reason 6 while heater 1 runs, and is applied at setpoint 0 and in open loop. Verifies fix(firmware): refuse a thermocouple select change under a running heater #77.F4, the 30 C test build: latched after readings of 30.3 C and 30.8 C. LED amber, red, amber; cleared at 27.3 C.
R4, the GET_STATE replies from the gen2 Nano arrive cut short in 2-4% of polls #81 bisect: bad GET_STATE replies per 300 s.
main.cpp'snoInterrupts()windows removedHow often the loop masks interrupts causes the cut-short replies. The record includes the patch that builds the variants.
Of the cut-short replies, 13 of 187 in C0 passed the CRC as an all-0xFF payload, against the 1 in 256 that feastorg/CRUMBS#130 assumes.