Repository navigation
Conversation
This was referenced Dec 6, 2026
Contributor
|
The armhf failure here (gmoccapy-quit, qtdragon-quit, touchy-quit) is a test bug on runners that fall back to QEMU, fixed in #4965. The next push picks up the fix. |
hansu
reviewed
Dec 6, 2026
hansu
left a comment
Member
There was a problem hiding this comment.
Nice feature!
But two little comments:
-
In Gmoccapy it switches to the jog page and makes it impossible to have a look at the gcode while paused. I propose to not switch automatically to the jog page and make the manual mode button clickable in this case (even though it only allows jogging and stays in auto mode).
-
The path which is jogged while paused is displayed in gremlin in the color of the passed program path (red-ish). I think this should be also in yellow.
tests/task-planner brings task into each situation its planner tells apart (E-stop, off, Manual, MDI idle and running, Auto idle, reading, waiting and paused) and sends it every command emcTaskPlan() handles, one at a time, plus one it has no case for. From task's own debug output it records, for each, whether the planner issued the command, queued it for later, refused it or handled it itself, and what situation the command left task in. The table is compared with tests/task-planner/ expected, which is the behaviour of today's planner. A change to the planner that is not meant to change behaviour leaves the table as it is; one that is shows up as a diff of it. The commands come from test_task_probe, a small NML client that sends any of them with arguments that change as little as possible. It is built for run-in-place only and not installed; the test skips without it.
emcTaskPlan() found its command itself: it compared emcCommand's serial number with the echoed one to tell a new command from none, and allow_while_idle_type() read the command's type from the NML buffer once more. Have the main loop make that decision and pass the new command, or NULL, and use only that inside the planner. This is what lets a command reach the planner by another way than the NML buffer. No change in behaviour: tests/task-planner is unchanged.
The planner's tables repeated the commands each passes straight to emcTaskIssueCommand(): 22 accepted in any state, three more only while the machine is off, twelve once it is on, the spindle commands unless a program is reading or waiting, the program and I/O commands unless one runs, and so on. isImmediate() now says this once, by the state, mode and interpreter state task is in, and each table keeps only what is special to it and its own refusal. allow_while_idle_type() is part of it now, and the three tool commands share queueToolCommand(). No change in behaviour: tests/task-planner is unchanged, and fails if spindle orient is let through in Manual, as an example of a slip.
EMC_JOG_ABS, EMC_JOINT_HALT, EMC_JOINT_SET_FERROR, EMC_JOINT_SET_MIN_FERROR, EMC_JOINT_SET_HOMING_PARAMS, EMC_TRAJ_SET_VELOCITY and EMC_TRAJ_SET_ACCELERATION, with their classes, task's handling of them and their rows in the planner table. emcJogAbs() had no other caller.
… of checkInterpList() checkInterpList() lost its limit checks long ago and always returned 0; it now only shows the operator errors of the lines it drops. task read [TASK]MDI_QUEUED_COMMANDS and never used it.
42 file-level pointers each held the cast for one case. Those used once are folded into the call; the others are declared in their case.
emcTaskCheckPreconditions() and emcTaskCheckPostconditions() become commandWaits(), and the STEPPING_CHECK macro becomes steppingHolds(). The table says what the two switches said, command for command.
emcTaskPlan() works out the situation once, then a command is handled by the planner itself (planSpecial()), passed straight through (isImmediate()) or refused (refuse()). The planner table is unchanged.
With EMC_JOG_ABS and emcJogAbs() gone the handler had no caller. In teleop it was not absolute either: axis_jog_abs() added the target to the current position.
tests/task-planner and test_task_probe recorded what the planner did with every command, to show that the refactoring of emcTaskPlan() changed nothing. That work is done.
Task gets a HAL component, "task", with the status pins of halui that have no equivalent elsewhere: the task mode and whether motion is in joint mode, the interpreter state, optional stop and block delete, the override and max-velocity values, the soft limits and override-limits of each joint, each axis' Cartesian feedback and relative (DRO) position, the tool diameter and units-per-mm. Their names are halui's under "task." instead of "halui.". They are updated once per task cycle from task's own status, so they are current in the same cycle, where halui's lag by its poll. The component is created before inihal is ready, so that the HAL files, which the linuxcnc script runs as soon as inihal is, can connect its pins, as they can halui's. The axes and spindles are therefore read from the INI file, the way task sets motion up with them. tests/task-hal-pins connects some of the pins in a HAL file, and compares every one of them with halui's pin in manual, teleop, MDI with offsets and tools, with overrides, and while a program runs and is paused.
Task exports halui's command input pins: machine on/off, E-stop reset, teleop/joint mode, mist and flood, program run/pause/resume/step/stop, abort, optional stop and block delete, home-all (with [JOINT_0]HOME_SEQUENCE, like halui), home and unhome of each joint, and start/stop/forward/reverse/increase/decrease/brake of each spindle. Like halui's they act on the rising edge, spindle increase and decrease also on the falling one, and send the same commands. halui's mode.manual, .auto and .mdi pins are left out: task's modes are to follow what task runs rather than be set. program.run switches to Auto first, as halui does. The commands do not go through NML. emcTaskQueueInternalCommand() queues them, and the main loop hands one to emcTaskPlan() on each cycle without a new NML command. They leave the echo serial number alone, and a refused one is reported on the error channel only: it does not turn the status of the UI's last command into ERROR, nor does a successful one clear that command's error. tests/task-hal-inputs pulses each pin, without halui, and checks both; it also sets one of the pins from a HAL file.
Three halui pins have a counterpart in iocontrol that is not quite the same signal, so a configuration could not just be renamed to it: - task.estop.is-activated: iocontrol.0.user-enable-out is its inverse. - task.estop.activate: iocontrol.0.emc-enable-in is a level that holds the machine in E-stop; this is an edge that puts it there once. - task.tool.number: iocontrol.0.tool-number is signed, halui's unsigned. With these, each halui pin that motion, iocontrol or task now covers has exactly one pin to be renamed to.
task-hal-inputs and task-hal-pins ran the same configuration but for halui and the homing sequence. They are one test now: the input pins first, without halui, then halui is loaded and the status pins are compared with its own. An input pin is held until task has acted on it, and then low until task has run two more cycles, instead of a 50 ms pulse that a loaded machine could let fall between two task cycles. The refused program.step waits for the refusal on the error channel instead of 200 ms, so the status it checks is the one after task handled it.
milltask(1) lists the task.* pins, says that an input pin command does not take the place of a user interface's command but that the status still shows a run it starts, and that task.estop.activate is not a safety input: it is an edge task handles in its next cycle, and the E-stop chain belongs on iocontrol.0.emc-enable-in.
Axes can be jogged (keyboard, AXIS, halui, linuxcncrsh, wheel) while a program or MDI command is paused, M0/M1 included, once the pause has stopped the motion. Joints cannot. Motion keeps the paused program position and adds a per-axis pause offset on top of it, as the external offsets are added (axis_pause_*() in axis.c), within the soft limits. The queued moves and the interpreter are untouched. On resume or step, do_pause_resume() (control.c): - puts the spindles back as they were at the pause (state, direction, speed, CSS) and waits for them to be at speed; - returns the axes: the ones not in [TRAJ]PAUSE_RETURN_LAST (default Z) together in a straight line, then those, at the axis limits, and sets the offsets to exactly zero; - then resumes or steps. Task restores mist and flood. Pausing during the return stops it there. An abort keeps the machine where it was jogged to: the planner takes the offsets into its position. Reverse run is refused while jogged away. Status: pause_offset, pause_jog_ok and pause_returning in EMC_MOTION_STAT and Python. Task accepts axis jogs while paused (planSpecial()), halui and linuxcncrsh send them, AXIS enables its jog and spindle controls (not homing) and does not ask for Manual mode while paused. This is the work from LinuxCNC#4700, for a task that still has modes: - the mode stays Auto or MDI during the pause; nothing switches it; - in coordinated mode without a pause (MDI mode, idle) a jog still does nothing and reports nothing; - no absolute jog, which this branch has removed. Tests: new tests/jog-while-paused; motion-logger expectations gain the SET_PAUSE_RETURN_LAST startup command.
GStat gets is_jog_ok(), is_spindle_ok(), is_pause_jog_ok() and a pause-jog-ok-changed signal. Jog and spindle action buttons use them, STOP_JOG works while paused, and UPDATE_VAR_FILE saves the parameter file with task_plan_synch() instead of a mode change.
Show the jog page while jogs during a pause are possible and restore the previous page on resume or abort.
Don't switch to teleop while paused. Gscreen makes its mode and axis buttons sensitive while paused and returns to the paused mode on resume.
Use STATUS.is_jog_ok() in kb_jog and only switch to manual mode when not jogging during a pause.
rene-dev
force-pushed
the
jog-while-paused
branch
from
December 6, 2026 12:52
f581338 to
22c9bd8
Compare
rene-dev
marked this pull request as ready for review
December 6, 2026 14:32
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.
Axes can be jogged (keyboard, AXIS, halui, linuxcncrsh, wheel) while a program or MDI command is paused, M0/M1 included, once the pause has stopped the motion. Joints cannot. This is the jog-while-paused work from #4700, for a task that still has modes.
Builds on #4970 (task's HAL pins, on the planner refactor #4969). It only needs #4969, but #4972 needs both, so it is stacked on #4970. This PR's own commits are the last 5.
How it works
Motion keeps the paused program position and adds a per-axis pause offset on top of it, as the external offsets are added (
axis_pause_*()in axis.c), within the soft limits. The queued moves and the interpreter are untouched. On resume or step,do_pause_resume()(control.c):[TRAJ]PAUSE_RETURN_LAST(default Z) together in a straight line, then those, at the axis limits, and sets the offsets to exactly zero;Task restores mist and flood. Pausing during the return stops it there. An abort keeps the machine where it was jogged to: the planner takes the offsets into its position. Reverse run is refused while jogged away.
Status:
pause_offset,pause_jog_okandpause_returninginEMC_MOTION_STATand Python.Commits
tests/jog-while-paused; motion-logger expectations gain theSET_PAUSE_RETURN_LASTstartup command.is_jog_ok(),is_spindle_ok(),is_pause_jog_ok()and apause-jog-ok-changedsignal;UPDATE_VAR_FILEsaves the parameter file withtask_plan_synch()instead of a mode change.Part of #4832, which stays open as the tracking branch.