From 5c42ff9e49e109e980d66cb6fd613cd83f4b1eb6 Mon Sep 17 00:00:00 2001 From: Rogerio Goncalves Date: Fri, 20 Dec 2024 10:38:51 -0300 Subject: [PATCH] mcu: expose non critical status (#473) * mcu: expose non critical status * docs: adds non_critical_disconnected to Status_Reference.md * mcu: only report if it is non critical --- docs/Status_Reference.md | 5 +++-- klippy/mcu.py | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/Status_Reference.md b/docs/Status_Reference.md index e5a36cd98..df0cff188 100644 --- a/docs/Status_Reference.md +++ b/docs/Status_Reference.md @@ -160,8 +160,8 @@ objects: - `power`: The fan power as a float between 0|`min_power` and 1.0|`max_power`. - `rpm`: The measured fan speed in rotations per minute if the fan has a tachometer_pin defined. -deprecated objects (for UI compatibility only): -- `speed`: The fan speed as a float between 0.0 and `max_power`. +deprecated objects (for UI compatibility only): +- `speed`: The fan speed as a float between 0.0 and `max_power`. ## filament_switch_sensor @@ -346,6 +346,7 @@ The following information is available in micro-controller architectures and with each code revision. - `last_stats.`: Statistics information on the micro-controller connection. +- `non_critical_disconnected`: True/False if the mcu is disconnected. ## motion_report diff --git a/klippy/mcu.py b/klippy/mcu.py index 5a80697cf..3a5ff3817 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -1148,9 +1148,13 @@ def _check_serial_exists(self): def _mcu_identify(self): if self.is_non_critical and not self._check_serial_exists(): self.non_critical_disconnected = True + if self.is_non_critical: + self._get_status_info["non_critical_disconnected"] = True return False else: self.non_critical_disconnected = False + if self.is_non_critical: + self._get_status_info["non_critical_disconnected"] = False if self.is_fileoutput(): self._connect_file() else: