Index: dialin/common/dg_defs.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/common/dg_defs.py (.../dg_defs.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ dialin/common/dg_defs.py (.../dg_defs.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -33,7 +33,7 @@ DG_MODE_CHFL = 11 # Chemical Disinfect Flush mode DG_MODE_HCOL = 12 # Heat Disinfect Active Cool mode DG_MODE_NLEG = 13 # Not legal - an illegal mode transition occurred - NUM_OF_DG_MODES = 1 # Number of DG operation modes + NUM_OF_DG_MODES = 14 # Number of DG operation modes @unique Index: dialin/dg/calibration_record.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -156,10 +156,19 @@ return False def cmd_dg_calibration_record_crc_override(self, crc: int) -> bool: + """ + Handles setting DG calibration_record CRC override. + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) crc_value = integer_to_bytearray(crc) dg_record = integer_to_bytearray(NVRecords.NVDATAMGMT_CALIBRATION_RECORD.value) - payload = crc_value + dg_record + payload = reset_byte_array + crc_value + dg_record message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_NV_RECORD_CRC_OVERRIDE.value, Index: dialin/dg/service_record.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/dg/service_record.py (.../service_record.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ dialin/dg/service_record.py (.../service_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -19,7 +19,6 @@ from enum import unique from logging import Logger from time import sleep - from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish @@ -119,10 +118,19 @@ return False def cmd_dg_service_record_crc_override(self, crc: int) -> bool: + """ + Handles setting DG service_record CRC override. + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) crc_value = integer_to_bytearray(crc) dg_record = integer_to_bytearray(NVRecords.NVDATAMGMT_SERVICE_RECORD.value) - payload = crc_value + dg_record + payload = reset_byte_array + crc_value + dg_record message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_NV_RECORD_CRC_OVERRIDE.value, Index: dialin/dg/system_record.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/dg/system_record.py (.../system_record.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ dialin/dg/system_record.py (.../system_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -156,10 +156,19 @@ return False def cmd_dg_system_record_crc_override(self, crc: int) -> bool: + """ + Handles setting DG system_record CRC override. + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) crc_value = integer_to_bytearray(crc) dg_record = integer_to_bytearray(NVRecords.NVDATAMGMT_SYSTEM_RECORD.value) - payload = crc_value + dg_record + payload = reset_byte_array + crc_value + dg_record message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_NV_RECORD_CRC_OVERRIDE.value, Index: dialin/dg/usage_info_record.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -97,10 +97,19 @@ return False def cmd_dg_usage_info_crc_override(self, crc: int) -> bool: + """ + Handles setting DG usage info record CRC override. + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) crc_value = integer_to_bytearray(crc) dg_record = integer_to_bytearray(NVRecords.NVDATAMGMT_USAGE_INFO_RECORD.value) - payload = crc_value + dg_record + payload = reset_byte_array + crc_value + dg_record message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_NV_RECORD_CRC_OVERRIDE.value, Index: dialin/hd/calibration_record.py =================================================================== diff -u -rf0cb1f298e3960769e0133172769deb9afe5a393 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/hd/calibration_record.py (.../calibration_record.py) (revision f0cb1f298e3960769e0133172769deb9afe5a393) +++ dialin/hd/calibration_record.py (.../calibration_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -18,11 +18,11 @@ from collections import OrderedDict from logging import Logger from time import sleep - from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish -from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver, NVRecords +from ..utils.conversions import integer_to_bytearray class HDCalibrationNVRecord(AbstractSubSystem): @@ -145,6 +145,38 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False + def cmd_hd_calibration_record_crc_override(self, crc: int) -> bool: + """ + Handles setting HD calibration_record CRC override. + + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) + crc_value = integer_to_bytearray(crc) + hd_record = integer_to_bytearray(NVRecords.NVDATAMGMT_CALIBRATION_RECORD.value) + payload = reset_byte_array + crc_value + hd_record + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_NV_RECORD_CRC_OVERRIDE.value, + payload=payload) + + self.logger.debug("Overriding HD calibration record CRC to: " + str(crc)) + + # 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 + def _handler_hd_calibration_sync(self, message): """ Handles published HD calibration_record record messages. DG calibration_record records are captured for Index: dialin/hd/service_record.py =================================================================== diff -u -r165a814489f7d0e91655b8861d4a4acac3d57f51 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/hd/service_record.py (.../service_record.py) (revision 165a814489f7d0e91655b8861d4a4acac3d57f51) +++ dialin/hd/service_record.py (.../service_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -19,11 +19,11 @@ from enum import unique from logging import Logger from time import sleep - from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum -from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver, NVRecords +from ..utils.conversions import integer_to_bytearray @unique @@ -120,6 +120,38 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False + def cmd_hd_service_record_crc_override(self, crc: int) -> bool: + """ + Handles setting HD service_record CRC override. + + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) + crc_value = integer_to_bytearray(crc) + hd_record = integer_to_bytearray(NVRecords.NVDATAMGMT_SERVICE_RECORD.value) + payload = reset_byte_array + crc_value + hd_record + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_NV_RECORD_CRC_OVERRIDE.value, + payload=payload) + + self.logger.debug("Overriding HD service record CRC to: " + str(crc)) + + # 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 + def _handler_hd_service_sync(self, message): """ Handles published HD system record messages. HD system records are captured for Index: dialin/hd/system_record.py =================================================================== diff -u -rf0cb1f298e3960769e0133172769deb9afe5a393 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/hd/system_record.py (.../system_record.py) (revision f0cb1f298e3960769e0133172769deb9afe5a393) +++ dialin/hd/system_record.py (.../system_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -23,7 +23,8 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish -from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver, NVRecords +from ..utils.conversions import integer_to_bytearray @unique @@ -155,6 +156,38 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False + def cmd_hd_system_record_crc_override(self, crc: int) -> bool: + """ + Handles setting HD system_record CRC override. + + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) + crc_value = integer_to_bytearray(crc) + hd_record = integer_to_bytearray(NVRecords.NVDATAMGMT_SYSTEM_RECORD.value) + payload = reset_byte_array + crc_value + hd_record + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_NV_RECORD_CRC_OVERRIDE.value, + payload=payload) + + self.logger.debug("Overriding HD system record CRC to: " + str(crc)) + + # 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 + def _handler_hd_system_sync(self, message): """ Handles published HD system record messages. HD system records are captured for Index: dialin/hd/usage_info_record.py =================================================================== diff -u -r165a814489f7d0e91655b8861d4a4acac3d57f51 -rb512a9393474d83243c08d7adf550540b2877f10 --- dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision 165a814489f7d0e91655b8861d4a4acac3d57f51) +++ dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -23,7 +23,8 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish -from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver, NVRecords +from ..utils.conversions import integer_to_bytearray class HDUsageNVRecord(AbstractSubSystem): @@ -94,6 +95,38 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False + def cmd_hd_usage_info_crc_override(self, crc: int) -> bool: + """ + Handles setting HD usage info record CRC override. + + @param crc: (int) the CRC override value + + @return: True if successful, False otherwise + """ + # This command does not have a reset but since the corresponding payload structure in firmware requires a reset + # so the payload length is the same when it is received in the firmware. + reset_byte_array = integer_to_bytearray(0) + crc_value = integer_to_bytearray(crc) + hd_record = integer_to_bytearray(NVRecords.NVDATAMGMT_USAGE_INFO_RECORD.value) + payload = reset_byte_array + crc_value + hd_record + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_NV_RECORD_CRC_OVERRIDE.value, + payload=payload) + + self.logger.debug("Overriding HD usage info CRC to: " + str(crc)) + + # 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 + def _handler_hd_usage_info_sync(self, message): """ Handles published HD usage information record messages. Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r165a814489f7d0e91655b8861d4a4acac3d57f51 -rb512a9393474d83243c08d7adf550540b2877f10 --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 165a814489f7d0e91655b8861d4a4acac3d57f51) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -70,7 +70,7 @@ # in your computer. #dg.system_record.cmd_get_dg_system_record_report() - dg.system_record.cmd_set_dg_system_record_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-09-26-DG-Record.xlsx') + dg.system_record.cmd_set_dg_system_record_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-12-19-DG-Record.xlsx') # For resetting the system record to benign values, use the function below #dg.system_record.cmd_reset_dg_system_record() @@ -112,13 +112,14 @@ if dg.cmd_log_in_to_dg(): - run_sw_configs_commands() + #run_sw_configs_commands() #run_calibration_commands() - #run_system_commands() + run_system_commands() #run_usage_info_commands() #run_service_commands() + Index: tests/dg_tests.py =================================================================== diff -u -rca3dffa6d804bbaeff6eb1009edf88835107dc44 -rb512a9393474d83243c08d7adf550540b2877f10 --- tests/dg_tests.py (.../dg_tests.py) (revision ca3dffa6d804bbaeff6eb1009edf88835107dc44) +++ tests/dg_tests.py (.../dg_tests.py) (revision b512a9393474d83243c08d7adf550540b2877f10) @@ -473,7 +473,8 @@ f = open("/home/fw/projects/dialin/tests/Heat_disinfect.log", "w") #dg.heaters.cmd_heaters_broadcast_interval_override(50) #sleep(1) - dg.hd_proxy.cmd_start_stop_dg_heat_disinfect() + #dg.hd_proxy.cmd_start_stop_dg_heat_disinfect() + dg.hd_proxy.cmd_start_stop_dg_heat_disinfect_active_cool() try: while True: @@ -512,6 +513,8 @@ except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_heat_disinfect(start=False) + sleep(0.2) + dg.hd_proxy.cmd_start_stop_dg_heat_disinfect_active_cool(start=False) f.close() @@ -644,7 +647,7 @@ hd.cmd_log_in_to_hd() sleep(1) - #run_heat_disinfect() + run_heat_disinfect() #run_flush_mode() @@ -654,7 +657,7 @@ # cmd_set_disinfect_ui_screen() - collect_treatment_data() + #collect_treatment_data() #collect_hd_treatment()