From c917bd893dc714ccf272962ae0078c352b4c0948 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 21 Apr 2025 13:34:32 -0400 Subject: pwm_tool: Use mcu.min_schedule_time() and mcu.max_nominal_duration() Signed-off-by: Kevin O'Connor --- klippy/extras/pwm_tool.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'klippy/extras/pwm_tool.py') diff --git a/klippy/extras/pwm_tool.py b/klippy/extras/pwm_tool.py index aa95ecbe..46873203 100644 --- a/klippy/extras/pwm_tool.py +++ b/klippy/extras/pwm_tool.py @@ -1,12 +1,10 @@ # Queued PWM gpio output # -# Copyright (C) 2017-2023 Kevin O'Connor +# Copyright (C) 2017-2025 Kevin O'Connor # # This file may be distributed under the terms of the GNU GPLv3 license. import chelper -MAX_SCHEDULE_TIME = 5.0 - class error(Exception): pass @@ -137,16 +135,16 @@ class PrinterOutputPin: # Determine pin type pin_params = ppins.lookup_pin(config.get('pin'), can_invert=True) self.mcu_pin = MCU_queued_pwm(pin_params) + max_duration = self.mcu_pin.get_mcu().max_nominal_duration() cycle_time = config.getfloat('cycle_time', 0.100, above=0., - maxval=MAX_SCHEDULE_TIME) + maxval=max_duration) hardware_pwm = config.getboolean('hardware_pwm', False) self.mcu_pin.setup_cycle_time(cycle_time, hardware_pwm) self.scale = config.getfloat('scale', 1., above=0.) self.last_print_time = 0. # Support mcu checking for maximum duration max_mcu_duration = config.getfloat('maximum_mcu_duration', 0., - minval=0.500, - maxval=MAX_SCHEDULE_TIME) + minval=0.500, maxval=max_duration) self.mcu_pin.setup_max_duration(max_mcu_duration) # Determine start and shutdown values self.last_value = config.getfloat( -- cgit v1.2.3-70-g09d2