Index: leahi_dialin/dd/modules/concentrate_pump.py =================================================================== diff -u -recd89ae316cd2afa695dd4e93ac18b6004975efb -r03936b9327b52b7ea33aecb5aa2129f33583bc35 --- leahi_dialin/dd/modules/concentrate_pump.py (.../concentrate_pump.py) (revision ecd89ae316cd2afa695dd4e93ac18b6004975efb) +++ leahi_dialin/dd/modules/concentrate_pump.py (.../concentrate_pump.py) (revision 03936b9327b52b7ea33aecb5aa2129f33583bc35) @@ -346,3 +346,35 @@ return False + def cmd_concentrate_set_start_stop(self, pump_id: int, command: int, speed: float ) -> int: + """ + Constructs and sends the concentrate pump start stop command + + @param pump_id: unsigned int - concentrate pump ID + @param command: int - value to command the concentrate pump + @param speed: float - ml/min to set the speed to + @return: 1 if successful, zero otherwise + + """ + + pmp = integer_to_bytearray(pump_id) + cmd = integer_to_bytearray(command) + spd = float_to_bytearray(speed) + payload = pmp + cmd + spd + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, + message_id=MsgIds.MSG_ID_DD_CONCENTRATE_PUMPS_START_STOP_OVERRIDE_REQUEST.value, + payload=payload) + + self.logger.debug("setting " + str(spd) + " - for pump: " + str(pump_id)) + + # Send message + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.error("Timeout!!!!") + return False \ No newline at end of file