mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 05:54:05 -06:00
pwm_tool: Use mcu.min_schedule_time() and mcu.max_nominal_duration()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d57bc253c5
commit
c917bd893d
1 changed files with 4 additions and 6 deletions
|
@ -1,12 +1,10 @@
|
|||
# Queued PWM gpio output
|
||||
#
|
||||
# Copyright (C) 2017-2023 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2017-2025 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# 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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue