tmc: Always report values after a SET_TMC_CURRENT command

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-02-20 14:08:24 -05:00
parent 6e4270fa79
commit 21383fa32e
1 changed files with 15 additions and 14 deletions

View File

@ -153,20 +153,21 @@ class TMCCommandHelper:
minval=0., maxval=max_current) minval=0., maxval=max_current)
hold_current = gcmd.get_float('HOLDCURRENT', None, hold_current = gcmd.get_float('HOLDCURRENT', None,
above=0., maxval=max_current) above=0., maxval=max_current)
if run_current is None and hold_current is None: if run_current is not None or hold_current is not None:
# Query only if run_current is None:
if prev_hold_current is None: run_current = prev_run_current
gcmd.respond_info("Run Current: %0.2fA" % (prev_run_current,)) if hold_current is None:
else: hold_current = prev_hold_current
gcmd.respond_info("Run Current: %0.2fA Hold Current: %0.2fA" toolhead = self.printer.lookup_object('toolhead')
% (prev_run_current, prev_hold_current)) print_time = toolhead.get_last_move_time()
return ch.set_current(run_current, hold_current, print_time)
if run_current is None: prev_run_current, prev_hold_current, max_current = ch.get_current()
run_current = prev_run_current # Report values
if hold_current is None: if prev_hold_current is None:
hold_current = prev_hold_current gcmd.respond_info("Run Current: %0.2fA" % (prev_run_current,))
print_time = self.printer.lookup_object('toolhead').get_last_move_time() else:
ch.set_current(run_current, hold_current, print_time) gcmd.respond_info("Run Current: %0.2fA Hold Current: %0.2fA"
% (prev_run_current, prev_hold_current))
# Stepper enable/disable via comms # Stepper enable/disable via comms
def _do_enable(self, print_time, is_enable): def _do_enable(self, print_time, is_enable):
toff_val = 0 toff_val = 0