From 3a57f71f33edb0bc60ee49079d723891b2072552 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 16 Aug 2024 14:05:13 -0400 Subject: [PATCH] output_pin: Remove deprecated maximum_mcu_duration and static_value Remove support for these two config options that were previously deprecated. Signed-off-by: Kevin O'Connor --- docs/Config_Changes.md | 4 +++ klippy/extras/output_pin.py | 49 ++++++------------------------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index b5212ce1..484a5c15 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -8,6 +8,10 @@ All dates in this document are approximate. ## Changes +20240912: Support for `maximum_mcu_duration` and `static_value` +parameters in `[output_pin]` config sections have been removed. These +options have been deprecated since 20240123. + 20240415: The `on_error_gcode` parameter in the `[virtual_sdcard]` config section now has a default. If this parameter is not specified it now defaults to `TURN_OFF_HEATERS`. If the previous behavior is diff --git a/klippy/extras/output_pin.py b/klippy/extras/output_pin.py index ef094674..993d2622 100644 --- a/klippy/extras/output_pin.py +++ b/klippy/extras/output_pin.py @@ -5,7 +5,6 @@ # This file may be distributed under the terms of the GNU GPLv3 license. PIN_MIN_TIME = 0.100 -RESEND_HOST_TIME = 0.300 + PIN_MIN_TIME MAX_SCHEDULE_TIME = 5.0 class PrinterOutputPin: @@ -24,29 +23,13 @@ class PrinterOutputPin: else: self.mcu_pin = ppins.setup_pin('digital_out', config.get('pin')) self.scale = 1. + self.mcu_pin.setup_max_duration(0.) self.last_print_time = 0. - # Support mcu checking for maximum duration - self.reactor = self.printer.get_reactor() - self.resend_timer = None - self.resend_interval = 0. - max_mcu_duration = config.getfloat('maximum_mcu_duration', 0., - minval=0.500, - maxval=MAX_SCHEDULE_TIME) - self.mcu_pin.setup_max_duration(max_mcu_duration) - if max_mcu_duration: - config.deprecate('maximum_mcu_duration') - self.resend_interval = max_mcu_duration - RESEND_HOST_TIME # Determine start and shutdown values - static_value = config.getfloat('static_value', None, - minval=0., maxval=self.scale) - if static_value is not None: - config.deprecate('static_value') - self.last_value = self.shutdown_value = static_value / self.scale - else: - self.last_value = config.getfloat( - 'value', 0., minval=0., maxval=self.scale) / self.scale - self.shutdown_value = config.getfloat( - 'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale + self.last_value = config.getfloat( + 'value', 0., minval=0., maxval=self.scale) / self.scale + self.shutdown_value = config.getfloat( + 'shutdown_value', 0., minval=0., maxval=self.scale) / self.scale self.mcu_pin.setup_start_value(self.last_value, self.shutdown_value) # Register commands pin_name = config.get_name().split()[1] @@ -56,8 +39,8 @@ class PrinterOutputPin: desc=self.cmd_SET_PIN_help) def get_status(self, eventtime): return {'value': self.last_value} - def _set_pin(self, print_time, value, is_resend=False): - if value == self.last_value and not is_resend: + def _set_pin(self, print_time, value): + if value == self.last_value: return print_time = max(print_time, self.last_print_time + PIN_MIN_TIME) if self.is_pwm: @@ -66,9 +49,6 @@ class PrinterOutputPin: self.mcu_pin.set_digital(print_time, value) self.last_value = value self.last_print_time = print_time - if self.resend_interval and self.resend_timer is None: - self.resend_timer = self.reactor.register_timer( - self._resend_current_val, self.reactor.NOW) cmd_SET_PIN_help = "Set the value of an output pin" def cmd_SET_PIN(self, gcmd): # Read requested value @@ -81,20 +61,5 @@ class PrinterOutputPin: toolhead.register_lookahead_callback( lambda print_time: self._set_pin(print_time, value)) - def _resend_current_val(self, eventtime): - if self.last_value == self.shutdown_value: - self.reactor.unregister_timer(self.resend_timer) - self.resend_timer = None - return self.reactor.NEVER - - systime = self.reactor.monotonic() - print_time = self.mcu_pin.get_mcu().estimated_print_time(systime) - time_diff = (self.last_print_time + self.resend_interval) - print_time - if time_diff > 0.: - # Reschedule for resend time - return systime + time_diff - self._set_pin(print_time + PIN_MIN_TIME, self.last_value, True) - return systime + self.resend_interval - def load_config_prefix(config): return PrinterOutputPin(config)