From b3b4922d1780443a7dec27d660fc32b2270d5f3a Mon Sep 17 00:00:00 2001 From: Rogerio Goncalves Date: Tue, 7 Nov 2023 19:27:35 +0000 Subject: [PATCH] expose the multi mcu homing timeout as a parameter (#93) --- README.md | 2 ++ docs/Config_Reference.md | 2 ++ klippy/extras/danger_options.py | 4 ++++ klippy/mcu.py | 6 ++++-- test/klippy/danger_options.cfg | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1879415c8..c7a98af2a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 90a48d8b0..e3d4503f6 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -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 diff --git a/klippy/extras/danger_options.py b/klippy/extras/danger_options.py index 909063478..314b6f092 100644 --- a/klippy/extras/danger_options.py +++ b/klippy/extras/danger_options.py @@ -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) diff --git a/klippy/mcu.py b/klippy/mcu.py index 966f4c820..daeda98d5 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -288,7 +288,6 @@ def stop(self): return params["trigger_reason"] -TRSYNC_TIMEOUT = 0.025 TRSYNC_SINGLE_MCU_TIMEOUT = 0.250 @@ -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 @@ -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: diff --git a/test/klippy/danger_options.cfg b/test/klippy/danger_options.cfg index f6fbac8a2..84bfd7c29 100644 --- a/test/klippy/danger_options.cfg +++ b/test/klippy/danger_options.cfg @@ -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