mirror of https://github.com/Desuuuu/klipper.git
tmc: Move clear_gstat check for tmc2130 to within TMCErrorCheck class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
88d0af3da3
commit
d184d9fd91
|
@ -81,14 +81,14 @@ class FieldHelper:
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
class TMCErrorCheck:
|
class TMCErrorCheck:
|
||||||
def __init__(self, config, mcu_tmc, clear_gstat=True):
|
def __init__(self, config, mcu_tmc):
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.stepper_name = ' '.join(config.get_name().split()[1:])
|
name_parts = config.get_name().split()
|
||||||
|
self.stepper_name = ' '.join(name_parts[1:])
|
||||||
self.mcu_tmc = mcu_tmc
|
self.mcu_tmc = mcu_tmc
|
||||||
self.fields = mcu_tmc.get_fields()
|
self.fields = mcu_tmc.get_fields()
|
||||||
self.check_timer = None
|
self.check_timer = None
|
||||||
# Setup for GSTAT query
|
# Setup for GSTAT query
|
||||||
self.clear_gstat = clear_gstat
|
|
||||||
reg_name = self.fields.lookup_register("drv_err")
|
reg_name = self.fields.lookup_register("drv_err")
|
||||||
if reg_name is not None:
|
if reg_name is not None:
|
||||||
self.gstat_reg_info = [0, reg_name, 0xffffffff, 0xffffffff]
|
self.gstat_reg_info = [0, reg_name, 0xffffffff, 0xffffffff]
|
||||||
|
@ -105,6 +105,8 @@ class TMCErrorCheck:
|
||||||
if f in err_fields:
|
if f in err_fields:
|
||||||
err_mask |= self.fields.all_fields[reg_name][f]
|
err_mask |= self.fields.all_fields[reg_name][f]
|
||||||
self.drv_status_reg_info = [0, reg_name, mask, err_mask]
|
self.drv_status_reg_info = [0, reg_name, mask, err_mask]
|
||||||
|
# Driver quirks
|
||||||
|
self.clear_gstat = (name_parts[0] != 'tmc2130')
|
||||||
def _query_register(self, reg_info, try_clear=False):
|
def _query_register(self, reg_info, try_clear=False):
|
||||||
last_value, reg_name, mask, err_mask = reg_info
|
last_value, reg_name, mask, err_mask = reg_info
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -162,13 +164,13 @@ class TMCErrorCheck:
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
class TMCCommandHelper:
|
class TMCCommandHelper:
|
||||||
def __init__(self, config, mcu_tmc, current_helper, clear_gstat=True):
|
def __init__(self, config, mcu_tmc, current_helper):
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.stepper_name = ' '.join(config.get_name().split()[1:])
|
self.stepper_name = ' '.join(config.get_name().split()[1:])
|
||||||
self.name = config.get_name().split()[-1]
|
self.name = config.get_name().split()[-1]
|
||||||
self.mcu_tmc = mcu_tmc
|
self.mcu_tmc = mcu_tmc
|
||||||
self.current_helper = current_helper
|
self.current_helper = current_helper
|
||||||
self.echeck_helper = TMCErrorCheck(config, mcu_tmc, clear_gstat)
|
self.echeck_helper = TMCErrorCheck(config, mcu_tmc)
|
||||||
self.fields = mcu_tmc.get_fields()
|
self.fields = mcu_tmc.get_fields()
|
||||||
self.read_registers = self.read_translate = None
|
self.read_registers = self.read_translate = None
|
||||||
self.toff = None
|
self.toff = None
|
||||||
|
|
|
@ -257,8 +257,7 @@ class TMC2130:
|
||||||
tmc.TMCVirtualPinHelper(config, self.mcu_tmc)
|
tmc.TMCVirtualPinHelper(config, self.mcu_tmc)
|
||||||
# Register commands
|
# Register commands
|
||||||
current_helper = TMCCurrentHelper(config, self.mcu_tmc)
|
current_helper = TMCCurrentHelper(config, self.mcu_tmc)
|
||||||
cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc, current_helper,
|
cmdhelper = tmc.TMCCommandHelper(config, self.mcu_tmc, current_helper)
|
||||||
clear_gstat=False)
|
|
||||||
cmdhelper.setup_register_dump(ReadRegisters)
|
cmdhelper.setup_register_dump(ReadRegisters)
|
||||||
# Setup basic register values
|
# Setup basic register values
|
||||||
mh = tmc.TMCMicrostepHelper(config, self.mcu_tmc)
|
mh = tmc.TMCMicrostepHelper(config, self.mcu_tmc)
|
||||||
|
|
Loading…
Reference in New Issue