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:
Kevin O'Connor 2017-08-29 17:20:26 -04:00
parent c7c551369f
commit 68d6788413
4 changed files with 17 additions and 13 deletions

View file

@ -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.