Skip to content

Commit

Permalink
expose the multi mcu homing timeout as a parameter (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerlz authored Nov 7, 2023
1 parent 5cccd3b commit b3b4922
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Features merged into the master branch:

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

- [danger_options: expose the multi mcu homing timeout as a parameter](https://github.com/DangerKlippers/danger-klipper/pull/93)

If you're feeling adventurous, take a peek at the extra features in the bleeding-edge branch:

- [dmbutyugin's advanced-features branch](https://github.com/DangerKlippers/danger-klipper/pull/69) [dmbutyugin/advanced-features](https://github.com/dmbutyugin/klipper/commits/advanced-features)
Expand Down
2 changes: 2 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ log_shutdown_info: True
# Allows modules in `plugins` to override modules of the same name in `extras`
allow_plugin_override: False
# The timeout (in seconds) for MCU synchronization during the homing process when multiple MCUs are in use.
multi_mcu_trsync_timeout: 0.025
```

## Common kinematic settings
Expand Down
4 changes: 4 additions & 0 deletions klippy/extras/danger_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def __init__(self, config):
"allow_plugin_override", False
)

self.multi_mcu_trsync_timeout = config.getfloat(
"multi_mcu_trsync_timeout", 0.025, minval=0.0
)


def load_config(config):
return DangerOptions(config)
6 changes: 4 additions & 2 deletions klippy/mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ def stop(self):
return params["trigger_reason"]


TRSYNC_TIMEOUT = 0.025
TRSYNC_SINGLE_MCU_TIMEOUT = 0.250


Expand All @@ -308,6 +307,9 @@ def __init__(self, mcu, pin_params):
ffi_main, ffi_lib = chelper.get_ffi()
self._trdispatch = ffi_main.gc(ffi_lib.trdispatch_alloc(), ffi_lib.free)
self._trsyncs = [MCU_trsync(mcu, self._trdispatch)]
self.danger_options = self._mcu.get_printer().lookup_object(
"danger_options"
)

def get_mcu(self):
return self._mcu
Expand Down Expand Up @@ -370,7 +372,7 @@ def home_start(
self._rest_ticks = rest_ticks
reactor = self._mcu.get_printer().get_reactor()
self._trigger_completion = reactor.completion()
expire_timeout = TRSYNC_TIMEOUT
expire_timeout = self.danger_options.multi_mcu_trsync_timeout
if len(self._trsyncs) == 1:
expire_timeout = TRSYNC_SINGLE_MCU_TIMEOUT
for trsync in self._trsyncs:
Expand Down
1 change: 1 addition & 0 deletions test/klippy/danger_options.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ error_on_unused_config_options: False
log_bed_mesh_at_startup: False
log_shutdown_info: False
allow_plugin_override: True
multi_mcu_trsync_timeout: 0.05

[stepper_x]
step_pin: PF0
Expand Down

0 comments on commit b3b4922

Please sign in to comment.