Skip to content

Commit b3b4922

Browse files
authored
expose the multi mcu homing timeout as a parameter (KalicoCrew#93)
1 parent 5cccd3b commit b3b4922

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Features merged into the master branch:
4848

4949
- [danger_options: allow plugins to override conflicting extras](https://github.com/DangerKlippers/danger-klipper/pull/82)
5050

51+
- [danger_options: expose the multi mcu homing timeout as a parameter](https://github.com/DangerKlippers/danger-klipper/pull/93)
52+
5153
If you're feeling adventurous, take a peek at the extra features in the bleeding-edge branch:
5254

5355
- [dmbutyugin's advanced-features branch](https://github.com/DangerKlippers/danger-klipper/pull/69) [dmbutyugin/advanced-features](https://github.com/dmbutyugin/klipper/commits/advanced-features)

docs/Config_Reference.md

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ log_shutdown_info: True
101101
# Allows modules in `plugins` to override modules of the same name in `extras`
102102
allow_plugin_override: False
103103
104+
# The timeout (in seconds) for MCU synchronization during the homing process when multiple MCUs are in use.
105+
multi_mcu_trsync_timeout: 0.025
104106
```
105107

106108
## Common kinematic settings

klippy/extras/danger_options.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def __init__(self, config):
1616
"allow_plugin_override", False
1717
)
1818

19+
self.multi_mcu_trsync_timeout = config.getfloat(
20+
"multi_mcu_trsync_timeout", 0.025, minval=0.0
21+
)
22+
1923

2024
def load_config(config):
2125
return DangerOptions(config)

klippy/mcu.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ def stop(self):
288288
return params["trigger_reason"]
289289

290290

291-
TRSYNC_TIMEOUT = 0.025
292291
TRSYNC_SINGLE_MCU_TIMEOUT = 0.250
293292

294293

@@ -308,6 +307,9 @@ def __init__(self, mcu, pin_params):
308307
ffi_main, ffi_lib = chelper.get_ffi()
309308
self._trdispatch = ffi_main.gc(ffi_lib.trdispatch_alloc(), ffi_lib.free)
310309
self._trsyncs = [MCU_trsync(mcu, self._trdispatch)]
310+
self.danger_options = self._mcu.get_printer().lookup_object(
311+
"danger_options"
312+
)
311313

312314
def get_mcu(self):
313315
return self._mcu
@@ -370,7 +372,7 @@ def home_start(
370372
self._rest_ticks = rest_ticks
371373
reactor = self._mcu.get_printer().get_reactor()
372374
self._trigger_completion = reactor.completion()
373-
expire_timeout = TRSYNC_TIMEOUT
375+
expire_timeout = self.danger_options.multi_mcu_trsync_timeout
374376
if len(self._trsyncs) == 1:
375377
expire_timeout = TRSYNC_SINGLE_MCU_TIMEOUT
376378
for trsync in self._trsyncs:

test/klippy/danger_options.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ error_on_unused_config_options: False
77
log_bed_mesh_at_startup: False
88
log_shutdown_info: False
99
allow_plugin_override: True
10+
multi_mcu_trsync_timeout: 0.05
1011

1112
[stepper_x]
1213
step_pin: PF0

0 commit comments

Comments
 (0)