Skip to content

Commit 3b138e6

Browse files
committed
gmoccapy: use spindle min, max and default directly from INI file (#3497)
1 parent 4155ded commit 3b138e6

4 files changed

Lines changed: 29 additions & 202 deletions

File tree

configs/sim/gmoccapy/gmoccapy.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ MAX_FEED_OVERRIDE = 1.5
2626
MIN_SPINDLE_0_OVERRIDE = 0.5
2727
MAX_SPINDLE_0_OVERRIDE = 1.2
2828

29-
# Initial value for spindle speed
29+
# Spindel start speed
3030
DEFAULT_SPINDLE_0_SPEED = 450
31+
# Scaling of spindle speed bar
32+
MIN_SPINDLE_0_SPEED = 0
33+
MAX_SPINDLE_0_SPEED = 3000
3134

3235
# The following are not used, added here to suppress warnings (from qt_istat/logger).
3336
DEFAULT_LINEAR_VELOCITY = 35
3437
MIN_LINEAR_VELOCITY = 0
3538
MAX_LINEAR_VELOCITY = 234
36-
MIN_SPINDLE_0_SPEED = 0
37-
MAX_SPINDLE_0_SPEED = 3000
3839

3940
# Prefix to be used
4041
PROGRAM_PREFIX = ../../nc_files/

docs/src/gui/gmoccapy.adoc

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@ So let us take a closer look at the INI file and what you need to include to use
110110
DISPLAY = gmoccapy
111111
PREFERENCE_FILE_PATH = gmoccapy_preferences
112112
MAX_FEED_OVERRIDE = 1.5
113-
MAX_SPINDLE_OVERRIDE = 1.2
114-
MIN_SPINDLE_OVERRIDE = 0.5
115-
DEFAULT_SPINDLE_SPEED = 500
113+
MIN_SPINDLE_0_OVERRIDE = 0.5
114+
MAX_SPINDLE_0_OVERRIDE = 1.2
115+
DEFAULT_SPINDLE_0_SPEED = 500
116+
MIN_SPINDLE_0_SPEED = 0
117+
MAX_SPINDLE_0_SPEED = 3000
116118
LATHE = 1
117119
BACK_TOOL_LATHE = 1
118120
PROGRAM_PREFIX = ../../nc_files/
@@ -135,10 +137,10 @@ If you only want to use one file for several machines, you need to include `PREF
135137
[NOTE]
136138
If no value is given, it will be set to 1.0.
137139

138-
- _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%.
140+
- _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%.
139141
+
140142
[NOTE]
141-
If no values are given, MIN will be set to 0.1 and MAX to 1.0.
143+
If no values are given, MIN will be set to 0.5 and MAX to 1.0.
142144

143145
- _LATHE = 1_ - Set the screen layout to control a lathe.
144146
- _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 <<gmoccapy:lathe-section,Lathe Specific Section>>.
154156
If not specified, GMOCCAPY will look in the following order for NGC files:
155157
First `linuxcnc/nc_files` and then the users home directory.
156158

157-
- _DEFAULT_SPINDLE_SPEED_ - Start value for <<gmoccapy-settings-spindle,"Starting RPM">> if value not present in preferences file or file is not present. Will have no effect with valid preferences file.
159+
- _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.
160+
- _MIN_SPINDLE_0_SPEED_ - Sets the lower limit of the spindle bar shown in the spindle frame on the main screen. Defaults to 100.
161+
- _MAX_SPINDLE_0_SPEED_ - Sets the upper limit of the spindle bar shown in the spindle frame on the main screen. Defaults to 2500.
162+
163+
[NOTE]
164+
It is no error giving values that didn't match the minimum and maximum speed of the spindle.
165+
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.
166+
158167

159168
- _MIN_ANGULAR_VELOCITY_ - Sets the minimal jog velocity of the machine for rotary axes.
160169
- _MAX_ANGULAR_VELOCITY_ - Sets the maximal jog velocity of the machine for rotary axes.
@@ -500,9 +509,10 @@ DISPLAY = gmoccapy <log_level_param>
500509
using these parameters:
501510
----
502511
Log level <log_level_param>
512+
VERBOSE -v
503513
DEBUG -d
504514
INFO -i
505-
VERBOSE -v
515+
WARNING -w
506516
ERROR -q
507517
----
508518

@@ -1408,25 +1418,6 @@ By default all scales are set using the calculation:
14081418
(MAX - MIN)/100
14091419
----
14101420

1411-
[[gmoccapy-settings-spindle]]
1412-
.Spindle
1413-
* _Starting RPM_ - Sets the rpm to be used if the spindle is started and no S value has been set.
1414-
+
1415-
[NOTE]
1416-
This value will be presetted according to your settings in `[DISPLAY] DEFAULT_SPINDLE_SPEED` of your INI file.
1417-
If you change the settings on the settings page, that value will be default from that moment, your INI file will not be modified.
1418-
1419-
* _Spindle bar min_ and _Spindle bar max_ - Sets the limits of the spindle bar shown in the INFO frame on the main screen.
1420-
+
1421-
====
1422-
Default values are: +
1423-
MIN = 0 +
1424-
MAX = 6000
1425-
====
1426-
+
1427-
[NOTE]
1428-
It is no error giving wrong values.
1429-
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.
14301421

14311422
.Unlock settings
14321423

src/emc/usr_intf/gmoccapy/gmoccapy.glade

Lines changed: 4 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,6 @@
111111
<property name="value">100</property>
112112
<property name="step-increment">1</property>
113113
</object>
114-
<object class="GtkAdjustment" id="adj_spindle_bar_max">
115-
<property name="upper">100000</property>
116-
<property name="value">6000</property>
117-
<property name="step-increment">50</property>
118-
<signal name="value-changed" handler="on_adj_spindle_bar_max_value_changed" swapped="no"/>
119-
</object>
120-
<object class="GtkAdjustment" id="adj_spindle_bar_min">
121-
<property name="upper">20000</property>
122-
<property name="step-increment">50</property>
123-
<signal name="value-changed" handler="on_adj_spindle_bar_min_value_changed" swapped="no"/>
124-
</object>
125-
<object class="GtkAdjustment" id="adj_start_spindle_RPM">
126-
<property name="lower">50</property>
127-
<property name="upper">20000</property>
128-
<property name="value">300</property>
129-
<property name="step-increment">25</property>
130-
<signal name="value-changed" handler="on_adj_start_spindle_RPM_value_changed" swapped="no"/>
131-
</object>
132114
<object class="GtkAdjustment" id="adj_turtle_jog_factor">
133115
<property name="lower">1</property>
134116
<property name="upper">100</property>
@@ -5918,137 +5900,6 @@ to test your settings.</property>
59185900
<property name="position">0</property>
59195901
</packing>
59205902
</child>
5921-
<child>
5922-
<object class="GtkFrame" id="frm_spindle_settings">
5923-
<property name="visible">True</property>
5924-
<property name="can-focus">False</property>
5925-
<property name="label-xalign">0.5</property>
5926-
<child>
5927-
<!-- n-columns=2 n-rows=3 -->
5928-
<object class="GtkGrid" id="grid_spindle">
5929-
<property name="visible">True</property>
5930-
<property name="can-focus">False</property>
5931-
<property name="margin-start">6</property>
5932-
<property name="margin-end">6</property>
5933-
<property name="margin-top">5</property>
5934-
<property name="margin-bottom">5</property>
5935-
<property name="hexpand">False</property>
5936-
<property name="row-spacing">2</property>
5937-
<property name="column-spacing">3</property>
5938-
<child>
5939-
<object class="GtkLabel" id="lbl_start_rpm">
5940-
<property name="visible">True</property>
5941-
<property name="can-focus">False</property>
5942-
<property name="hexpand">True</property>
5943-
<property name="label" translatable="yes">Starting RPM</property>
5944-
<property name="xalign">0</property>
5945-
</object>
5946-
<packing>
5947-
<property name="left-attach">0</property>
5948-
<property name="top-attach">0</property>
5949-
</packing>
5950-
</child>
5951-
<child>
5952-
<object class="GtkLabel" id="lbl_spindle_min_rpm">
5953-
<property name="visible">True</property>
5954-
<property name="can-focus">False</property>
5955-
<property name="hexpand">True</property>
5956-
<property name="label" translatable="yes">Spindle bar min</property>
5957-
<property name="xalign">0</property>
5958-
</object>
5959-
<packing>
5960-
<property name="left-attach">0</property>
5961-
<property name="top-attach">1</property>
5962-
</packing>
5963-
</child>
5964-
<child>
5965-
<object class="GtkLabel" id="lbl_spindle_max_rpm">
5966-
<property name="visible">True</property>
5967-
<property name="can-focus">False</property>
5968-
<property name="hexpand">True</property>
5969-
<property name="label" translatable="yes">Spindle bar max</property>
5970-
<property name="xalign">0</property>
5971-
</object>
5972-
<packing>
5973-
<property name="left-attach">0</property>
5974-
<property name="top-attach">2</property>
5975-
</packing>
5976-
</child>
5977-
<child>
5978-
<object class="GtkSpinButton" id="sbtn_spindle_start_rpm">
5979-
<property name="visible">True</property>
5980-
<property name="can-focus">True</property>
5981-
<property name="invisible-char">●</property>
5982-
<property name="activates-default">True</property>
5983-
<property name="xalign">1</property>
5984-
<property name="shadow-type">etched-in</property>
5985-
<property name="primary-icon-activatable">False</property>
5986-
<property name="secondary-icon-activatable">False</property>
5987-
<property name="adjustment">adj_start_spindle_RPM</property>
5988-
<property name="climb-rate">1</property>
5989-
<property name="numeric">True</property>
5990-
</object>
5991-
<packing>
5992-
<property name="left-attach">1</property>
5993-
<property name="top-attach">0</property>
5994-
</packing>
5995-
</child>
5996-
<child>
5997-
<object class="GtkSpinButton" id="sbtn_spindle_bar_min">
5998-
<property name="visible">True</property>
5999-
<property name="can-focus">True</property>
6000-
<property name="invisible-char">●</property>
6001-
<property name="activates-default">True</property>
6002-
<property name="xalign">1</property>
6003-
<property name="shadow-type">etched-in</property>
6004-
<property name="primary-icon-activatable">False</property>
6005-
<property name="secondary-icon-activatable">False</property>
6006-
<property name="adjustment">adj_spindle_bar_min</property>
6007-
<property name="climb-rate">1</property>
6008-
<property name="numeric">True</property>
6009-
</object>
6010-
<packing>
6011-
<property name="left-attach">1</property>
6012-
<property name="top-attach">1</property>
6013-
</packing>
6014-
</child>
6015-
<child>
6016-
<object class="GtkSpinButton" id="sbtn_spindle_bar_max">
6017-
<property name="visible">True</property>
6018-
<property name="can-focus">True</property>
6019-
<property name="invisible-char">●</property>
6020-
<property name="activates-default">True</property>
6021-
<property name="width-chars">7</property>
6022-
<property name="xalign">1</property>
6023-
<property name="shadow-type">etched-in</property>
6024-
<property name="primary-icon-activatable">False</property>
6025-
<property name="secondary-icon-activatable">False</property>
6026-
<property name="adjustment">adj_spindle_bar_max</property>
6027-
<property name="climb-rate">1</property>
6028-
<property name="numeric">True</property>
6029-
</object>
6030-
<packing>
6031-
<property name="left-attach">1</property>
6032-
<property name="top-attach">2</property>
6033-
</packing>
6034-
</child>
6035-
</object>
6036-
</child>
6037-
<child type="label">
6038-
<object class="GtkLabel" id="lbl_frm_spindle">
6039-
<property name="visible">True</property>
6040-
<property name="can-focus">False</property>
6041-
<property name="label" translatable="yes">&lt;b&gt;Spindle&lt;/b&gt;</property>
6042-
<property name="use-markup">True</property>
6043-
</object>
6044-
</child>
6045-
</object>
6046-
<packing>
6047-
<property name="expand">False</property>
6048-
<property name="fill">True</property>
6049-
<property name="position">1</property>
6050-
</packing>
6051-
</child>
60525903
<child>
60535904
<object class="GtkFrame" id="frm_unlock">
60545905
<property name="visible">True</property>
@@ -6128,7 +5979,7 @@ to test your settings.</property>
61285979
<packing>
61295980
<property name="expand">False</property>
61305981
<property name="fill">False</property>
6131-
<property name="position">2</property>
5982+
<property name="position">1</property>
61325983
</packing>
61335984
</child>
61345985
<child>
@@ -6146,6 +5997,9 @@ to test your settings.</property>
61465997
<child>
61475998
<placeholder/>
61485999
</child>
6000+
<child>
6001+
<placeholder/>
6002+
</child>
61496003
</object>
61506004
<packing>
61516005
<property name="expand">True</property>

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ def __init__(self, argv):
373373
self.widgets["ntb_button"].show()
374374

375375
# the velocity settings
376-
self.widgets.adj_spindle_bar_min.set_value(self.min_spindle_rev)
377-
self.widgets.adj_spindle_bar_max.set_value(self.max_spindle_rev)
378376
self.widgets.spindle_feedback_bar.set_property("min", float(self.min_spindle_rev))
379377
self.widgets.spindle_feedback_bar.set_property("max", float(self.max_spindle_rev))
380378

@@ -468,7 +466,6 @@ def __init__(self, argv):
468466

469467
self.widgets.chk_toggle_readout.set_active(self.toggle_readout)
470468

471-
self.widgets.adj_start_spindle_RPM.set_value(self.spindle_start_rpm)
472469
self.widgets.gcode_view.set_editable(False)
473470
self.widgets.ntb_user_tabs.remove_page(0)
474471

@@ -626,8 +623,9 @@ def _get_pref_data(self):
626623
self.scale_rapid_override = self.prefs.getpref("scale_rapid_override", 1, float)
627624

628625
# the velocity settings
629-
self.min_spindle_rev = self.prefs.getpref("spindle_bar_min", 0.0, float)
630-
self.max_spindle_rev = self.prefs.getpref("spindle_bar_max", 6000.0, float)
626+
self.spindle_start_rpm = self.INI.DEFAULT_SPINDLE_0_SPEED
627+
self.min_spindle_rev = self.INI.MIN_SPINDLE_0_SPEED
628+
self.max_spindle_rev = self.INI.MAX_SPINDLE_0_SPEED
631629

632630
self.turtle_jog_factor = self.prefs.getpref('turtle_jog_factor', 20, int)
633631
self.hide_turtle_jog_button = self.prefs.getpref("hide_turtle_jog_button", False, bool)
@@ -636,10 +634,7 @@ def _get_pref_data(self):
636634

637635
self.toggle_readout = self.prefs.getpref("toggle_readout", True, bool)
638636

639-
# if there is a INI Entry for default spindle speed, we will use that one as default
640-
# but if there is a setting in our preference file, that one will beet the INI entry
641-
default_spindle_speed = self.INI.DEFAULT_SPINDLE_0_SPEED
642-
self.spindle_start_rpm = self.prefs.getpref( 'spindle_start_rpm', default_spindle_speed, float )
637+
self.spindle_start_rpm = self.INI.DEFAULT_SPINDLE_0_SPEED
643638

644639
self.kbd_height = self.prefs.getpref("kbd_height", 250, int)
645640
self.kbd_width = self.prefs.getpref("kbd_width", 880, int)
@@ -4617,20 +4612,6 @@ def on_spc_spindle_value_changed(self, widget, data=None):
46174612
except:
46184613
pass
46194614

4620-
def on_adj_start_spindle_RPM_value_changed(self, widget, data=None):
4621-
self.spindle_start_rpm = widget.get_value()
4622-
self.prefs.putpref("spindle_start_rpm", self.spindle_start_rpm, float)
4623-
4624-
def on_adj_spindle_bar_min_value_changed(self, widget, data=None):
4625-
self.min_spindle_rev = widget.get_value()
4626-
self.prefs.putpref("spindle_bar_min", self.min_spindle_rev, float)
4627-
self.widgets.spindle_feedback_bar.set_property("min", self.min_spindle_rev)
4628-
4629-
def on_adj_spindle_bar_max_value_changed(self, widget, data=None):
4630-
self.max_spindle_rev = widget.get_value()
4631-
self.prefs.putpref("spindle_bar_max", self.max_spindle_rev, float)
4632-
self.widgets.spindle_feedback_bar.set_property("max", self.max_spindle_rev)
4633-
46344615
# =========================================================
46354616
# Coolant an mist coolant button
46364617
def on_tbtn_flood_toggled(self, widget, data=None):

0 commit comments

Comments
 (0)