aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/tmc2660.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-02-20 13:42:16 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-02-27 10:39:46 -0500
commit6e4270fa79628e85b32900f782fc2badf94488f4 (patch)
tree64a30384aef784741ead39bfb0884138bf5f582b /klippy/extras/tmc2660.py
parenta657aab0bf4e201a043527c08c07bcad76eaecff (diff)
downloadkutter-6e4270fa79628e85b32900f782fc2badf94488f4.tar.gz
kutter-6e4270fa79628e85b32900f782fc2badf94488f4.tar.xz
kutter-6e4270fa79628e85b32900f782fc2badf94488f4.zip
tmc: Move SET_TMC_CURRENT command to TMCCommandHelper()
Refactor the tmc driver implementations so that there is a single implementation of the SET_TMC_CURRENT command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/tmc2660.py')
-rw-r--r--klippy/extras/tmc2660.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/klippy/extras/tmc2660.py b/klippy/extras/tmc2660.py
index 129974c4..44280c86 100644
--- a/klippy/extras/tmc2660.py
+++ b/klippy/extras/tmc2660.py
@@ -149,11 +149,6 @@ class TMC2660CurrentHelper:
self.printer.register_event_handler("idle_timeout:ready",
self._handle_ready)
- gcode = self.printer.lookup_object("gcode")
- gcode.register_mux_command("SET_TMC_CURRENT", "STEPPER", self.name,
- self.cmd_SET_TMC_CURRENT,
- desc=self.cmd_SET_TMC_CURRENT_help)
-
def _calc_current_bits(self, current, vsense):
vref = 0.165 if vsense else 0.310
cs = int(32 * current * self.sense_resistor * math.sqrt(2.) / vref
@@ -194,14 +189,6 @@ class TMC2660CurrentHelper:
self.current = run_current
self._update_current(run_current, print_time)
- cmd_SET_TMC_CURRENT_help = "Set the current of a TMC2660 driver"
- def cmd_SET_TMC_CURRENT(self, gcmd):
- cur = gcmd.get_float('CURRENT', None, minval=0.1, maxval=MAX_CURRENT)
- if cur is None:
- return
- print_time = self.printer.lookup_object('toolhead').get_last_move_time()
- self.set_current(cur, None, print_time)
-
######################################################################
# TMC2660 SPI
@@ -248,7 +235,8 @@ class TMC2660:
self.fields.set_field("SDOFF", 0) # Access DRVCTRL in step/dir mode
self.mcu_tmc = MCU_TMC2660_SPI(config, Registers, self.fields)
# Register commands
- cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc)
+ current_helper = TMC2660CurrentHelper(config, self.mcu_tmc)
+ cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc, current_helper)
cmdhelper.setup_register_dump(ReadRegisters)
# DRVCTRL
@@ -278,7 +266,6 @@ class TMC2660:
# SGSCONF
set_config_field(config, "SFILT", 1)
set_config_field(config, "SGT", 0)
- TMC2660CurrentHelper(config, self.mcu_tmc)
# DRVCONF
set_config_field(config, "SLPH", 0)