tmc: SET_TMC_FIELD VELOCITY
Ability to specify `VELOCITY` as a parameter for SET_TMC_FIELD. Useful for configuring at runtime the TSTEP based fields of the driver. Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
This commit is contained in:
committed by
KevinOConnor
parent
0469710a69
commit
73f4c6cd00
@@ -248,13 +248,14 @@ def lookup_tmc_spi_chain(config):
|
||||
|
||||
# Helper code for working with TMC devices via SPI
|
||||
class MCU_TMC_SPI:
|
||||
def __init__(self, config, name_to_reg, fields):
|
||||
def __init__(self, config, name_to_reg, fields, tmc_frequency):
|
||||
self.printer = config.get_printer()
|
||||
self.name = config.get_name().split()[-1]
|
||||
self.tmc_spi, self.chain_pos = lookup_tmc_spi_chain(config)
|
||||
self.mutex = self.tmc_spi.mutex
|
||||
self.name_to_reg = name_to_reg
|
||||
self.fields = fields
|
||||
self.tmc_frequency = tmc_frequency
|
||||
def get_fields(self):
|
||||
return self.fields
|
||||
def get_register(self, reg_name):
|
||||
@@ -271,6 +272,8 @@ class MCU_TMC_SPI:
|
||||
return
|
||||
raise self.printer.command_error(
|
||||
"Unable to write tmc spi '%s' register %s" % (self.name, reg_name))
|
||||
def get_tmc_frequency(self):
|
||||
return self.tmc_frequency
|
||||
|
||||
|
||||
######################################################################
|
||||
@@ -281,7 +284,8 @@ class TMC2130:
|
||||
def __init__(self, config):
|
||||
# Setup mcu communication
|
||||
self.fields = tmc.FieldHelper(Fields, SignedFields, FieldFormatters)
|
||||
self.mcu_tmc = MCU_TMC_SPI(config, Registers, self.fields)
|
||||
self.mcu_tmc = MCU_TMC_SPI(config, Registers, self.fields,
|
||||
TMC_FREQUENCY)
|
||||
# Allow virtual pins to be created
|
||||
tmc.TMCVirtualPinHelper(config, self.mcu_tmc)
|
||||
# Register commands
|
||||
|
||||
Reference in New Issue
Block a user