tmc: Retry register init during connect
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
cfdb60ca23
commit
274857357e
|
@ -101,10 +101,18 @@ class TMCCommandHelper:
|
|||
for reg_name, val in self.fields.registers.items():
|
||||
self.mcu_tmc.set_register(reg_name, val, print_time)
|
||||
def _handle_connect(self):
|
||||
try:
|
||||
self._init_registers(0.)
|
||||
except self.printer.command_error as e:
|
||||
raise self.printer.config_error(str(e))
|
||||
retry_count = 0
|
||||
while 1:
|
||||
try:
|
||||
self._init_registers(0.)
|
||||
return
|
||||
except self.printer.command_error as e:
|
||||
logging.exception("TMC init error")
|
||||
retry_count += 1
|
||||
if retry_count > 5:
|
||||
raise self.printer.config_error(str(e))
|
||||
reactor = self.printer.get_reactor()
|
||||
reactor.pause(reactor.monotonic() + 1.)
|
||||
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
||||
def cmd_INIT_TMC(self, params):
|
||||
logging.info("INIT_TMC %s", self.name)
|
||||
|
|
Loading…
Reference in New Issue