Skip to content

Commit 8d2c9f1

Browse files
Merge pull request #747 from MaslowCNC/add-PID-settings-for-the-Z-axis
Add PID settings for the z axis (take two)
2 parents 8fc4118 + a7e2620 commit 8d2c9f1

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

Settings/maslowSettings.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,27 @@
338338
"key": "KdPos",
339339
"default": 34
340340
},
341+
{
342+
"type": "string",
343+
"title": "Kp Position Z-Axis",
344+
"desc": "The proportional constant for the position Z-Axis PID controller",
345+
"key": "KpPosZ",
346+
"default": 1300
347+
},
348+
{
349+
"type": "string",
350+
"title": "Ki Position Z-Axis",
351+
"desc": "The integral constant for the position Z-Axis PID controller",
352+
"key": "KiPosZ",
353+
"default": 0
354+
},
355+
{
356+
"type": "string",
357+
"title": "Kd Position Z-Axis",
358+
"desc": "The derivative constant for the position Z-Axis PID controller",
359+
"key": "KdPosZ",
360+
"default": 34
361+
},
341362
{
342363
"type": "string",
343364
"title": "Proportional Weighting",
@@ -373,6 +394,27 @@
373394
"key": "KdV",
374395
"default": .28
375396
},
397+
{
398+
"type": "string",
399+
"title": "Kp Velocity Z-Axis",
400+
"desc": "The proportional constant for the Z-axis velocity PID controller",
401+
"key": "KpVZ",
402+
"default": 5
403+
},
404+
{
405+
"type": "string",
406+
"title": "Ki Velocity Z-Axis",
407+
"desc": "The integral constant for the Z-axis velocity PID controller",
408+
"key": "KiVZ",
409+
"default": 0
410+
},
411+
{
412+
"type": "string",
413+
"title": "Kd Velocity Z-Axis",
414+
"desc": "The derivative constant for the Z-axis velocity PID controller",
415+
"key": "KdVZ",
416+
"default": .28
417+
},
376418
{
377419
"type": "options",
378420
"title": "PWM frequency for motor control",

UIElements/diagnosticsMenu.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,5 @@ def advancedOptionsFunctions(self, text):
193193
self.runJustTriangularCuts()
194194
elif text == "Reset settings to defaults":
195195
self.resetAllSettings()
196-
self.runJustTriangularCuts()
197196
elif text == "Compute chain calibration factors":
198197
self.measureChainTolerances()

main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,13 @@ def computeSettings(self, section, key, value):
195195
else:
196196
value = maslowSettings.getDefaultValue('Advanced Settings', key)
197197
self.config.set('Computed Settings', key + "Main", value)
198-
self.config.set('Computed Settings', key + "Z", value)
198+
#updated computed values for z-axis
199+
for key in ('KpPosZ', 'KiPosZ', 'KdPosZ'):
200+
if int(self.config.get('Advanced Settings', 'enablePosPIDValues')) == 1:
201+
value = float(self.config.get('Advanced Settings', key))
202+
else:
203+
value = maslowSettings.getDefaultValue('Advanced Settings', key)
204+
self.config.set('Computed Settings', key, value)
199205

200206
elif key == 'enableVPIDValues':
201207
for key in ('KpV', 'KiV', 'KdV'):
@@ -204,7 +210,13 @@ def computeSettings(self, section, key, value):
204210
else:
205211
value = maslowSettings.getDefaultValue('Advanced Settings', key)
206212
self.config.set('Computed Settings', key + "Main", value)
207-
self.config.set('Computed Settings', key + "Z", value)
213+
#updated computed values for z-axis
214+
for key in ('KpVZ', 'KiVZ', 'KdVZ'):
215+
if int(self.config.get('Advanced Settings', 'enablePosPIDValues')) == 1:
216+
value = float(self.config.get('Advanced Settings', key))
217+
else:
218+
value = maslowSettings.getDefaultValue('Advanced Settings', key)
219+
self.config.set('Computed Settings', key, value)
208220

209221
elif key == 'chainOverSprocket':
210222
if value == 'Top':

0 commit comments

Comments
 (0)