aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-02-20 14:08:24 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-02-27 10:39:46 -0500
commit21383fa32e697195cbe63cb01c43447a6b17a50c (patch)
tree28968a03eb0de9e9fc52a0a2c98d72aa0902254a /klippy/extras
parent6e4270fa79628e85b32900f782fc2badf94488f4 (diff)
downloadkutter-21383fa32e697195cbe63cb01c43447a6b17a50c.tar.gz
kutter-21383fa32e697195cbe63cb01c43447a6b17a50c.tar.xz
kutter-21383fa32e697195cbe63cb01c43447a6b17a50c.zip
tmc: Always report values after a SET_TMC_CURRENT command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/tmc.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py
index fa2c0b57..7ef2fc93 100644
--- a/klippy/extras/tmc.py
+++ b/klippy/extras/tmc.py
@@ -153,20 +153,21 @@ class TMCCommandHelper:
minval=0., maxval=max_current)
hold_current = gcmd.get_float('HOLDCURRENT', None,
above=0., maxval=max_current)
- if run_current is None and hold_current is None:
- # Query only
- if prev_hold_current is None:
- gcmd.respond_info("Run Current: %0.2fA" % (prev_run_current,))
- else:
- gcmd.respond_info("Run Current: %0.2fA Hold Current: %0.2fA"
- % (prev_run_current, prev_hold_current))
- return
- if run_current is None:
- run_current = prev_run_current
- if hold_current is None:
- hold_current = prev_hold_current
- print_time = self.printer.lookup_object('toolhead').get_last_move_time()
- ch.set_current(run_current, hold_current, print_time)
+ if run_current is not None or hold_current is not None:
+ if run_current is None:
+ run_current = prev_run_current
+ if hold_current is None:
+ hold_current = prev_hold_current
+ toolhead = self.printer.lookup_object('toolhead')
+ print_time = toolhead.get_last_move_time()
+ ch.set_current(run_current, hold_current, print_time)
+ prev_run_current, prev_hold_current, max_current = ch.get_current()
+ # Report values
+ if prev_hold_current is None:
+ gcmd.respond_info("Run Current: %0.2fA" % (prev_run_current,))
+ else:
+ gcmd.respond_info("Run Current: %0.2fA Hold Current: %0.2fA"
+ % (prev_run_current, prev_hold_current))
# Stepper enable/disable via comms
def _do_enable(self, print_time, is_enable):
toff_val = 0