From 9c84895a09fa408b2838ce85a2540ee7d4eeb117 Mon Sep 17 00:00:00 2001 From: hilbo86 Date: Sun, 30 Nov 2025 22:52:22 +0100 Subject: [PATCH] ads1x1x: Interface for "QUERY_ADC" (#7132) "QUERY_ADC" command will fail without "get_last_value" function. Signed-off-by: Timo Hilbig --- klippy/extras/ads1x1x.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/klippy/extras/ads1x1x.py b/klippy/extras/ads1x1x.py index 9290b3f14..bcdbaf698 100644 --- a/klippy/extras/ads1x1x.py +++ b/klippy/extras/ads1x1x.py @@ -322,7 +322,7 @@ class ADS1X1X_pin: self.mcu = chip.mcu self.chip = chip self.pcfg = pcfg - + self._last_state = (0., 0.) self.invalid_count = 0 self.chip._printer.register_event_handler("klippy:connect", \ @@ -362,6 +362,7 @@ class ADS1X1X_pin: # Publish result measured_time = self._reactor.monotonic() + self._last_state = (target_value, measured_time) self.callback(self.chip.mcu.estimated_print_time(measured_time), target_value) else: @@ -389,5 +390,8 @@ class ADS1X1X_pin: self.maxval = maxval self.range_check_count = range_check_count + def get_last_value(self): + return self._last_state + def load_config_prefix(config): return ADS1X1X_chip(config)