From 6cd83c3a1e5cdb43e946b28161eeaa244c69a6ee Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Thu, 8 Jan 2026 14:16:22 +0100 Subject: [PATCH 01/14] gmoccapy: use now ..._SPINDLE_0_... instead of ..._SPINDLE_... using qt_istat --- configs/sim/gmoccapy/gmoccapy.ini | 9 +++------ src/emc/usr_intf/gmoccapy/getiniinfo.py | 23 ----------------------- src/emc/usr_intf/gmoccapy/gmoccapy.py | 8 ++++---- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/configs/sim/gmoccapy/gmoccapy.ini b/configs/sim/gmoccapy/gmoccapy.ini index 9aa8a90074e..4f085818d68 100644 --- a/configs/sim/gmoccapy/gmoccapy.ini +++ b/configs/sim/gmoccapy/gmoccapy.ini @@ -22,21 +22,18 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MIN_SPINDLE_0_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 # Initial value for spindle speed -DEFAULT_SPINDLE_SPEED = 450 +DEFAULT_SPINDLE_0_SPEED = 450 # The following are not used, added here to suppress warnings (from qt_istat/logger). DEFAULT_LINEAR_VELOCITY = 35 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 234 -DEFAULT_SPINDLE_0_SPEED = 500 MIN_SPINDLE_0_SPEED = 0 MAX_SPINDLE_0_SPEED = 3000 -MAX_SPINDLE_0_OVERRIDE = 1.2 -MIN_SPINDLE_0_OVERRIDE = 0.5 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/src/emc/usr_intf/gmoccapy/getiniinfo.py b/src/emc/usr_intf/gmoccapy/getiniinfo.py index 63077dc6a50..879d57d4b9f 100644 --- a/src/emc/usr_intf/gmoccapy/getiniinfo.py +++ b/src/emc/usr_intf/gmoccapy/getiniinfo.py @@ -278,29 +278,6 @@ def get_min_ang_jog_vel(self): LOG.warning("No MIN_ANGULAR_VELOCITY entry found in [DISPLAY] of INI file. Using default value of 0.1 degree / min.") return float(temp) - def get_default_spindle_speed(self): - # check for default spindle speed settings - temp = self.inifile.find("DISPLAY", "DEFAULT_SPINDLE_SPEED") - if not temp: - temp = 300 - LOG.warning("No DEFAULT_SPINDLE_SPEED entry found in [DISPLAY] of INI file") - return float(temp) - - def get_max_spindle_override(self): - # check for override settings - temp = self.inifile.find("DISPLAY", "MAX_SPINDLE_OVERRIDE") - if not temp: - temp = 1.0 - LOG.warning("No MAX_SPINDLE_OVERRIDE entry found in [DISPLAY] of INI file") - return float(temp) - - def get_min_spindle_override(self): - temp = self.inifile.find("DISPLAY", "MIN_SPINDLE_OVERRIDE") - if not temp: - temp = 0.1 - LOG.warning("No MIN_SPINDLE_OVERRIDE entry found in [DISPLAY] of INI file") - return float(temp) - def get_max_feed_override(self): temp = self.inifile.find("DISPLAY", "MAX_FEED_OVERRIDE") if not temp: diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index 06b67f7bd58..92a551b42b2 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -185,7 +185,7 @@ def __init__(self, argv): self.error_channel.poll() # set INI path for INI info class before widgets are loaded - INFO = Info(ini=argv[2]) + self.INI = Info(ini=argv[2]) self.builder = Gtk.Builder() # translation of the glade file will be done with @@ -593,8 +593,8 @@ def _get_ini_data(self): self.rabbit_jog = self.get_ini_info.get_jog_vel() self.jog_rate_max = self.get_ini_info.get_max_jog_vel() - self.spindle_override_max = self.get_ini_info.get_max_spindle_override() - self.spindle_override_min = self.get_ini_info.get_min_spindle_override() + self.spindle_override_max = self.INI.MAX_SPINDLE_OVERRIDE/100 + self.spindle_override_min = self.INI.MIN_SPINDLE_OVERRIDE/100 self.feed_override_max = self.get_ini_info.get_max_feed_override() self.dro_actual = self.get_ini_info.get_position_feedback_actual() @@ -638,7 +638,7 @@ def _get_pref_data(self): # if there is a INI Entry for default spindle speed, we will use that one as default # but if there is a setting in our preference file, that one will beet the INI entry - default_spindle_speed = self.get_ini_info.get_default_spindle_speed() + default_spindle_speed = self.INI.DEFAULT_SPINDLE_0_SPEED self.spindle_start_rpm = self.prefs.getpref( 'spindle_start_rpm', default_spindle_speed, float ) self.kbd_height = self.prefs.getpref("kbd_height", 250, int) From 8576e7b40ff1ddecca11af00937c6bee75bbbefe Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Thu, 8 Jan 2026 14:17:19 +0100 Subject: [PATCH 02/14] gmoccapy: use MAX_FEED_OVERRIDE using qt_istat --- src/emc/usr_intf/gmoccapy/getiniinfo.py | 7 ------- src/emc/usr_intf/gmoccapy/gmoccapy.py | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/emc/usr_intf/gmoccapy/getiniinfo.py b/src/emc/usr_intf/gmoccapy/getiniinfo.py index 879d57d4b9f..ebc4888496f 100644 --- a/src/emc/usr_intf/gmoccapy/getiniinfo.py +++ b/src/emc/usr_intf/gmoccapy/getiniinfo.py @@ -278,13 +278,6 @@ def get_min_ang_jog_vel(self): LOG.warning("No MIN_ANGULAR_VELOCITY entry found in [DISPLAY] of INI file. Using default value of 0.1 degree / min.") return float(temp) - def get_max_feed_override(self): - temp = self.inifile.find("DISPLAY", "MAX_FEED_OVERRIDE") - if not temp: - temp = 1.0 - LOG.warning("No MAX_FEED_OVERRIDE entry found in [DISPLAY] of INI file") - return float(temp) - def get_embedded_tabs(self): # Check INI file for embed commands # NAME is used as the tab label if a notebook is used diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index 92a551b42b2..9c246f3eeb9 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -595,7 +595,7 @@ def _get_ini_data(self): self.spindle_override_max = self.INI.MAX_SPINDLE_OVERRIDE/100 self.spindle_override_min = self.INI.MIN_SPINDLE_OVERRIDE/100 - self.feed_override_max = self.get_ini_info.get_max_feed_override() + self.feed_override_max = self.INI.MAX_FEED_OVERRIDE/100 self.dro_actual = self.get_ini_info.get_position_feedback_actual() def _get_pref_data(self): From b999054cf3e7f1ed881710bd58a7ed6ce8cf1089 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Thu, 8 Jan 2026 14:23:32 +0100 Subject: [PATCH 03/14] gmoccapy: {MIN, MAX, DEFAULT}_ANGULAR_JOG_VEL from qt_istat --- src/emc/usr_intf/gmoccapy/getiniinfo.py | 24 ------------------------ src/emc/usr_intf/gmoccapy/gmoccapy.py | 6 +++--- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/emc/usr_intf/gmoccapy/getiniinfo.py b/src/emc/usr_intf/gmoccapy/getiniinfo.py index ebc4888496f..df369f14586 100644 --- a/src/emc/usr_intf/gmoccapy/getiniinfo.py +++ b/src/emc/usr_intf/gmoccapy/getiniinfo.py @@ -254,30 +254,6 @@ def get_max_jog_vel(self): LOG.warning("No MAX_LINEAR_VELOCITY entry found in [TRAJ] of INI file. Using default value of 600 units / min.") return float(temp) * 60 - def get_default_ang_jog_vel(self): - # get default angular jog velocity - temp = self.inifile.find("DISPLAY", "DEFAULT_ANGULAR_VELOCITY") - if not temp: - temp = 360.0 - LOG.warning("No DEFAULT_ANGULAR_VELOCITY entry found in [DISPLAY] of INI file. Using default value of 360 degree / min.") - return float(temp) - - def get_max_ang_jog_vel(self): - # get max angular velocity - temp = self.inifile.find("DISPLAY", "MAX_ANGULAR_VELOCITY") - if not temp: - temp = 3600.0 - LOG.warning("No MAX_ANGULAR_VELOCITY entry found in [DISPLAY] of INI file. Using default value of 3600 degree / min.") - return float(temp) - - def get_min_ang_jog_vel(self): - # get min angular velocity - temp = self.inifile.find("DISPLAY", "MIN_ANGULAR_VELOCITY") - if not temp: - temp = 0.1 - LOG.warning("No MIN_ANGULAR_VELOCITY entry found in [DISPLAY] of INI file. Using default value of 0.1 degree / min.") - return float(temp) - def get_embedded_tabs(self): # Check INI file for embed commands # NAME is used as the tab label if a notebook is used diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index 9c246f3eeb9..0dd46d7e84d 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -1828,9 +1828,9 @@ def _init_preferences(self): if not "a" in self.axis_list and not "b" in self.axis_list and not "c" in self.axis_list: self.widgets.spc_ang_jog_vel.hide() else: - self.widgets.spc_ang_jog_vel.set_property("min", self.get_ini_info.get_min_ang_jog_vel()) - self.widgets.spc_ang_jog_vel.set_property("max", self.get_ini_info.get_max_ang_jog_vel()) - self.widgets.spc_ang_jog_vel.set_value(self.get_ini_info.get_default_ang_jog_vel()) + self.widgets.spc_ang_jog_vel.set_property("min", self.INI.MIN_ANGULAR_JOG_VEL) + self.widgets.spc_ang_jog_vel.set_property("max", self.INI.MAX_ANGULAR_JOG_VEL) + self.widgets.spc_ang_jog_vel.set_value(self.INI.DEFAULT_ANGULAR_JOG_VEL) # ============================================================= # Dynamic tabs handling Start From 64a38f613eef3e5189474a634440d2bc0b10633e Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Sat, 17 Jan 2026 08:38:11 +0100 Subject: [PATCH 04/14] sample-configs/axis: move MIN_LINEAR_VELOCITY from TRAJ to DISPLAY There is no MIN_LINEAR_VELOCITY in the TRAJ section. --- configs/sim/axis/pentapod/pentapod.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/sim/axis/pentapod/pentapod.ini b/configs/sim/axis/pentapod/pentapod.ini index 943a62c0c2d..36d59c3b40d 100644 --- a/configs/sim/axis/pentapod/pentapod.ini +++ b/configs/sim/axis/pentapod/pentapod.ini @@ -17,6 +17,8 @@ PYVCP = panel.xml GEOMETRY = XYZ-AB INCREMENTS = 10 mm, 1 mm, 0.1 mm +MIN_LINEAR_VELOCITY = 0.100000 + [FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image PROGRAM_EXTENSION = .py Python Script @@ -61,7 +63,6 @@ CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 5.00 DEFAULT_LINEAR_VELOCITY = 50.000000 MAX_LINEAR_VELOCITY = 100.000000 -MIN_LINEAR_VELOCITY = 0.100000 DEFAULT_ANGULAR_VELOCITY = 1.000000 MAX_ANGULAR_VELOCITY = 10.000000 MIN_ANGULAR_VELOCITY = 0.100000 From 818b3aa00cfa601f32e635f57858c4365e73c0cc Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Sat, 17 Jan 2026 08:40:30 +0100 Subject: [PATCH 05/14] docs: remove [TRAJ] MIN_VELOCITY --- docs/src/config/ini-config.adoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/config/ini-config.adoc b/docs/src/config/ini-config.adoc index a186de18c05..3b981026cbe 100644 --- a/docs/src/config/ini-config.adoc +++ b/docs/src/config/ini-config.adoc @@ -312,9 +312,8 @@ See <> document for GMOCCAPY details. ==== * `DEFAULT_LINEAR_VELOCITY = .25` - The default velocity for linear jogs, in <> per second. -* `MIN_VELOCITY = .01` - The approximate lowest value the jog slider. +* `MIN_LINEAR_VELOCITY = .01` - The minimum velocity for linear jogs, in machine units per second. * `MAX_LINEAR_VELOCITY = 1.0` - The maximum velocity for linear jogs, in machine units per second. -* `MIN_LINEAR_VELOCITY = .01` - The approximate lowest value the jog slider. * `DEFAULT_ANGULAR_VELOCITY = .25` - The default velocity for angular jogs, in machine units per second. * `MIN_ANGULAR_VELOCITY = .01` - The approximate lowest value the angular jog slider. * `MAX_ANGULAR_VELOCITY = 1.0` - The maximum velocity for angular jogs, in machine units per second. From 46b013f4be63cfebcdb279277314617445d91f51 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Thu, 8 Jan 2026 14:56:31 +0100 Subject: [PATCH 06/14] gmoccapy: use spindle min, max and default directly from INI file (#3497) --- configs/sim/gmoccapy/gmoccapy.ini | 7 +- docs/src/gui/gmoccapy.adoc | 43 +++---- src/emc/usr_intf/gmoccapy/gmoccapy.glade | 156 +---------------------- src/emc/usr_intf/gmoccapy/gmoccapy.py | 27 +--- 4 files changed, 30 insertions(+), 203 deletions(-) diff --git a/configs/sim/gmoccapy/gmoccapy.ini b/configs/sim/gmoccapy/gmoccapy.ini index 4f085818d68..ae7b6545ca0 100644 --- a/configs/sim/gmoccapy/gmoccapy.ini +++ b/configs/sim/gmoccapy/gmoccapy.ini @@ -25,15 +25,16 @@ MAX_FEED_OVERRIDE = 1.5 MIN_SPINDLE_0_OVERRIDE = 0.5 MAX_SPINDLE_0_OVERRIDE = 1.2 -# Initial value for spindle speed +# Spindel start speed DEFAULT_SPINDLE_0_SPEED = 450 +# Scaling of spindle speed bar +MIN_SPINDLE_0_SPEED = 0 +MAX_SPINDLE_0_SPEED = 3000 # The following are not used, added here to suppress warnings (from qt_istat/logger). DEFAULT_LINEAR_VELOCITY = 35 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 234 -MIN_SPINDLE_0_SPEED = 0 -MAX_SPINDLE_0_SPEED = 3000 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/docs/src/gui/gmoccapy.adoc b/docs/src/gui/gmoccapy.adoc index 04b55058d73..dda5e80443a 100644 --- a/docs/src/gui/gmoccapy.adoc +++ b/docs/src/gui/gmoccapy.adoc @@ -110,9 +110,11 @@ So let us take a closer look at the INI file and what you need to include to use DISPLAY = gmoccapy PREFERENCE_FILE_PATH = gmoccapy_preferences MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +MIN_SPINDLE_0_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +DEFAULT_SPINDLE_0_SPEED = 500 +MIN_SPINDLE_0_SPEED = 0 +MAX_SPINDLE_0_SPEED = 3000 LATHE = 1 BACK_TOOL_LATHE = 1 PROGRAM_PREFIX = ../../nc_files/ @@ -135,10 +137,10 @@ If you only want to use one file for several machines, you need to include `PREF [NOTE] If no value is given, it will be set to 1.0. -- _MIN_SPINDLE_OVERRIDE = 0.5_ and _MAX_SPINDLE_OVERRIDE = 1.2_ - Will allow you to change the spindle override within a limit from 50% to 120%. +- _MIN_SPINDLE_0_OVERRIDE = 0.5_ and _MAX_SPINDLE_0_OVERRIDE = 1.2_ - Will allow you to change the spindle override within a limit from 80% to 120%. + [NOTE] -If no values are given, MIN will be set to 0.1 and MAX to 1.0. +If no values are given, MIN will be set to 0.5 and MAX to 1.0. - _LATHE = 1_ - Set the screen layout to control a lathe. - _BACK_TOOL_LATHE = 1_ - Is optional and will switch the X axis in a way you need for a back tool lathe. @@ -154,7 +156,14 @@ See also the <>. If not specified, GMOCCAPY will look in the following order for NGC files: First `linuxcnc/nc_files` and then the users home directory. -- _DEFAULT_SPINDLE_SPEED_ - Start value for <> if value not present in preferences file or file is not present. Will have no effect with valid preferences file. +- _DEFAULT_SPINDLE_0_SPEED_ - Sets the rpm to be used if the spindle is started and no S value has been set. Defaults to 200. +- _MIN_SPINDLE_0_SPEED_ - Sets the lower limit of the spindle bar shown in the spindle frame on the main screen. Defaults to 100. +- _MAX_SPINDLE_0_SPEED_ - Sets the upper limit of the spindle bar shown in the spindle frame on the main screen. Defaults to 2500. + +[NOTE] +It is no error giving values that didn't match the minimum and maximum speed of the spindle. +If you set _Spindle bar max_ to 2000 and your spindle makes 4000 RPM, only the bar level will be wrong on higher speeds than 2000 RPM. + - _MIN_ANGULAR_VELOCITY_ - Sets the minimal jog velocity of the machine for rotary axes. - _MAX_ANGULAR_VELOCITY_ - Sets the maximal jog velocity of the machine for rotary axes. @@ -500,9 +509,10 @@ DISPLAY = gmoccapy using these parameters: ---- Log level +VERBOSE -v DEBUG -d INFO -i -VERBOSE -v +WARNING -w ERROR -q ---- @@ -1298,25 +1308,6 @@ By default all scales are set using the calculation: (MAX - MIN)/100 ---- -[[gmoccapy-settings-spindle]] -.Spindle -* _Starting RPM_ - Sets the rpm to be used if the spindle is started and no S value has been set. -+ -[NOTE] -This value will be presetted according to your settings in `[DISPLAY] DEFAULT_SPINDLE_SPEED` of your INI file. -If you change the settings on the settings page, that value will be default from that moment, your INI file will not be modified. - -* _Spindle bar min_ and _Spindle bar max_ - Sets the limits of the spindle bar shown in the INFO frame on the main screen. -+ -==== -Default values are: + -MIN = 0 + -MAX = 6000 -==== -+ -[NOTE] -It is no error giving wrong values. -If you give a maximum of 2000 and your spindle makes 4000 RPM, only the bar level will be wrong on higher speeds than 2000 RPM. .Unlock options diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.glade b/src/emc/usr_intf/gmoccapy/gmoccapy.glade index 3ee17495c7d..5d0f686670b 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.glade +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.glade @@ -111,24 +111,6 @@ 100 1 - - 100000 - 6000 - 50 - - - - 20000 - 50 - - - - 50 - 20000 - 300 - 25 - - 1 100 @@ -5341,137 +5323,6 @@ to test your settings. 0 - - - True - False - 0.5 - - - - True - False - 6 - 6 - 5 - 5 - False - 2 - 3 - - - True - False - True - Starting RPM - 0 - - - 0 - 0 - - - - - True - False - True - Spindle bar min - 0 - - - 0 - 1 - - - - - True - False - True - Spindle bar max - 0 - - - 0 - 2 - - - - - True - True - - True - 1 - etched-in - False - False - adj_start_spindle_RPM - 1 - True - - - 1 - 0 - - - - - True - True - - True - 1 - etched-in - False - False - adj_spindle_bar_min - 1 - True - - - 1 - 1 - - - - - True - True - - True - 7 - 1 - etched-in - False - False - adj_spindle_bar_max - 1 - True - - - 1 - 2 - - - - - - - True - False - <b>Spindle</b> - True - - - - - False - True - 1 - - True @@ -5551,7 +5402,7 @@ to test your settings. False False - 2 + 1 @@ -5643,7 +5494,7 @@ to test your settings. False False - 3 + 2 @@ -5658,6 +5509,9 @@ to test your settings. + + + True diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index 0dd46d7e84d..a67c320537e 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -373,8 +373,6 @@ def __init__(self, argv): self.widgets["ntb_button"].show() # the velocity settings - self.widgets.adj_spindle_bar_min.set_value(self.min_spindle_rev) - self.widgets.adj_spindle_bar_max.set_value(self.max_spindle_rev) self.widgets.spindle_feedback_bar.set_property("min", float(self.min_spindle_rev)) self.widgets.spindle_feedback_bar.set_property("max", float(self.max_spindle_rev)) @@ -468,7 +466,6 @@ def __init__(self, argv): self.widgets.chk_toggle_readout.set_active(self.toggle_readout) - self.widgets.adj_start_spindle_RPM.set_value(self.spindle_start_rpm) self.widgets.gcode_view.set_editable(False) self.widgets.ntb_user_tabs.remove_page(0) @@ -626,8 +623,9 @@ def _get_pref_data(self): self.scale_rapid_override = self.prefs.getpref("scale_rapid_override", 1, float) # the velocity settings - self.min_spindle_rev = self.prefs.getpref("spindle_bar_min", 0.0, float) - self.max_spindle_rev = self.prefs.getpref("spindle_bar_max", 6000.0, float) + self.spindle_start_rpm = self.INI.DEFAULT_SPINDLE_0_SPEED + self.min_spindle_rev = self.INI.MIN_SPINDLE_0_SPEED + self.max_spindle_rev = self.INI.MAX_SPINDLE_0_SPEED self.turtle_jog_factor = self.prefs.getpref('turtle_jog_factor', 20, int) self.hide_turtle_jog_button = self.prefs.getpref("hide_turtle_jog_button", False, bool) @@ -636,10 +634,7 @@ def _get_pref_data(self): self.toggle_readout = self.prefs.getpref("toggle_readout", True, bool) - # if there is a INI Entry for default spindle speed, we will use that one as default - # but if there is a setting in our preference file, that one will beet the INI entry - default_spindle_speed = self.INI.DEFAULT_SPINDLE_0_SPEED - self.spindle_start_rpm = self.prefs.getpref( 'spindle_start_rpm', default_spindle_speed, float ) + self.spindle_start_rpm = self.INI.DEFAULT_SPINDLE_0_SPEED self.kbd_height = self.prefs.getpref("kbd_height", 250, int) self.kbd_width = self.prefs.getpref("kbd_width", 880, int) @@ -4520,20 +4515,6 @@ def on_spc_spindle_value_changed(self, widget, data=None): except: pass - def on_adj_start_spindle_RPM_value_changed(self, widget, data=None): - self.spindle_start_rpm = widget.get_value() - self.prefs.putpref("spindle_start_rpm", self.spindle_start_rpm, float) - - def on_adj_spindle_bar_min_value_changed(self, widget, data=None): - self.min_spindle_rev = widget.get_value() - self.prefs.putpref("spindle_bar_min", self.min_spindle_rev, float) - self.widgets.spindle_feedback_bar.set_property("min", self.min_spindle_rev) - - def on_adj_spindle_bar_max_value_changed(self, widget, data=None): - self.max_spindle_rev = widget.get_value() - self.prefs.putpref("spindle_bar_max", self.max_spindle_rev, float) - self.widgets.spindle_feedback_bar.set_property("max", self.max_spindle_rev) - # ========================================================= # Coolant an mist coolant button def on_tbtn_flood_toggled(self, widget, data=None): From 96ea4295a680c397ac4c14eeb386e6f6a077d75a Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Mon, 9 Feb 2026 21:29:50 +0100 Subject: [PATCH 07/14] gscreen: use DEFAULT_LINEAR_VELOCITY from DISPLAY instead TRAJ --- share/gscreen/skins/silverdragon/silverdragon_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/gscreen/skins/silverdragon/silverdragon_handler.py b/share/gscreen/skins/silverdragon/silverdragon_handler.py index 7cbb21be2b0..fe3e0d9cbaf 100644 --- a/share/gscreen/skins/silverdragon/silverdragon_handler.py +++ b/share/gscreen/skins/silverdragon/silverdragon_handler.py @@ -201,7 +201,7 @@ def initialize_preferences(self): default_spindle_speed = self.gscreen.inifile.find("DISPLAY", "DEFAULT_SPINDLE_SPEED") self.spindle_start_rpm = self.gscreen.prefs.getpref( 'spindle_start_rpm', default_spindle_speed, float ) # get the values for the sliders - default_jog_vel = float(self.gscreen.inifile.find("TRAJ", "DEFAULT_LINEAR_VELOCITY")) + default_jog_vel = float(self.gscreen.inifile.find("DISPLAY", "DEFAULT_LINEAR_VELOCITY")) self.fast_jog = default_jog_vel self.slow_jog = default_jog_vel / self.slow_jog_factor self.jog_rate_max = self.gscreen.inifile.find("TRAJ", "MAX_LINEAR_VELOCITY") From a4d43191fd6eb70b2dafc7e59dc2399b00814cb0 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Mon, 2 Feb 2026 22:27:25 +0100 Subject: [PATCH 08/14] gmoccapy: DEFAULT_LINEAR_VELOCITY + MAX_LINEAR_VELOCITY from qt_istat (TRAJ --> DISPLAY) --- src/emc/usr_intf/gmoccapy/getiniinfo.py | 23 ----------------------- src/emc/usr_intf/gmoccapy/gmoccapy.py | 4 ++-- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/emc/usr_intf/gmoccapy/getiniinfo.py b/src/emc/usr_intf/gmoccapy/getiniinfo.py index df369f14586..86c01453678 100644 --- a/src/emc/usr_intf/gmoccapy/getiniinfo.py +++ b/src/emc/usr_intf/gmoccapy/getiniinfo.py @@ -231,29 +231,6 @@ def get_lathe_wear_offsets(self): return False return True - def get_jog_vel(self): - # get default jog velocity - # must convert from INI's units per second to gmoccapy's units per minute - temp = self.inifile.find("TRAJ", "DEFAULT_LINEAR_VELOCITY") - if not temp: - temp = self.inifile.find("TRAJ", "MAX_LINEAR_VELOCITY" ) - if temp: - temp = float(temp) / 2 - LOG.warning("No DEFAULT_LINEAR_VELOCITY entry found in [TRAJ] of INI file. Using half on MAX_LINEAR_VELOCITY.") - else: - temp = 3.0 - LOG.warning("No DEFAULT_LINEAR_VELOCITY entry found in [TRAJ] of INI file. Using default value of 180 units / min.") - return float(temp) * 60 - - def get_max_jog_vel(self): - # get max jog velocity - # must convert from INI's units per second to gmoccapy's units per minute - temp = self.inifile.find("TRAJ", "MAX_LINEAR_VELOCITY") - if not temp: - temp = 10.0 - LOG.warning("No MAX_LINEAR_VELOCITY entry found in [TRAJ] of INI file. Using default value of 600 units / min.") - return float(temp) * 60 - def get_embedded_tabs(self): # Check INI file for embed commands # NAME is used as the tab label if a notebook is used diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index a67c320537e..3e0588d4716 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -587,8 +587,8 @@ def _get_ini_data(self): self.no_force_homing = self.get_ini_info.get_no_force_homing() # get the values for the sliders - self.rabbit_jog = self.get_ini_info.get_jog_vel() - self.jog_rate_max = self.get_ini_info.get_max_jog_vel() + self.rabbit_jog = self.INI.DEFAULT_LINEAR_JOG_VEL + self.jog_rate_max = self.INI.MAX_LINEAR_JOG_VEL self.spindle_override_max = self.INI.MAX_SPINDLE_OVERRIDE/100 self.spindle_override_min = self.INI.MIN_SPINDLE_OVERRIDE/100 From 96b81d16f5d0239198bf873829d01a82f1ce84ad Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Tue, 27 Jan 2026 21:44:54 +0100 Subject: [PATCH 09/14] gmoccapy: change SPINDLE => SPINDLE_0 in *.ini files --- configs/sim/gmoccapy/6_axis.ini | 9 +++++---- configs/sim/gmoccapy/7_axis.ini | 9 +++++---- configs/sim/gmoccapy/7_axis_tool.ini | 9 +++++---- configs/sim/gmoccapy/8_axis.ini | 9 +++++---- configs/sim/gmoccapy/9_axis.ini | 7 ++++--- configs/sim/gmoccapy/gmoccapy.ini | 2 +- configs/sim/gmoccapy/gmoccapy_4_axis.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_800x600.ini | 8 +++++--- configs/sim/gmoccapy/gmoccapy_XYZAB.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_XYZAC.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_XYZCW.ini | 9 ++++++--- configs/sim/gmoccapy/gmoccapy_blockdelete.ini | 8 +++++--- configs/sim/gmoccapy/gmoccapy_left_panel.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_messages.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_pedant.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_pyngcgui.ini | 8 +++++--- configs/sim/gmoccapy/gmoccapy_pyngcgui_gcmc.ini | 8 +++++--- configs/sim/gmoccapy/gmoccapy_qt_messages.ini | 8 +++++--- configs/sim/gmoccapy/gmoccapy_right_panel.ini | 7 +++++-- .../gmoccapy/gmoccapy_sim_hardware_button.ini | 7 +++++-- configs/sim/gmoccapy/gmoccapy_tool_sensor.ini | 7 ++++--- .../sim/gmoccapy/gmoccapy_with_user_tabs.ini | 7 +++++-- src/emc/usr_intf/pncconf/build_INI.py | 17 ++++++++++++++++- 23 files changed, 121 insertions(+), 60 deletions(-) diff --git a/configs/sim/gmoccapy/6_axis.ini b/configs/sim/gmoccapy/6_axis.ini index 4a1a0179f8c..77f288f9a61 100644 --- a/configs/sim/gmoccapy/6_axis.ini +++ b/configs/sim/gmoccapy/6_axis.ini @@ -1,6 +1,6 @@ [EMC] VERSION = 1.1 -MACHINE = gmoccapy_9_axis +MACHINE = gmoccapy_6_axis DEBUG = 0 [DISPLAY] @@ -15,10 +15,11 @@ GEOMETRY = XYZABC # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 500 # list of selectable jog increments INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm ,1.2345 in diff --git a/configs/sim/gmoccapy/7_axis.ini b/configs/sim/gmoccapy/7_axis.ini index e5d25e7fddb..7a3eab53627 100644 --- a/configs/sim/gmoccapy/7_axis.ini +++ b/configs/sim/gmoccapy/7_axis.ini @@ -1,6 +1,6 @@ [EMC] VERSION = 1.1 -MACHINE = gmoccapy_9_axis +MACHINE = gmoccapy_7_axis DEBUG = 0 [DISPLAY] @@ -15,10 +15,11 @@ GEOMETRY = XYZABCUVW # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 500 # list of selectable jog increments INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm ,1.2345 in diff --git a/configs/sim/gmoccapy/7_axis_tool.ini b/configs/sim/gmoccapy/7_axis_tool.ini index 62c9b2578a3..2cf7737448c 100644 --- a/configs/sim/gmoccapy/7_axis_tool.ini +++ b/configs/sim/gmoccapy/7_axis_tool.ini @@ -1,6 +1,6 @@ [EMC] VERSION = 1.1 -MACHINE = gmoccapy_9_axis +MACHINE = gmoccapy_7_axis_tool DEBUG = 0 [DISPLAY] @@ -15,10 +15,11 @@ GEOMETRY = XYZABCUVW # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 500 # list of selectable jog increments INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm ,1.2345 in diff --git a/configs/sim/gmoccapy/8_axis.ini b/configs/sim/gmoccapy/8_axis.ini index bbfd5b65dde..93f72294e45 100644 --- a/configs/sim/gmoccapy/8_axis.ini +++ b/configs/sim/gmoccapy/8_axis.ini @@ -1,6 +1,6 @@ [EMC] VERSION = 1.1 -MACHINE = gmoccapy_9_axis +MACHINE = gmoccapy_8_axis DEBUG = 0 [DISPLAY] @@ -15,10 +15,11 @@ GEOMETRY = XYZABCUVW # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 500 # list of selectable jog increments INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm ,1.2345 in diff --git a/configs/sim/gmoccapy/9_axis.ini b/configs/sim/gmoccapy/9_axis.ini index 33fac9bce8d..9d099d0bfbd 100644 --- a/configs/sim/gmoccapy/9_axis.ini +++ b/configs/sim/gmoccapy/9_axis.ini @@ -15,10 +15,11 @@ GEOMETRY = XYZABCUVW # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 -DEFAULT_SPINDLE_SPEED = 500 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 500 # list of selectable jog increments INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm ,1.2345 in diff --git a/configs/sim/gmoccapy/gmoccapy.ini b/configs/sim/gmoccapy/gmoccapy.ini index ae7b6545ca0..00369f55048 100644 --- a/configs/sim/gmoccapy/gmoccapy.ini +++ b/configs/sim/gmoccapy/gmoccapy.ini @@ -25,7 +25,7 @@ MAX_FEED_OVERRIDE = 1.5 MIN_SPINDLE_0_OVERRIDE = 0.5 MAX_SPINDLE_0_OVERRIDE = 1.2 -# Spindel start speed +# Spindle start speed DEFAULT_SPINDLE_0_SPEED = 450 # Scaling of spindle speed bar MIN_SPINDLE_0_SPEED = 0 diff --git a/configs/sim/gmoccapy/gmoccapy_4_axis.ini b/configs/sim/gmoccapy/gmoccapy_4_axis.ini index b973e378abc..5a71cc16986 100644 --- a/configs/sim/gmoccapy/gmoccapy_4_axis.ini +++ b/configs/sim/gmoccapy/gmoccapy_4_axis.ini @@ -13,8 +13,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_800x600.ini b/configs/sim/gmoccapy/gmoccapy_800x600.ini index 5a9b34ad964..a6f990e2967 100644 --- a/configs/sim/gmoccapy/gmoccapy_800x600.ini +++ b/configs/sim/gmoccapy/gmoccapy_800x600.ini @@ -22,14 +22,16 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 DEFAULT_LINEAR_VELOCITY = 100 MAX_ANGULAR_VELOCITY = 234 -DEFAULT_SPINDLE_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_XYZAB.ini b/configs/sim/gmoccapy/gmoccapy_XYZAB.ini index ece32763792..b587bb6f7d1 100644 --- a/configs/sim/gmoccapy/gmoccapy_XYZAB.ini +++ b/configs/sim/gmoccapy/gmoccapy_XYZAB.ini @@ -35,8 +35,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 diff --git a/configs/sim/gmoccapy/gmoccapy_XYZAC.ini b/configs/sim/gmoccapy/gmoccapy_XYZAC.ini index 3d14c60f6d4..ad73764445c 100644 --- a/configs/sim/gmoccapy/gmoccapy_XYZAC.ini +++ b/configs/sim/gmoccapy/gmoccapy_XYZAC.ini @@ -26,8 +26,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 diff --git a/configs/sim/gmoccapy/gmoccapy_XYZCW.ini b/configs/sim/gmoccapy/gmoccapy_XYZCW.ini index 9b7753ebde5..22f0c181998 100644 --- a/configs/sim/gmoccapy/gmoccapy_XYZCW.ini +++ b/configs/sim/gmoccapy/gmoccapy_XYZCW.ini @@ -9,7 +9,7 @@ [EMC] VERSION = 1.1 -MACHINE = gmoccapy XYZAB +MACHINE = gmoccapy XYZCW DEBUG = 0 #DEBUG = 0x7FFFFFFF @@ -22,8 +22,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 diff --git a/configs/sim/gmoccapy/gmoccapy_blockdelete.ini b/configs/sim/gmoccapy/gmoccapy_blockdelete.ini index e2a5f011892..bdaae76f8ee 100644 --- a/configs/sim/gmoccapy/gmoccapy_blockdelete.ini +++ b/configs/sim/gmoccapy/gmoccapy_blockdelete.ini @@ -22,14 +22,16 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 DEFAULT_LINEAR_VELOCITY = 100 MAX_ANGULAR_VELOCITY = 234 -DEFAULT_SPINDLE_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_left_panel.ini b/configs/sim/gmoccapy/gmoccapy_left_panel.ini index dd1b3fc1d46..94605836e6e 100644 --- a/configs/sim/gmoccapy/gmoccapy_left_panel.ini +++ b/configs/sim/gmoccapy/gmoccapy_left_panel.ini @@ -22,8 +22,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_messages.ini b/configs/sim/gmoccapy/gmoccapy_messages.ini index 75e5b3fc624..2659cc50be0 100644 --- a/configs/sim/gmoccapy/gmoccapy_messages.ini +++ b/configs/sim/gmoccapy/gmoccapy_messages.ini @@ -18,8 +18,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 diff --git a/configs/sim/gmoccapy/gmoccapy_pedant.ini b/configs/sim/gmoccapy/gmoccapy_pedant.ini index 4aa3bae6131..f3de21cf168 100644 --- a/configs/sim/gmoccapy/gmoccapy_pedant.ini +++ b/configs/sim/gmoccapy/gmoccapy_pedant.ini @@ -22,8 +22,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = /home/emcmesa/linuxcnc/nc_files diff --git a/configs/sim/gmoccapy/gmoccapy_pyngcgui.ini b/configs/sim/gmoccapy/gmoccapy_pyngcgui.ini index 4f75fb037e5..1fae0a0460d 100644 --- a/configs/sim/gmoccapy/gmoccapy_pyngcgui.ini +++ b/configs/sim/gmoccapy/gmoccapy_pyngcgui.ini @@ -50,14 +50,16 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 DEFAULT_LINEAR_VELOCITY = 100 MAX_ANGULAR_VELOCITY = 234 -DEFAULT_SPINDLE_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_pyngcgui_gcmc.ini b/configs/sim/gmoccapy/gmoccapy_pyngcgui_gcmc.ini index d851a17db41..a306a87f390 100644 --- a/configs/sim/gmoccapy/gmoccapy_pyngcgui_gcmc.ini +++ b/configs/sim/gmoccapy/gmoccapy_pyngcgui_gcmc.ini @@ -62,14 +62,16 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 DEFAULT_LINEAR_VELOCITY = 100 MAX_ANGULAR_VELOCITY = 234 -DEFAULT_SPINDLE_SPEED = 450 # Introductory graphic INTRO_GRAPHIC = linuxcnc.gif diff --git a/configs/sim/gmoccapy/gmoccapy_qt_messages.ini b/configs/sim/gmoccapy/gmoccapy_qt_messages.ini index 40080dea6c0..273989cf407 100644 --- a/configs/sim/gmoccapy/gmoccapy_qt_messages.ini +++ b/configs/sim/gmoccapy/gmoccapy_qt_messages.ini @@ -22,14 +22,16 @@ CYCLE_TIME = 100 # Values that will be allowed for override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = 0.5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = 0.5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Max and default jog speeds in units per second MAX_LINEAR_VELOCITY = 166 DEFAULT_LINEAR_VELOCITY = 100 MAX_ANGULAR_VELOCITY = 234 -DEFAULT_SPINDLE_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_right_panel.ini b/configs/sim/gmoccapy/gmoccapy_right_panel.ini index 2b7c12274c0..ccfac581b84 100644 --- a/configs/sim/gmoccapy/gmoccapy_right_panel.ini +++ b/configs/sim/gmoccapy/gmoccapy_right_panel.ini @@ -18,8 +18,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_sim_hardware_button.ini b/configs/sim/gmoccapy/gmoccapy_sim_hardware_button.ini index b7923090091..9fbb1fc2d27 100644 --- a/configs/sim/gmoccapy/gmoccapy_sim_hardware_button.ini +++ b/configs/sim/gmoccapy/gmoccapy_sim_hardware_button.ini @@ -25,8 +25,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_tool_sensor.ini b/configs/sim/gmoccapy/gmoccapy_tool_sensor.ini index 37daf107549..588ced46485 100644 --- a/configs/sim/gmoccapy/gmoccapy_tool_sensor.ini +++ b/configs/sim/gmoccapy/gmoccapy_tool_sensor.ini @@ -30,10 +30,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 -DEFAULT_SPINDLE_SPEED = 450 +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../../nc_files/ diff --git a/configs/sim/gmoccapy/gmoccapy_with_user_tabs.ini b/configs/sim/gmoccapy/gmoccapy_with_user_tabs.ini index fcbd5a6f0d4..cd0fd5d670c 100644 --- a/configs/sim/gmoccapy/gmoccapy_with_user_tabs.ini +++ b/configs/sim/gmoccapy/gmoccapy_with_user_tabs.ini @@ -42,8 +42,11 @@ CYCLE_TIME = 100 # Highest value that will be allowed for feed override, 1.0 = 100% MAX_FEED_OVERRIDE = 1.5 -MAX_SPINDLE_OVERRIDE = 1.2 -MIN_SPINDLE_OVERRIDE = .5 +MAX_SPINDLE_0_OVERRIDE = 1.2 +MIN_SPINDLE_0_OVERRIDE = .5 + +# Start value for spindle speed +DEFAULT_SPINDLE_0_SPEED = 450 # Prefix to be used PROGRAM_PREFIX = ../../nc_files/ diff --git a/src/emc/usr_intf/pncconf/build_INI.py b/src/emc/usr_intf/pncconf/build_INI.py index 7e945dc18be..93669af8abf 100644 --- a/src/emc/usr_intf/pncconf/build_INI.py +++ b/src/emc/usr_intf/pncconf/build_INI.py @@ -91,12 +91,17 @@ def write_inifile(self, base): if self.d.position_feedback == 1: temp ="ACTUAL" else: temp = "COMMANDED" print("POSITION_FEEDBACK = %s"% temp, file=file) + print(file=file) + print("# Highest value that will be allowed for feed override, 1.0 = 100%", file=file) print("MAX_FEED_OVERRIDE = %f"% self.d.max_feed_override, file=file) - if self.d.frontend == _PD._QTDRAGON: + if self.d.frontend == _PD._QTDRAGON or self.d.frontend == _PD._GMOCCAPY: print("MAX_SPINDLE_0_OVERRIDE = %f"% self.d.max_spindle_override, file=file) print("MIN_SPINDLE_0_OVERRIDE = %f"% self.d.min_spindle_override, file=file) + print(file=file) + print("# Spindle start speed", file=file) print("DEFAULT_SPINDLE_0_SPEED = 500", file=file) + print(file=file) print("MIN_SPINDLE_0_SPEED = 100", file=file) print("MAX_SPINDLE_0_SPEED = 2500", file=file) # qtplasmac doesn't use spindle override @@ -104,13 +109,20 @@ def write_inifile(self, base): print("MAX_SPINDLE_OVERRIDE = %f"% self.d.max_spindle_override, file=file) print("MIN_SPINDLE_OVERRIDE = %f"% self.d.min_spindle_override, file=file) + print(file=file) + print("# Introductory graphic", file=file) print("INTRO_GRAPHIC = linuxcnc.gif", file=file) print("INTRO_TIME = 5", file=file) + print(file=file) + print("# Prefix to be used", file=file) print("PROGRAM_PREFIX = %s" % \ os.path.expanduser("~/linuxcnc/nc_files"), file=file) + print(file=file) if self.d.pyvcp: print("PYVCP = pyvcp-panel.xml", file=file) + print(file=file) # these are for AXIS GUI and QtPlasmaC + print("# list of selectable jog increments", file=file) if self.d.units == _PD._METRIC: if self.d.frontend == _PD._QTPLASMAC: print("INCREMENTS = %s"% self.d.increments_metric_qtplasmac, file=file) @@ -121,6 +133,7 @@ def write_inifile(self, base): print("INCREMENTS = %s"% self.d.increments_imperial_qtplasmac, file=file) else: print("INCREMENTS = %s"% self.d.increments_imperial, file=file) + print(file=file) if self.d.axes == 2: print("LATHE = 1", file=file) print("POSITION_FEEDBACK = %s"% temp, file=file) @@ -134,6 +147,8 @@ def write_inifile(self, base): if self.d.frontend != _PD._QTPLASMAC: print("EDITOR = %s"% self.d.editor, file=file) print("GEOMETRY = %s"% self.d.geometry, file=file) + print(file=file) + print("# Cycle time, in milliseconds, that display will sleep between polls", file=file) print("CYCLE_TIME = 100", file=file) # set up MDI macro buttons From f6ccc63e102ab2828024073314b8075c1004b587 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Wed, 4 Feb 2026 12:27:14 +0100 Subject: [PATCH 10/14] update_ini: basic steps for updating 1.1 -> 1.2 --- scripts/linuxcnc.in | 2 +- src/emc/ini/update_ini.py | 167 +++++++++++++++++++++++++++----------- 2 files changed, 120 insertions(+), 49 deletions(-) diff --git a/scripts/linuxcnc.in b/scripts/linuxcnc.in index 7b1150204a1..0c2dc0b30f7 100644 --- a/scripts/linuxcnc.in +++ b/scripts/linuxcnc.in @@ -519,7 +519,7 @@ function GetFromIniEx { # 2.1.5 check version GetFromIni VERSION EMC -if [ "$retval" != "1.1" ]; then +if [ "$retval" != "1.2" ]; then if [ -z "$DISPLAY" ]; then echo "INI file [EMC]VERSION indicates update is needed, but the update GUI can't run without an X display" exit 1 diff --git a/src/emc/ini/update_ini.py b/src/emc/ini/update_ini.py index 5ddc9ec2206..0d4264f2c9e 100755 --- a/src/emc/ini/update_ini.py +++ b/src/emc/ini/update_ini.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -THIS_VERSION = "1.1" +THIS_VERSION = "1.2" import sys import os @@ -21,7 +21,7 @@ def copysection(block): newini.write(section.group(1)) all_sections.remove(block) else: - newini.write("\n#No Content\n") + newini.write("\n#No Content\n") def writeifexists(file, section, src_item, dest_item = "None"): #Writes a new entry to the file, but only if it exists @@ -62,25 +62,6 @@ def writeifexists(file, section, src_item, dest_item = "None"): print(t) exit() -if dialogs: - ret = messagebox._show("Confirm automatic update", - "This version of LinuxCNC separates the concepts of Axes and " - "Joints which necessitates changes to the INI and HAL files. " - "The changes required are described here:\n" - "http://linuxcnc.org/docs/2.9/html/ in the section " - "'Getting Started with LinuxCNC' -> 'Updating LinuxCNC'\n" - "The [EMC]VERSION data in your INI file indicates that your " - "configuration requires update.\n" - "A script exists that can attempt to automatically " - "reconfigure your configuration files.\nPress 'Yes' to perform " - "the conversion, 'No' to continue with the current configuration " - "files or 'Cancel' to exit LinuxCNC.\n" - "The process can not be automatically reversed, though a " - "backup version of your entire existing config will be created.", - messagebox.QUESTION, messagebox.YESNOCANCEL) - if ret == 'cancel': exit(42) - elif ret == 'no': exit(0) - # We want to work with the base INI file here, not the expanded version if #include is used filename = re.sub(r'\.expanded', '', filename) @@ -109,20 +90,44 @@ def writeifexists(file, section, src_item, dest_item = "None"): print(t) exit() -if ini.find('KINS', 'JOINTS') and not force and not version == "1.0": - if dialogs: - if messagebox.askquestion("Already Converted", - "The supplied INI file already has a [KINS] section. this probably " - "means that it was previously converted by hand. Continue conversion?" - "(Change [EMC]VERSION to %s to suppress these messages) " - % THIS_VERSION) != 'yes': - exit(0) - else: - if input("The supplied INI file already has a [KINS] section." - "this probably means that it was previously converted by hand. " - "Continue y/N? (Change [EMC]VERSION to %s to suppress these messages) " - % THIS_VERSION) != "y": - exit(0) +# Show start message with abort option +if dialogs: + ret = '' + if version == "1.0": + ret = messagebox._show("Confirm automatic update", + "This version of LinuxCNC separates the concepts of Axes and " + "Joints which necessitates changes to the INI and HAL files. " + "The changes required are described here:\n" + "http://linuxcnc.org/docs/2.9/html/ in the section " + "'Getting Started with LinuxCNC' -> 'Updating LinuxCNC'\n" + "The [EMC]VERSION data in your INI file indicates that your " + "configuration requires update.\n" + "A script exists that can attempt to automatically " + "reconfigure your configuration files.\nPress 'Yes' to perform " + "the conversion, 'No' to continue with the current configuration " + "files or 'Cancel' to exit LinuxCNC.\n" + "The process can not be automatically reversed, though a " + "backup version of your entire existing config will be created.", + messagebox.QUESTION, messagebox.YESNOCANCEL) + if ret == 'cancel': exit(42) + elif ret == 'no': exit(0) + +# Version specific message +if version == "1.0": + if ini.find('KINS', 'JOINTS') and not force and not version == "1.0": + if dialogs: + if messagebox.askquestion("Already Converted", + "The supplied INI file already has a [KINS] section. This probably " + "means that it was previously converted by hand. Continue conversion?" + "(Change [EMC]VERSION to %s to suppress these messages) " + % THIS_VERSION) != 'yes': + exit(0) + else: + if input("The supplied INI file already has a [KINS] section." + "This probably means that it was previously converted by hand. " + "Continue y/N? (Change [EMC]VERSION to %s to suppress these messages) " + % THIS_VERSION) != "y": + exit(0) # Looks like we are good to go, so first let's put the original configs # somewhere safe. @@ -165,16 +170,14 @@ def writeifexists(file, section, src_item, dest_item = "None"): print("halpaths = ", halpaths) -if version == "1.0": - #Just update the version in the INI - inistring = open(filename,'r').read() - newini = open(filename, 'w') - inistring = re.sub("VERSION *= *(.*)", "VERSION = %s" % THIS_VERSION, inistring) - newini.write(inistring) - newini.close() +########################################### +############ Convert INI files ############ +########################################### -if version == "$Revision$" or version < "1.0": - +def ini_preamble(): + """ + The part which is equal for the conversions up from version 1.1 + """ inistring = open(filename,'r').read() newini = open(filename, 'w') # Get a list of all sections @@ -198,7 +201,7 @@ def writeifexists(file, section, src_item, dest_item = "None"): all_sections.remove("EMC") section = re.search(r"\[EMC\](.+?)\n\[", inistring, re.DOTALL) if section: section = section.group(1) - newini.write("[EMC]\n") + newini.write("[EMC]") if section != None: if version != "0.0": section = re.sub("VERSION (.+)", "VERSION = %s" % THIS_VERSION, section) @@ -209,6 +212,18 @@ def writeifexists(file, section, src_item, dest_item = "None"): else: newini.write("VERSION = %s\n" % THIS_VERSION) + return inistring, newini, all_sections + +if version == "1.0": + #Just update the version in the INI + inistring = open(filename,'r').read() + newini = open(filename, 'w') + inistring = re.sub("VERSION *= *(.*)", "VERSION = %s" % THIS_VERSION, inistring) + newini.write(inistring) + newini.close() + +if version == "$Revision$" or version < "1.0": + inistring, newini, all_sections = ini_preamble() #These sections don't need any work. copysection("DISPLAY") copysection("FILTER") @@ -416,11 +431,67 @@ def writeifexists(file, section, src_item, dest_item = "None"): #That's the INI file done: newini.close() +if version < "1.2": + inistring, newini, all_sections = ini_preamble() + + all_sections.remove("DISPLAY") + section = re.search(r"\[DISPLAY\](.+?)\n\[", inistring, re.DOTALL) + if section: section = section.group(1) + newini.write("\n[DISPLAY]\n") + if section != None: + if re.search("MIN_SPINDLE_OVERRIDE", section): + section = re.sub("MIN_SPINDLE_OVERRIDE", "MIN_SPINDLE_0_OVERRIDE", section) + if re.search("MAX_SPINDLE_OVERRIDE", section): + section = re.sub("MAX_SPINDLE_OVERRIDE", "MAX_SPINDLE_0_OVERRIDE", section) + if re.search("DEFAULT_SPINDLE_SPEED", section): + section = re.sub("DEFAULT_SPINDLE_SPEED", "DEFAULT_SPINDLE_0_SPEED", section) + if re.search("MIN_SPINDLE_SPEED", section): + section = re.sub("MIN_SPINDLE_SPEED", "MIN_SPINDLE_0_SPEED", section) + if re.search("MAX_SPINDLE_SPEED", section): + section = re.sub("MAX_SPINDLE_SPEED", "MAX_SPINDLE_0_SPEED", section) + if re.search("MIN_VELOCITY", section): + section = re.sub("MIN_VELOCITY", "MIN_LINEAR_VELOCITY", section) + newini.write(section) + + # TODO update-ini 1.1 --> 1.2: + # + # [DISPLAY] + # MIN_SPINDLE_OVERRIDE -> MIN_SPINDLE_0_OVERRIDE + # MAX_SPINDLE_OVERRIDE -> MAX_SPINDLE_0_OVERRIDE + # DEFAULT_SPINDLE_SPEED -> DEFAULT_SPINDLE_0_SPEED + # MIN_SPINDLE_SPEED -> MIN_SPINDLE_0_SPEED + # MAX_SPINDLE_SPEED -> MAX_SPINDLE_0_SPEED + # + # copy [TRAJ]DEFAULT_LINEAR_VELOCITY -> [DISPLAY]DEFAULT_LINEAR_VELOCITY + # move [TRAJ]MIN_LINEAR_VELOCITY -> [DISPLAY]MIN_LINEAR_VELOCITY + # rename [TRAJ, DISPLAY]MIN_VELOCITY --> MIN_LINEAR_VELOCITY + # copy [TRAJ]MAX_LINEAR_VELOCITY -> [DISPLAY]MAX_LINEAR_VELOCITY + + #These sections don't need any work. + copysection("FILTER") + copysection("RS274NGC") + copysection("PYTHON") + copysection("EMCMOT") + copysection("TASK") + copysection("HAL") + copysection("HALUI") + copysection("TRAJ") + copysection("EMCIO") + + # If there were any custom sections, tag them on the end. + while all_sections: + copysection(all_sections[0]) + + #That's the INI file done: + newini.close() - # Now change all the pin names etc in the linked HAL files. - # Any machine can be jogged in world mode (in theory) but joint-mode jog-enable - # is not auto-linked for safety. +########################################### +############ Convert HAL files ############ +########################################### +# Now change all the pin names etc in the linked HAL files. +# Any machine can be jogged in world mode (in theory) +# but joint-mode jog-enable is not auto-linked for safety. if version == "$Revision$" or version < "1.0": From 76b1dddc8121c1c5a82c899f21b1e7090998332b Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Wed, 4 Feb 2026 14:13:47 +0100 Subject: [PATCH 11/14] update_ini: fix keep emtpy lines at the end of a section --- src/emc/ini/update_ini.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/emc/ini/update_ini.py b/src/emc/ini/update_ini.py index 0d4264f2c9e..5d7a4988828 100755 --- a/src/emc/ini/update_ini.py +++ b/src/emc/ini/update_ini.py @@ -14,14 +14,14 @@ def copysection(block): #Just makes a straight copy of blocks that don't need any work - regex = r"^\s*\[%s\](.+?)(?:^\s*\[|\Z)" % block - section = re.search(regex, inistring, re.M | re.DOTALL) - newini.write("\n[%s]" % block) - if section != None: + regex = r"^\s*\[%s\](\n(?:^(?!\[).*\n?)*)" % block + section = re.search(regex, inistring, re.M) + newini.write("[%s]" % block) + if section is not None: newini.write(section.group(1)) all_sections.remove(block) else: - newini.write("\n#No Content\n") + newini.write("\n#No Content\n\n") def writeifexists(file, section, src_item, dest_item = "None"): #Writes a new entry to the file, but only if it exists @@ -435,9 +435,10 @@ def ini_preamble(): inistring, newini, all_sections = ini_preamble() all_sections.remove("DISPLAY") - section = re.search(r"\[DISPLAY\](.+?)\n\[", inistring, re.DOTALL) + section = re.search(r"\[DISPLAY\](.+?\n)(?=\[)", inistring, re.DOTALL) + if section: section = section.group(1) - newini.write("\n[DISPLAY]\n") + newini.write("\n[DISPLAY]") if section != None: if re.search("MIN_SPINDLE_OVERRIDE", section): section = re.sub("MIN_SPINDLE_OVERRIDE", "MIN_SPINDLE_0_OVERRIDE", section) From 0cab09c15e5d30c4cd455e5f3d49ca622ab02042 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Mon, 9 Feb 2026 00:38:31 +0100 Subject: [PATCH 12/14] update_ini: fix/improve regex for finding the DISPLAY section --- src/emc/ini/update_ini.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emc/ini/update_ini.py b/src/emc/ini/update_ini.py index 5d7a4988828..fea6a4716f4 100755 --- a/src/emc/ini/update_ini.py +++ b/src/emc/ini/update_ini.py @@ -435,7 +435,7 @@ def ini_preamble(): inistring, newini, all_sections = ini_preamble() all_sections.remove("DISPLAY") - section = re.search(r"\[DISPLAY\](.+?\n)(?=\[)", inistring, re.DOTALL) + section = re.search(r"(?:^|\n)[ \t]*(?!#)\[DISPLAY\](.+?\n)(?=\[|$)", inistring, re.DOTALL) if section: section = section.group(1) newini.write("\n[DISPLAY]") @@ -467,7 +467,7 @@ def ini_preamble(): # move [TRAJ]MIN_LINEAR_VELOCITY -> [DISPLAY]MIN_LINEAR_VELOCITY # rename [TRAJ, DISPLAY]MIN_VELOCITY --> MIN_LINEAR_VELOCITY # copy [TRAJ]MAX_LINEAR_VELOCITY -> [DISPLAY]MAX_LINEAR_VELOCITY - + #These sections don't need any work. copysection("FILTER") copysection("RS274NGC") From c9ac34bc3da41aa0a3a2ccb2d62ef7840cdc1671 Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Sat, 7 Feb 2026 20:22:37 +0100 Subject: [PATCH 13/14] update_ini: copy values from TRAJ to DISPLAY --- src/emc/ini/update_ini.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/emc/ini/update_ini.py b/src/emc/ini/update_ini.py index fea6a4716f4..50e8f4ce110 100755 --- a/src/emc/ini/update_ini.py +++ b/src/emc/ini/update_ini.py @@ -28,6 +28,17 @@ def writeifexists(file, section, src_item, dest_item = "None"): if dest_item == 'None': dest_item = src_item val = ini.find(section, src_item) if val: file.write("%s = %s\n" % (dest_item, val)) + +def insert_after(key, new_line, section): + match = re.search(key, section) + if match: + # Find the end of the line that contains the match + line_end = section.find("\n", match.end()) + if line_end == -1: line_end = len(section) # match is on the last line + else: + line_end = len(section) # place it at the end + new_line += "\n" + return section[:line_end + 1] + new_line + section[line_end + 1:] force = 0 dialogs = 0 @@ -452,6 +463,22 @@ def ini_preamble(): section = re.sub("MAX_SPINDLE_SPEED", "MAX_SPINDLE_0_SPEED", section) if re.search("MIN_VELOCITY", section): section = re.sub("MIN_VELOCITY", "MIN_LINEAR_VELOCITY", section) + + + # Copy values from TRAJ + if not re.search("DEFAULT_LINEAR_VELOCITY", section): + val = ini.find("TRAJ", "DEFAULT_LINEAR_VELOCITY") + if val: + section = insert_after("MAX_LINEAR_VELOCITY", f"DEFAULT_LINEAR_VELOCITY = {val}\n" , section) + if not re.search("MIN_LINEAR_VELOCITY", section): + val = ini.find("TRAJ", "MIN_LINEAR_VELOCITY") + if val: + section = insert_after("MAX_LINEAR_VELOCITY", f"MIN_LINEAR_VELOCITY = {val}\n" , section) + if not re.search("MAX_LINEAR_VELOCITY", section): + val = ini.find("TRAJ", "MAX_LINEAR_VELOCITY") + if val: + section = insert_after("MIN_LINEAR_VELOCITY", f"MAX_LINEAR_VELOCITY = {val}\n" , section) + newini.write(section) # TODO update-ini 1.1 --> 1.2: @@ -465,7 +492,7 @@ def ini_preamble(): # # copy [TRAJ]DEFAULT_LINEAR_VELOCITY -> [DISPLAY]DEFAULT_LINEAR_VELOCITY # move [TRAJ]MIN_LINEAR_VELOCITY -> [DISPLAY]MIN_LINEAR_VELOCITY - # rename [TRAJ, DISPLAY]MIN_VELOCITY --> MIN_LINEAR_VELOCITY + # ~rename [TRAJ, DISPLAY]MIN_VELOCITY --> MIN_LINEAR_VELOCITY~ # copy [TRAJ]MAX_LINEAR_VELOCITY -> [DISPLAY]MAX_LINEAR_VELOCITY #These sections don't need any work. From c7afc84e451be41ed1c36cc76aef7ef02f6645dd Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Mon, 9 Feb 2026 01:12:56 +0100 Subject: [PATCH 14/14] update_ini: remove MIN_LINEAR_VELOCITY from TRAJ --- src/emc/ini/update_ini.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/emc/ini/update_ini.py b/src/emc/ini/update_ini.py index 50e8f4ce110..248c0c82994 100755 --- a/src/emc/ini/update_ini.py +++ b/src/emc/ini/update_ini.py @@ -40,6 +40,11 @@ def insert_after(key, new_line, section): new_line += "\n" return section[:line_end + 1] + new_line + section[line_end + 1:] +def find_section(section, inistring): + section = re.search(r"(?:^|\n)[ \t]*(?!#)\[{}\](.+?\n)(?=\[|$)".format(section), inistring, re.DOTALL) + if section: section = section.group(1) + return section + force = 0 dialogs = 0 subs = {} @@ -446,9 +451,7 @@ def ini_preamble(): inistring, newini, all_sections = ini_preamble() all_sections.remove("DISPLAY") - section = re.search(r"(?:^|\n)[ \t]*(?!#)\[DISPLAY\](.+?\n)(?=\[|$)", inistring, re.DOTALL) - - if section: section = section.group(1) + section = find_section("DISPLAY", inistring) newini.write("\n[DISPLAY]") if section != None: if re.search("MIN_SPINDLE_OVERRIDE", section): @@ -463,8 +466,6 @@ def ini_preamble(): section = re.sub("MAX_SPINDLE_SPEED", "MAX_SPINDLE_0_SPEED", section) if re.search("MIN_VELOCITY", section): section = re.sub("MIN_VELOCITY", "MIN_LINEAR_VELOCITY", section) - - # Copy values from TRAJ if not re.search("DEFAULT_LINEAR_VELOCITY", section): val = ini.find("TRAJ", "DEFAULT_LINEAR_VELOCITY") @@ -472,13 +473,14 @@ def ini_preamble(): section = insert_after("MAX_LINEAR_VELOCITY", f"DEFAULT_LINEAR_VELOCITY = {val}\n" , section) if not re.search("MIN_LINEAR_VELOCITY", section): val = ini.find("TRAJ", "MIN_LINEAR_VELOCITY") + if val is None: + val = ini.find("TRAJ", "MIN_VELOCITY") if val: section = insert_after("MAX_LINEAR_VELOCITY", f"MIN_LINEAR_VELOCITY = {val}\n" , section) if not re.search("MAX_LINEAR_VELOCITY", section): val = ini.find("TRAJ", "MAX_LINEAR_VELOCITY") if val: section = insert_after("MIN_LINEAR_VELOCITY", f"MAX_LINEAR_VELOCITY = {val}\n" , section) - newini.write(section) # TODO update-ini 1.1 --> 1.2: @@ -503,10 +505,17 @@ def ini_preamble(): copysection("TASK") copysection("HAL") copysection("HALUI") - copysection("TRAJ") - copysection("EMCIO") - - # If there were any custom sections, tag them on the end. + # copysection("TRAJ") + all_sections.remove("TRAJ") + section = find_section("TRAJ", inistring) + if re.search("MIN_LINEAR_VELOCITY", section): + section = re.sub("MIN_LINEAR_VELOCITY.*\n?", "# moved MIN_LINEAR_VELOCITY to [DISPLAY]\n", section) + if re.search("MIN_VELOCITY", section): + section = re.sub("MIN_VELOCITY.*\n?", "# moved MIN_VELOCITY to DISPLAY]MIN_LINEAR_VELOCITY\n", section) + newini.write("\n[TRAJ]") + newini.write(section) + + # Copy the remaining sections while all_sections: copysection(all_sections[0])