Repository navigation
Conversation
This was referenced Dec 5, 2026
Contributor
|
You use the old HAL terminology which got scrapped and replaced. You should move to the new naming convention. And, fwiw, 32-bit s32/u32 do no longer exist, at all. |
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.
rene-dev
force-pushed
the
task-halui-pins
branch
from
December 6, 2026 12:52
8a1435f to
7060e2b
Compare
Member
Author
|
Thanks, fixed. The |
rene-dev
marked this pull request as ready for review
December 6, 2026 12:54
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.
Task exports the halui pins that motion and iocontrol don't already have, as a HAL component
taskwith halui's pin names undertask.. This is the first step towards removing halui; overrides, MDI commands, jogging and joint/axis selection follow later. halui is untouched here and keeps working.Builds on #4969 (the planner refactor): the first 10 commits are that PR. This PR's own commits are the last 5.
Commits
The
taskcomponent and its status pins (tables below). 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.task.tool.diameterreads the loaded tool's entry from the status, as halui does. The component is created beforeinihalis ready, because the linuxcnc script runs the HAL files as soon as it is, so HAL files can connecttask.*pins as they can halui's.The command inputs. Like halui's they act on the rising edge and send the same commands, but not through NML:
emcTaskQueueInternalCommand()queues them, and the main loop hands one toemcTaskPlan()in a cycle without a new NML command. They leave the echo serial number alone, a refused one is reported on the error channel only, and none of them changes the status of a UI's last command.task.estop.is-activated(iocontrol's is inverted),task.estop.activate(iocontrol's is a level, not an edge) andtask.tool.number(iocontrol's is signed). With these, a configuration can be moved off halui's covered pins by renaming alone.One configuration: first each input pin is driven without halui and its effect checked, including that a refused one leaves the UI's command status alone and a successful one doesn't clear its error. Then halui is loaded and every status pin is compared with halui's in Manual, teleop, MDI with offsets and tools, with overrides, and while a program runs and is paused. An input is held until task has acted on it, then low until task has run two more cycles (
stat.taskbeat), so a loaded machine can't miss it.milltask(1) lists the pins, and says that
task.estop.activateis not a safety input.Difference from halui
No
task.mode.manual/.auto/.mdi: task's mode is to follow what task runs rather than be set (#4972).task.program.runswitches to Auto first, as halui does.A command from a pin has no serial number of its own. With halui, the NML command it sent was newer than a GUI's last one, so a GUI's
wait_complete()returned DONE as soon as halui sent anything. With task's pins, the status keeps echoing the GUI's command, and shows EXEC while a program started from a pin runs. A GUI that callswait_complete()during that run waits for it. That's what happens today when the GUI waits on a command sent while another client's program runs, so the difference is only in the window where the pin starts a run while the GUI's own command is still in progress. The man page says so.task.estop.activate, likehalui.estop.activate, is an edge handled in task's next cycle, after whatever is already queued. It is not a safety input and doesn't replaceiocontrol.0.emc-enable-in; the man page says that too.halui's pins and where they go
✅ the same signal already exists elsewhere · ◐ partly, or with different
semantics · ❌ nothing. The last column is the
task.*pin from this PR, orwhere the rest is planned to go.
Status outputs
halui.machine.is-onmotion.motion-enabledhalui.machine.units-per-mmtask.machine.units-per-mmhalui.estop.is-activatediocontrol.0.user-enable-out(inverted)task.estop.is-activatedhalui.mode.is-manualtask.mode.is-manualhalui.mode.is-autotask.mode.is-autohalui.mode.is-mditask.mode.is-mdihalui.mode.is-teleopmotion.teleop-modehalui.mode.is-jointmotion.teleop-mode/motion.coord-modeboth falsetask.mode.is-jointhalui.mist.is-oniocontrol.0.coolant-misthalui.flood.is-oniocontrol.0.coolant-floodhalui.program.is-idletask.program.is-idlehalui.program.is-runningtask.program.is-runninghalui.program.is-pausedtask.program.is-pausedhalui.program.optional-stop.is-ontask.program.optional-stop.is-onhalui.program.block-delete.is-ontask.program.block-delete.is-onhalui.halui-mdi-is-runninghalui.max-velocity.valuetask.max-velocity.valuehalui.feed-override.valuetask.feed-override.valuehalui.rapid-override.valuetask.rapid-override.valuehalui.spindle.S.is-onspindle.S.onhalui.spindle.S.runs-forwardspindle.S.forwardhalui.spindle.S.runs-backwardspindle.S.reversehalui.spindle.S.brake-is-onspindle.S.brakehalui.spindle.S.override.valuetask.spindle.S.override.valuehalui.joint.N.is-homedjoint.N.homedhalui.joint.N.has-faultjoint.N.faultedhalui.joint.N.on-hard-min-limitjoint.N.neg-hard-limithalui.joint.N.on-hard-max-limitjoint.N.pos-hard-limithalui.joint.N.on-soft-min-limitmotion.on-soft-limit(global only)task.joint.N.on-soft-min-limithalui.joint.N.on-soft-max-limitmotion.on-soft-limit(global only)task.joint.N.on-soft-max-limithalui.joint.N.override-limitstask.joint.N.override-limitshalui.joint.N.is-selectedhalui.joint.selectedhalui.joint.selected.{is-homed,has-fault,on-*-limit,override-limits}halui.axis.L.is-selectedhalui.axis.selectedhalui.axis.L.pos-commandedaxis.L.pos-cmdhalui.axis.L.pos-feedbackjoint.N.pos-fb)task.axis.L.pos-feedbackhalui.axis.L.pos-relativetask.axis.L.pos-relativehalui.tool.numberiocontrol.0.tool-number(sint)task.tool.numberhalui.tool.length_offset.{x..w}motion.tooloffset.{x..w}halui.tool.diametertask.tool.diameterCommand inputs
halui.machine.on/.offtask.machine.on/.offhalui.estop.activateiocontrol.0.emc-enable-inlow (a level that holds E-stop, not an edge)task.estop.activatehalui.estop.resettask.estop.resethalui.mode.manual/.auto/.mdihalui.mode.teleop/.jointtask.mode.teleop/.jointhalui.mist.on/.offtask.mist.on/.offhalui.flood.on/.offtask.flood.on/.offhalui.program.runtask.program.runhalui.program.pause/.resumemotion.feed-hold(needs M53) /motion.feed-inhibit— motion-level hold, not a task pausetask.program.pause/.resumehalui.program.steptask.program.stephalui.program.stoptask.program.stophalui.abortmotion.jog-stoponly stops jogs)task.aborthalui.program.optional-stop.on/.offtask.program.optional-stop.on/.offhalui.program.block-delete.on/.offtask.program.block-delete.on/.offhalui.home-alltask.home-all(only with[JOINT_0]HOME_SEQUENCE, like halui)halui.joint.N.home/.unhometask.joint.N.home/.unhomehalui.joint.selected.home/.unhomehalui.mdi-command-NNhalui.max-velocity.{counts,count-enable,direct-value,scale,increase,decrease}ini.traj_max_velocity(changes the limit, not the runtime value)halui.feed-override.{counts,count-enable,direct-value,scale,increase,decrease,reset}motion.adaptive-feed(scales feed, but invisible to GUIs, not an override)halui.rapid-override.{counts,count-enable,direct-value,scale,increase,decrease,reset}halui.spindle.S.override.{counts,count-enable,direct-value,scale,increase,decrease,reset}halui.spindle.S.start/.stopspindle.S.inhibitcan only block)task.spindle.S.start/.stophalui.spindle.S.forward/.reversetask.spindle.S.forward/.reversehalui.spindle.S.increase/.decreasetask.spindle.S.increase/.decreasehalui.spindle.S.brake-on/.brake-offtask.spindle.S.brake-on/.brake-offhalui.joint.N.selecthalui.axis.L.selecthalui.joint.N.plus/.minushalui.joint.N.analoghalui.joint.N.increment+.increment-plus/.increment-minusjoint.N.jog-counts+jog-scale+jog-enable(wheel jog; a pulse per press ≈ increment)halui.joint.selected.{plus,minus,increment,increment-plus,increment-minus}halui.joint.jog-speed/.jog-deadbandhalui.axis.L.plus/.minushalui.axis.L.analoghalui.axis.L.increment+.increment-plus/.increment-minusaxis.L.jog-counts+jog-scale+jog-enablehalui.axis.selected.{plus,minus,increment,increment-plus,increment-minus}halui.axis.jog-speed/.jog-deadbandPart of #4832, which stays open as the tracking branch.