Skip to content

Commit 412091e

Browse files
authored
Merge pull request #4951 from grandixximo/ks-kins-wait
task: hold an MDI back while a kinematics switch is still landing
2 parents 0b77a16 + 78dd2b6 commit 412091e

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎src/emc/task/emctaskmain.cc‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,12 +1476,16 @@ static int emcTaskPlan(void)
14761476
// interp_list, and waitFlag isn't set, then this new
14771477
// incoming MDI command can just be issued directly.
14781478
// Otherwise we need to queue it and deal with it
1479-
// later.
1479+
// later. A kinematics switch task still waits on ends
1480+
// in a resynch: a line read before it is read under the
1481+
// old kinematics. The switch of an abort routine sets
1482+
// no waitFlag, so ask for it here.
14801483
if (
14811484
(mdi_execute_queue.len() == 0)
14821485
&& (interp_list.len() == 0)
14831486
&& (emcTaskCommand == NULL)
1484-
&& (emcTaskPlanIsWait() == 0)
1487+
&& (emcTaskPlanIsWait() == 0)
1488+
&& (emcStatus->task.execState != EMC_TASK_EXEC::WAITING_FOR_KINS_SWITCH)
14851489
) {
14861490
retval = emcTaskIssueCommand(emcCommand);
14871491
} else {

‎tests/kins-switch/test-ui.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,5 +481,29 @@ def param(name):
481481
else:
482482
error("could not get the machine into G55 to test the abort routine")
483483

484+
# ---- an MDI sent right after an abort is read under the routine's G13.1 ---
485+
#
486+
# The routine's switch reaches motion after the abort; a G43.4 read before
487+
# it had landed took the interpreter for already on the primary kinematics
488+
# and left motion in identity.
489+
490+
errors_before = errors
491+
for attempt in range(10):
492+
mdi("G43.4 H1")
493+
drain()
494+
c.mdi("G12.1 P-1")
495+
done(30)
496+
drain()
497+
mdi("G43.4 H1")
498+
s.poll()
499+
if 434 not in s.gcodes or kins_type() != 0:
500+
error("G43.4 H1 after an abort: G43.4 %s, kinematics type %d"
501+
% ("active" if 434 in s.gcodes else "off", kins_type()))
502+
break
503+
if errors == errors_before:
504+
print("G43.4 after an abort holds the primary kinematics")
505+
mdi("G49")
506+
mdi("G13.1")
507+
484508
print("Exiting with %d errors" % errors)
485509
sys.exit(1 if errors else 0)

0 commit comments

Comments
 (0)