Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,9 @@ static void mdi_execute_hook(void)
emcTaskCommand == NULL &&
emcStatus->task.execState == EMC_TASK_EXEC::DONE &&
emcStatus->task.interpState != EMC_TASK_INTERP::IDLE &&
emcStatus->motion.traj.queue == 0 &&
// not traj.queue: a copy read before the controller ran after
// the move was sent still shows an empty queue
emcStatus->motion.status == RCS_STATUS::DONE &&
emcStatus->io.status == RCS_STATUS::DONE &&
!mdi_execute_wait &&
!mdi_execute_next) {
Expand Down
3 changes: 2 additions & 1 deletion tests/stale-motion-status/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ probing" (#3650).

Both tests check that the machine is on and in auto mode once
wait_complete() returns, then probe at alternating heights and fail if
a probe reads the height of the one before.
a probe reads the height of the one before. Last they send MDI moves
and fail if the interpreter reads idle before a move is done.

late-controller runs motion-controller before motion-command-handler,
so a whole servo period passes between the two. The period is 50 ms,
Expand Down
18 changes: 18 additions & 0 deletions tests/stale-motion-status/test-ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ def error(err):
sys.exit(1)
time.sleep(0.05)

# An MDI move: the interpreter must not read idle before the move is done.
c.mode(linuxcnc.MODE_MDI)
c.wait_complete(60)
for x in (1, 0, 1, 0):
c.mdi("G0 X%d" % x)
start = time.time()
while True:
s.poll()
if s.interp_state == linuxcnc.INTERP_IDLE:
break
if time.time() - start > 60:
sys.stderr.write("timeout waiting for the MDI move to finish\n")
sys.exit(1)
time.sleep(0.001)
if abs(s.position[0] - x) > 1e-6:
failures.append("interpreter idle with G0 X%d at X%.4f" % (x, s.position[0]))
c.wait_complete(60)

err = e.poll()
while err:
error(err)
Expand Down