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 Index: leahi_dialin/dd/modules/dialysate_pump.py =================================================================== diff -u -r5d1444a2ef341b1ca053c81a4d4fddfacac6b33c -r03936b9327b52b7ea33aecb5aa2129f33583bc35 --- leahi_dialin/dd/modules/dialysate_pump.py (.../dialysate_pump.py) (revision 5d1444a2ef341b1ca053c81a4d4fddfacac6b33c) +++ leahi_dialin/dd/modules/dialysate_pump.py (.../dialysate_pump.py) (revision 03936b9327b52b7ea33aecb5aa2129f33583bc35) @@ -349,21 +349,21 @@ self.logger.error("Timeout!!!!") return False - def cmd_dialysate_start_stop_override(self, pump_id: int, cmd: int, reset: int = NO_RESET) -> int: + def cmd_dialysate_set_start_stop(self, pump_id: int, command: int, speed: int ) -> int: """ - Constructs and sends the dialysate pump start stop override command + Constructs and sends the dialysate pump start stop command - @param pump_id: unsigned int - concentrate pump ID - @param cmd: int - value to command the dialysate pump - @param reset: integer - 1 to reset a previous override, 0 to override + @param pump_id: unsigned int - dialysate pump ID + @param command: int - value to command the dialysate pump + @param speed: integer - rpm to set the speed to @return: 1 if successful, zero otherwise """ - reset_byte_array = integer_to_bytearray(reset) - direction_byte_array = float_to_bytearray(cmd) - pump_id_byte_array = integer_to_bytearray(pump_id) - payload = reset_byte_array + direction_byte_array + pump_id_byte_array + pmp = integer_to_bytearray(pump_id) + cmd = integer_to_bytearray(command) + rpm = integer_to_bytearray(speed) + payload = pmp + cmd + rpm message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, message_id=MsgIds.MSG_ID_DD_DIALYSATE_PUMPS_START_STOP_OVERRIDE_REQUEST.value, Index: leahi_dialin/dd/modules/heaters.py =================================================================== diff -u -recd89ae316cd2afa695dd4e93ac18b6004975efb -r03936b9327b52b7ea33aecb5aa2129f33583bc35 --- leahi_dialin/dd/modules/heaters.py (.../heaters.py) (revision ecd89ae316cd2afa695dd4e93ac18b6004975efb) +++ leahi_dialin/dd/modules/heaters.py (.../heaters.py) (revision 03936b9327b52b7ea33aecb5aa2129f33583bc35) @@ -178,21 +178,22 @@ self.logger.debug("Timeout!!!!") return False - def cmd_heater_start_stop_override(self, heater: int, command: int, reset: int = NO_RESET) -> int: + def cmd_heater_start_stop_override(self, heater: int, command: int, temperature: float) -> int: """ Constructs and sends heater duty cycle override command Must be logged into DG There must be a minimum flow available for the heaters (FMP for primary and FMD for trimmer) @param heater the heater to override its value (primary, trimmer) (0-1.0 order) - @param cmd the duty cycle value to override in percent - @param reset: (int) 1 to reset a previous override, 0 to override + @param command the duty cycle value to override in percent + @param temperature: float - temp to set to @returns 1 if successful, zero otherwise """ - reset_value = integer_to_bytearray(reset) - heater_name = integer_to_bytearray(heater) + htr = integer_to_bytearray(heater) cmd = integer_to_bytearray(command) - payload = reset_value + cmd + heater_name + tmp = float_to_bytearray(temperature) + payload = tmp + cmd + htr + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, message_id=MsgIds.MSG_ID_DD_HEATERS_START_STOP_OVERRIDE_REQUEST.value, payload=payload) Index: leahi_dialin/dd/modules/valves.py =================================================================== diff -u -rf4c08ccd4729e3e1758ab4d7bc2723a66ffec3c1 -r03936b9327b52b7ea33aecb5aa2129f33583bc35 --- leahi_dialin/dd/modules/valves.py (.../valves.py) (revision f4c08ccd4729e3e1758ab4d7bc2723a66ffec3c1) +++ leahi_dialin/dd/modules/valves.py (.../valves.py) (revision 03936b9327b52b7ea33aecb5aa2129f33583bc35) @@ -398,3 +398,36 @@ else: self.logger.debug("Timeout!!!!") return False + + + def cmd_valve_set_open_close(self, valve: int, state: int) -> int: + """ + Constructs and sends the valve open close command + + @param valve: unsigned int - dialysate pump ID + @param command: int - value to command the dialysate pump + @param speed: integer - rpm to set the speed to + @return: 1 if successful, zero otherwise + + """ + + vlv = integer_to_bytearray(valve) + sts = integer_to_bytearray(state) + payload = vlv + sts + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, + message_id=MsgIds.MSG_ID_DD_VALVES_OPEN_CLOSE_STATE_OVERRIDE_REQUEST.value, + payload=payload) + + self.logger.debug("setting " + str(state) + " - for valve: " + str(valve)) + + # 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