Repository navigation
Conversation
|
@revjmoney please rebase there are conflicts after recent merges |
A read error (G4 with no P fails check_items inside Interp::read) only set interpState to WAITING. The lines queued before it ran out and the program sat at the bad line with the spindle still on. An execute error did the opposite: it cleared interp_list and reset the interpreter at once, dropping the good lines read ahead of it, with no spindle or IO abort. Both now stop reading and set interp_error_pending. An execute error drops only what the bad line itself queued (new InterpList::truncate). Once interp_list, motion and IO have drained, readahead_waiting runs the abort task already uses for a motion or IO error: emcTaskAbort, emcIoAbort, emcSpindleAbort, mdi_execute_abort and emcAbortCleanup. emcAbortCleanup clears the flag, so any abort on the way cancels it. Adds g4-no-p.ngc (the program from the issue) and exec-error.ngc (G83 Q0) to tests/motion-logger/basic. Fixes LinuxCNC#2978.
The naive CAM detector holds feed moves back to join them, so the G1 right before a bad line was not in interp_list yet and was lost. Queue the moves held from the lines before the error, and still drop what the bad line itself queued or held. A bad line with an F word flushes the held moves before it fails, so note where they end in interp_list. In a run from line the moves queued and held at a read error are of skipped lines. Drop them. The abort could also come too early: with a copy of the status read before the controller ran, traj.queue is still 0 after the last move was sent, and a dwell or input wait only shows in execState. Wait for both. Adds tests/interp-error-abort, which uses the real motion controller.
|
Rebased on master. While testing it on the real motion controller I found faults in my fix, so there is a second commit:
tests/interp-error-abort covers these. It takes about 3.5 minutes here, I can shorten it if that is too long for CI. One limit: if the bad line queues or joins a move of its own before it fails, the moves held before it can still be dropped. Full suite here: 383 of 388. The five failures (three touchy, two qtdragon in ui-smoke) also fail on plain master on this box. |
28d4a3a to
8e2fef7
Compare
That is a problem. Why do they fail? |
|
Missing packages on my box, not the code. The two qtdragon tests stop at "No module named 'qtpy'". The three touchy tests stop when gladevcp asks for GtkSource 4: "Namespace GtkSource not available". All five passed here in CI, in both rip-and-test and rip-and-test-clang (388 of 388). I have not installed the packages and rerun them on my box yet. |
|
Installed the missing packages and reran those five on my box with this branch's code: all five pass now, twice each. It needed python3-qtpy and python3-pyqt5.qsci for qtdragon, and gir1.2-gtksource-4 for touchy. I also put in python3-pyqt5.qtwebengine at the same time as qsci. I have not rerun the full suite since. |
Fixes #2978, using option 2 as @grandixximo chose: the good lines before an interpreter error run, then task aborts, with the error still shown.
Before: a read error (e.g.
G4 X2, no P, failscheck_itemsinsideInterp::read) only setinterpState = WAITING. The queued lines ran out and the program sat at the bad line with M3 still on. An execute error took the other extreme:interp_list.clear()andemcAbortCleanup()right away, which throws away the good lines read ahead of it and only resets the interpreter (no spindle or IO abort).Now both paths do the same thing (
emctaskmain.cc):interp_error_pending. For an execute error, only what the bad line itself queued is dropped (InterpList::truncate, new, back to the length before that line); the good lines before it stay queued.readahead_waiting, onceinterp_list, motion and IO are drained, run the same abort sequence task already uses for a motion/IO error:emcTaskAbort(),emcIoAbort(),emcSpindleAbort()per spindle,mdi_execute_abort(), thenemcAbortCleanup(EMC_ABORT::INTERPRETER_ERROR).emcAbortCleanupclears the flag, so any other abort on the way (operator Abort, E-stop, machine off) cancels it.The GUI is left alone (no blocking Run), as discussed.
Test: as suggested, two programs added to
tests/motion-logger/basicwith their expected logs:g4-no-p.ngc(the program from the issue) andexec-error.ngc(G83 Q0). Both now log the moves andSPINDLE_ON speed=1000and thenABORT,SPINDLE_OFF. Before,g4-no-pended atSPINDLE_ON speed=1000with no stop, andexec-errorlogged nothing butSS_ENABLE(the good lines were dropped). The existing sub-tests (startup, reset, g0, g1, s) are unchanged. As you noted, the mock motion cannot tell "now" from "after the queue drains"; I left the halsampler variant out unless you want it.Tested on a master run-in-place build (uspace, non-RT):
tests/motion-logger3/3, and the fullscripts/runtests tests: 363 of 370 pass. The 7 failures are the fivetests/ui-smokeGUI tests, which fail the same way on unpatched master on this box (missing GUI dependencies), and two interp tests from my other, unrelated branches that were left in the tree.