Index: dialin/common/msg_ids.py =================================================================== diff -u -r099d6838f82efa3d596848922793d5e56dbd541b -r9790d4c89a67940465d74dc98ee13834bee8565c --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 099d6838f82efa3d596848922793d5e56dbd541b) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 9790d4c89a67940465d74dc98ee13834bee8565c) @@ -416,6 +416,7 @@ MSG_ID_DG_SET_USAGE_INFO_RECORD = 0xA054 MSG_ID_DG_SEND_USAGE_INFO_RECORD = 0xA055 MSG_ID_DG_SET_OP_MODE_REQUEST = 0xA056 + MSG_ID_DG_RESERVOIR_TARE_REQUEST = 0xA057 MSG_ID_HD_DEBUG_EVENT = 0xFFF1 MSG_ID_DG_DEBUG_EVENT = 0xFFF2 Index: dialin/dg/reservoirs.py =================================================================== diff -u -r3a70bfb451b74106348c064c34f19934aadd9119 -r9790d4c89a67940465d74dc98ee13834bee8565c --- dialin/dg/reservoirs.py (.../reservoirs.py) (revision 3a70bfb451b74106348c064c34f19934aadd9119) +++ dialin/dg/reservoirs.py (.../reservoirs.py) (revision 9790d4c89a67940465d74dc98ee13834bee8565c) @@ -112,6 +112,26 @@ return True + def cmd_reservoir_tare(self, reservoir: int) -> bool: + """ + Sends a command to the DG to tare a given reservoir + @param reservoir: (int) the ID of the reservoir to tare + @return: True if command sent, False if reservoir ID invalid + """ + + if reservoir not in [0, 1]: + return False + + payload = integer_to_bytearray(reservoir) + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, + message_id=MsgIds.MSG_ID_DG_RESERVOIR_TARE_REQUEST.value, + payload=payload) + + self.logger.debug("Sending command to tare DG reservoir {0}".format(reservoir)) + self.can_interface.send(message, 0) + + return True + @publish(["active_reservoir", "fill_to_vol_ml", "drain_to_vol_ml", "time_reservoir_cycle", "time_reservoir_fill_2_switch", "time_uf_decay", "temp_uf_fill", "temp_reservoir_use_actual", "temp_reservoir_end_fill", "temp_avg_fill", "temp_last_fill", "time_rsrvr_fill"])