mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 13:04:05 -06:00
mcu: Add get_mcu() call to the mcu oid objects
Allow external code to obtain the mcu object that controls a pin setup with setup_pin(). Also, don't bother defining print_to_mcu_time() and system_to_mcu_time() on each pin object as they can be obtained via the new get_mcu() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c7c551369f
commit
68d6788413
4 changed files with 17 additions and 13 deletions
|
@ -33,7 +33,7 @@ class PrinterFan:
|
|||
self.last_fan_value = value
|
||||
# External commands
|
||||
def set_speed(self, print_time, value):
|
||||
mcu_time = self.mcu_fan.print_to_mcu_time(print_time)
|
||||
mcu_time = self.mcu_fan.get_mcu().print_to_mcu_time(print_time)
|
||||
self.set_pwm(mcu_time, value)
|
||||
|
||||
class PrinterHeaterFan:
|
||||
|
@ -53,7 +53,8 @@ class PrinterHeaterFan:
|
|||
power = 0.
|
||||
if target_temp or current_temp > self.heater_temp:
|
||||
power = 1.
|
||||
mcu_time = self.fan.mcu_fan.system_to_mcu_time(eventtime + FAN_MIN_TIME)
|
||||
mcu_time = self.fan.mcu_fan.get_mcu().system_to_mcu_time(
|
||||
eventtime + FAN_MIN_TIME)
|
||||
self.fan.set_pwm(mcu_time, power)
|
||||
return eventtime + 1.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue