Index: leahi_dialin/td/modules/air_pump.py =================================================================== diff -u -rc5bfcf84ed942ca5841bf9de155aa0f495b4d28d -r889e26ae0fcb2888938463588b01ca159d2f4565 --- leahi_dialin/td/modules/air_pump.py (.../air_pump.py) (revision c5bfcf84ed942ca5841bf9de155aa0f495b4d28d) +++ leahi_dialin/td/modules/air_pump.py (.../air_pump.py) (revision 889e26ae0fcb2888938463588b01ca159d2f4565) @@ -96,16 +96,21 @@ can_interface = self.can_interface) - def cmd_air_pump_set_state(self, state: int, power: int) -> int: + def cmd_air_pump_set_state(self, state: int, dutyCycle: float) -> int: """ Constructs and sends the air pump set state command. Constraints: Must be logged into TD. @param state: integer - 1 to stop the pump, 2 to activate it - @param power: integer - 0-255 value to set the air pump power - @return: 1 if successful, zero otherwise + @param dutyCycle: float - 0-100 value to set the air pump duty cycle + @return: 1 if successful, zero otlherwise """ + + if dutyCycle < 0 or dutyCycle > 100: + return 0 + + power = int((dutyCycle/100) * 255) sts = integer_to_bytearray(state) pwr = integer_to_bytearray(power) payload = sts + pwr