Index: leahi_dialin/dd/modules/drybicart.py =================================================================== diff -u -re16372ac648dd4efca346c889348b08c8653ee17 -re2b4c560c69fa8c593dd59020b7d315b7ee315a8 --- leahi_dialin/dd/modules/drybicart.py (.../drybicart.py) (revision e16372ac648dd4efca346c889348b08c8653ee17) +++ leahi_dialin/dd/modules/drybicart.py (.../drybicart.py) (revision e2b4c560c69fa8c593dd59020b7d315b7ee315a8) @@ -58,12 +58,14 @@ self.dd_dry_bicart_last_fill_time = 0 self.dd_dry_bicart_current_fill_time = 0 self.dd_dry_bicart_timestamp = 0 + self.dd_dryBiCartType = 0 + self.dd_dryBiCartDrainTimePeriod = 0 @publish(["msg_id_dd_dry_bicart_data", "dd_dry_bicart_fill_execution_state", "dd_bicarb_chamber_fill_execution_state", "dd_dry_bicart_drain_execution_state", "dd_dry_bicart_fill_cycle_counter", "dd_dry_bicart_max_fill_cycle_count", "dd_dry_bicart_fill_request", "dry_bicarb_chamber_fill_request", "dd_dry_bicart_drain_request", - "dd_dry_bicart_last_fill_time", "dd_dry_bicart_current_fill_time", + "dd_dry_bicart_last_fill_time", "dd_dry_bicart_current_fill_time", "dd_dryBiCartType", "dd_dryBiCartDrainTimePeriod", "dd_dry_bicart_timestamp"]) def _handler_dry_bicart_sync(self, message, timestamp=0.0): """ @@ -93,6 +95,10 @@ message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] self.dd_dry_bicart_current_fill_time = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10]))[0] + self.dd_dryBiCartType = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11]))[0] + self.dd_dryBiCartDrainTimePeriod = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_12:MsgFieldPositions.END_POS_FIELD_12]))[0] self.dd_dry_bicart_timestamp = timestamp @@ -254,4 +260,33 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.error("Timeout!!!!") - return False \ No newline at end of file + return False + def cmd_dry_bicart_cartridge_size_override(self, small_large: int, reset: int = NO_RESET) -> int: + """ + Constructs and sends the dry bicart cartridge size override command + Constraints: + Must be logged into DD. + + @param small_large: int - value for small or large dry bicart ( small = 0, large = 1 + @return: 1 if successful, zero otherwise + + """ + + cartridge_size = integer_to_bytearray(small_large) + reset_byte_array = integer_to_bytearray(reset) + payload = reset_byte_array + cartridge_size + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, + message_id=MsgIds.MSG_ID_DD_BICART_CARTRIDGE_SELECT_OVERRIDE_REQUEST.value, + payload=payload) + + # 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