update idm.py.

fix compatibility

Signed-off-by: Sgr A* VMT <1611902585@qq.com>
This commit is contained in:
Sgr A* VMT
2024-01-17 01:34:15 +00:00
committed by Gitee
parent d43819eac8
commit e8d223bd06

10
idm.py
View File

@@ -1330,8 +1330,14 @@ class IDMEndstopWrapper:
expire_timeout = TRSYNC_TIMEOUT
if len(self._trsyncs) == 1:
expire_timeout = TRSYNC_SINGLE_MCU_TIMEOUT
for trsync in self._trsyncs:
trsync.start(print_time, self._trigger_completion, expire_timeout)
for i, trsync in enumerate(self._trsyncs):
try:
trsync.start(print_time, self._trigger_completion, expire_timeout)
except TypeError:
offset = float(i) / len(self._trsyncs)
trsync.start(
print_time, offset, self._trigger_completion, expire_timeout
)
etrsync = self._trsyncs[0]
ffi_main, ffi_lib = chelper.get_ffi()
ffi_lib.trdispatch_start(self._trdispatch, etrsync.REASON_HOST_REQUEST)