Index: dialin/common/msg_ids.py =================================================================== diff -u -rd55580ac0bef4e0c16ad6c6d9d0cff409ec67027 -rcd5a3a2636c040f0592664edbc712efc58e07c16 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision d55580ac0bef4e0c16ad6c6d9d0cff409ec67027) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision cd5a3a2636c040f0592664edbc712efc58e07c16) @@ -195,7 +195,7 @@ MSG_ID_DG_SCHEDULED_RUNS_INFO = 0xAC MSG_ID_UI_INSTALLATION_CONFIRM_RESPONSE = 0xAD MSG_ID_DG_FILL_MODE_DATA = 0xAE - MSG_ID_DG_BAD_FILL_SUB_STATE = 0xAF + MSG_ID_DG_GEN_IDLE_DATA = 0xAF MSG_ID_UI_REQUEST_SERVICE_MODE = 0xB0 MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST = 0xB1 MSG_ID_HD_REQUEST_UI_FINAL_POST_RESULT = 0xB2 @@ -389,7 +389,7 @@ MSG_ID_DG_THERMISTORS_DATA_PUBLISH_INTERVAL_OVERRIDE = 0xA02D MSG_ID_DG_THERMISTORS_VALUE_OVERRIDE = 0xA02E MSG_ID_DG_RO_PUMP_DUTY_CYCLE_OVERRIDE = 0xA02F - MSG_ID____AVAILABLE_5 = 0xA030 + MSG_ID_DG_DRAIN_PUMP_CURRENT_OVERRIDE = 0xA030 MSG_ID_DG_SET_RO_PUMP_TARGET_FLOW = 0xA031 MSG_ID_DG_RO_PUMP_TARGET_PRESSURE_OVERRIDE = 0xA032 MSG_ID_DG_SET_CALIBRATION_RECORD = 0xA033 Index: dialin/dg/drain_pump.py =================================================================== diff -u -rbff28676dd855ea33707bbb26a624abc94aebdf0 -rcd5a3a2636c040f0592664edbc712efc58e07c16 --- dialin/dg/drain_pump.py (.../drain_pump.py) (revision bff28676dd855ea33707bbb26a624abc94aebdf0) +++ dialin/dg/drain_pump.py (.../drain_pump.py) (revision cd5a3a2636c040f0592664edbc712efc58e07c16) @@ -224,6 +224,46 @@ self.logger.debug("Timeout!!!!") return False + def cmd_drain_pump_measured_current_override(self, current: float, reset: int = NO_RESET) -> int: + """ + Constructs and sends the drain pump measured current override command. + Constraints: + Must be logged into DG. + Given measured current must be within 0 and 2.2 Amps. + + @param current: (float) measured current to override with in Amps + @param reset: (int) 1 to reset a previous override, 0 to override + @return: 1 if successful, zero otherwise + """ + + rst = integer_to_bytearray(reset) + cur = float_to_bytearray(current) + payload = rst + cur + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, + message_id=MsgIds.MSG_ID_DG_DRAIN_PUMP_CURRENT_OVERRIDE.value, + payload=payload) + + self.logger.debug("Override drain pump measured current.") + + # Send message + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + if reset == RESET: + str_res = "reset back to normal" + else: + str_res = str(cur) + self.logger.debug( + "Drain pump measured current overridden to " + str_res + " A " + + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False + def cmd_drain_pump_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends the drain pump data publication override command.