From 5601b59042e6741f32e933b5f713b77aa639cf75 Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Sun, 18 Oct 2026 05:14:24 +0200 Subject: [PATCH 1/2] gscreen: fix startup crash, use self.inifile for maplinearunits --- src/emc/usr_intf/gscreen/gscreen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py index 3388bdb7ab6..593f1b1700d 100755 --- a/src/emc/usr_intf/gscreen/gscreen.py +++ b/src/emc/usr_intf/gscreen/gscreen.py @@ -636,7 +636,7 @@ def __init__(self): units=self.inifile.find("AXIS_X","UNITS") if units==None: self.add_alarm_entry(_("No UNITS entry found in [TRAJ] or [AXIS_X] of INI file")) - units = inifile.maplinearunits(units, fallback=1.0) + units = self.inifile.maplinearunits(units, fallback=1.0) if 1.0 == units: self.machine_units_mm=1 conversion=axis_kinds.unit_factors(self.inifile, 1.0/25.4) From e1ebb2af2a41cc6a8d69554ef27c237bb59093b6 Mon Sep 17 00:00:00 2001 From: Rene Hopf Date: Mon, 16 Nov 2026 13:38:02 +0100 Subject: [PATCH 2/2] motion: wait for the joints to come to rest before entering joint mode In position is the planner's. The joints follow it through the cubic interpolators and arrive a few cycles later. Since mode changes are deferred instead of dropped, the change to joint mode happened on the first in-position cycle and took pos_cmd mid-spline, so an MDI move from joint mode ended up to 0.0003 mm off its target in about 1 run in 100. Wait until the last four points of each joint's cubic are the same. A moving external offset never rests, so it does not hold the change up. --- src/emc/motion/control.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 9c10369b51f..0b62691c942 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -1194,7 +1194,19 @@ static void set_operating_mode(void) /* check entering free space mode */ if (!emcmotInternal->coordinating && GET_MOTION_COORD_FLAG()) { - if (GET_MOTION_INPOS_FLAG()) { + /* in position is the planner's; the joints follow it through + the cubics and come to rest a few cycles later. Taking + pos_cmd before that leaves them short of the end. A moving + external offset never rests, so it does not hold this up. */ + int at_rest = 1; + for (joint_num = 0; joint_num < NO_OF_KINS_JOINTS; joint_num++) { + CUBIC_STRUCT *cu = &joints[joint_num].cubic; + if (cu->x0 != cu->x3 || cu->x1 != cu->x3 || cu->x2 != cu->x3) { + at_rest = 0; + } + } + if (GET_MOTION_INPOS_FLAG() + && (at_rest || hal_get_bool(emcmot_hal_data->eoffset_active))) { for (joint_num = 0; joint_num < ALL_JOINTS; joint_num++) { /* point to joint data */ joint = &joints[joint_num];