Repository navigation
Conversation
test/run_host_tests.sh builds every test_* folder with plain g++ and Unity, using the same sources and flags as [env:native]. A CI job runs it and builds sim/ on every push, so each step of the rework is checked before it is flashed. sim/src/sim_sd.cpp redefined the inline no-card stubs hw/sdcard.h supplies when HAS_SD_CARD is off, which is the firmware default, so the bench simulator no longer built. Its card functions now follow the same switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uqr4BLDFjWoo8xWxrvcr82
… know Imported as-is from the uncommitted work in the Gitea working copy (2026-11-05), so the fixes that follow are reviewable against it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uqr4BLDFjWoo8xWxrvcr82
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uqr4BLDFjWoo8xWxrvcr82
…r a jog
NONE / SKIP answered M61 Q98 (empty) on the operator's say-so. With a
cartridge still in the collet, the next LOAD skips the put-back and drives it
into a full pocket. EMPTY is now enabled only after the toolsetter tap found
nothing. SKIP closes the card and leaves the tool unknown until the next link
drop, restart or lost position; the TOOLS page shows "?" and keeps LOAD locked
("spindle unknown: tap IN SPINDLE"), and tapping IN SPINDLE brings the card
back.
The card and the TOOLS page asked for the current tool on every return to
Idle, which includes the end of every jog step. The query queued ahead of the
next jog chunk, and a queued line makes send_jog_line() skip the chunk, so
jog steps went missing. Both now skip the query when coming back from Jog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uqr4BLDFjWoo8xWxrvcr82
AutoZero sent 28 lines one at a time into a 16-slot queue, so the last 11 (the Y walls, G10 and the lift out of the pocket) were dropped and the bit stayed in the plate with the parser in G91. Multi-line actions are now sequences (seq_begin/seq_line/seq_send): queued whole or refused with the reason on screen, and stopped at the first error or alarm instead of probing on from the wrong place, with a cleanup line (G90) sent instead. The queue is 48 slots. AutoZero, the flat-plate probe, the calibration move and the driver-reset relay pulse use it. The flat-plate probe also left G91 behind on success; it now ends in G90. The queue now writes lines and keeps the ack gate itself instead of calling fnc_send_line(), so the parser's own gate is never armed. That is what lets RESET and a lost link drop queued lines immediately without the next send spinning for 2 s, and lets sequence lines wait out a slow probe (ok arrives only when G38.2 ends) without misattributing every ack after it. RESET (and the vibration guard's reset) now discards everything queued, so nothing waiting behind it runs after it. Link loss was never detected: fnc_is_connected() had no caller. link_service() now pings after 1 s of silence and shows NO LINK after 4 s, flushing the queue and forgetting homing. It also replaces the two priming paths (connect_init and prime_link_if_up both sent $G and $RI=200) with one, shared by the panel and both simulators. Controller restarts were never seen: GrblParserC routes the "Grbl ..." banner to handle_signon(), not handle_other(), so the sniff never ran. handle_signon() now raises the flag; a restart flushes the queue, re-primes and forgets homing, unless it follows the panel's own RESET by under 3 s. Panel-side errors (refused or stopped sequences, a full queue) used to reach only the console. They now show in a strip above the safety bar. New host tests: test_linkwatch, and test_link, which drives the real send queue and parser glue against a scripted controller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uqr4BLDFjWoo8xWxrvcr82
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f1a7c7c65
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| static uint32_t epoch = UINT32_MAX; | ||
| static bool macro = false; | ||
| const bool came_to_rest = state == Idle && was != Idle && was != Jog; | ||
| if (state == Idle && (came_to_rest || epoch != homed_epoch() || !macro)) send_line(TC_ASK_CURRENT); |
There was a problem hiding this comment.
Refresh spindle state after every sign-on
When the panel sends RESET while FluidNC is already Idle, the reset handler re-primes without changing homed_epoch, and the machine state may remain Idle; this predicate then does not query TC_ASK_CURRENT. The cached tc_current() can remain the old tool even though the controller forgot it, so the TOOLS page shows stale spindle contents and skips the confirmation card. Invalidate or refresh the cached tool state on every sign-on, including panel-issued resets.
Useful? React with 👍 / 👎.
| char* save = nullptr; | ||
| snprintf(c, sizeof(c), "%s", m.cleanup); | ||
| for (char* l = strtok_r(c, "\n", &save); l; l = strtok_r(nullptr, "\n", &save)) | ||
| sendq_push(&s_sendq, l); |
There was a problem hiding this comment.
Defer modal cleanup until Alarm is cleared
When a probe sequence aborts on an alarm, this queues its G90 cleanup while FluidNC is still in Alarm, ahead of the operator's $X; FluidNC refuses G-code in that state, so the cleanup is lost and the sequence can leave G91 modal after unlock. A later command that assumes absolute mode can then move incorrectly. Defer cleanup until the alarm is cleared or otherwise ensure the mode is restored.
Useful? React with 👍 / 👎.
| refuse("the controller is still busy with earlier commands"); | ||
| return false; | ||
| } | ||
| auto& m = s_meta[s_next_seq % SEQ_META]; |
There was a problem hiding this comment.
Refuse reuse of an occupied sequence metadata slot
If a slow controller has more than eight sequences buffered—for example, repeated PROBE or MOVE taps while those controls remain enabled—this overwrites an earlier sequence's metadata. If that earlier sequence then errors, abort_seq can drop its queued lines but no longer knows its cleanup, leaving relative mode active. Refuse new sequences when their metadata slot is occupied or track every outstanding sequence.
Useful? React with 👍 / 👎.
Requested by Matthew · project thread
First two steps of the rework plan. This PR fixes the bugs on the current code so the machine is safe before any restructuring starts.
Step 0: groundwork
test/run_host_tests.shbuilds and runs every host test with plain g++ and Unity, so it does not depend on the PlatformIO registry. It uses the same sources and flags as[env:native]..github/workflows/ci.yml) runs the host tests, builds the bench simulator, and builds thecrowadvfirmware.sim/) builds again.sim_sd.cppwas redefining the no-card stubs.Step 1: safety fixes
error:or alarm and sends a cleanupG90instead of the remaining lines. The queue now has 48 slots. AutoZero, the flat-plate probe, the calibration move and the driver-reset relay pulse all use sequences. The flat-plate probe also used to leave the parser in G91 even when it succeeded. It now ends with G90.link_service()pings after 1 s of silence. After 4 s it shows NO LINK, flushes the queue and forgets homing. The two old priming paths are merged into one, which the panel and both simulators share.handle_signon(), which now raises the flag. A restart flushes the queue, re-primes the link and forgets homing. The exception is a restart within 3 s of the panel's own RESET, which keeps homing.send_reset()now flushes the queue. The vibration guard uses it too.fnc_send_line(). Because of that, a flush takes effect immediately, and a slow G38.2 does not misattribute the acks that follow it.Testing
test/run_host_tests.sh: 16 suites pass. New:test_linkwatch, andtest_link, which drives the real queue and parser glue against a scripted controller (a 28-line sequence, error and alarm aborts, RESET flush, own reset vs restart, silence → NO LINK → reconnect).fluidnc_sim.pyunder a live panel. The panel went to NO LINK after about 4 s and re-primed once the simulator came back.Known limits (addressed in later steps)
G90is refused with error:9. A soft reset restores G90.Generated by Claude Code