Index: dialin/dg/usage_info_record.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r82229ace97aa9278d0add3874dfc43dde9b028cc --- dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision 82229ace97aa9278d0add3874dfc43dde9b028cc) @@ -19,7 +19,6 @@ from collections import OrderedDict from logging import Logger from time import sleep -from enum import unique from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish @@ -87,7 +86,7 @@ # If there is content... if received_message is not None: - self.logger.debug("Received FW ACK after requesting DG software configuration record.") + self.logger.debug("Received FW ACK after requesting DG usage information record.") # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: @@ -168,7 +167,7 @@ self.dg_usage_info_record_timestamp = timestamp self._handler_received_complete_dg_usage_info_record() - @publish(["dg_usage_info_record_timestamp","dg_usage_info_record"]) + @publish(["dg_usage_info_record_timestamp", "dg_usage_info_record"]) def _handler_received_complete_dg_usage_info_record(self): """ Publishes the received usage information record Index: dialin/hd/usage_info_record.py =================================================================== diff -u -r5d46528dea60d95e18caada03ff8e328b52bbb38 -r82229ace97aa9278d0add3874dfc43dde9b028cc --- dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) +++ dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision 82229ace97aa9278d0add3874dfc43dde9b028cc) @@ -58,6 +58,7 @@ self._raw_usage_info_record = [] self._utilities = NVOpsUtils(logger=self.logger) self.hd_usage_info_record = self._prepare_hd_usage_info_record() + self.hd_usage_info_record_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.hd_to_dialin_ch_id @@ -127,7 +128,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_hd_usage_info_sync(self, message): + def _handler_hd_usage_info_sync(self, message, timestamp=0.0): """ Handles published HD usage information record messages. @@ -152,22 +153,20 @@ # Get the data only and not specs of it (i.e current message number) self._usage_info_data = message['message'][MsgFieldPositions.START_POS_FIELD_1:end_of_data_index] - print(self.hd_usage_info_record, self._current_message, self._total_messages) # Continue getting calibration_record records until the all the calibration_record messages are received. # Concatenate the calibration_record records to each other if self._current_message <= self._total_messages: self._raw_usage_info_record += (message['message'][MsgFieldPositions.START_POS_FIELD_1 + self._RECORD_SPECS_BYTES:end_of_data_index]) - print(self.hd_usage_info_record) if self._current_message == self._total_messages: # Done with receiving the messages self._is_getting_usage_info_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.hd_usage_info_record, self._raw_usage_info_record) + self.hd_usage_info_record_timestamp = timestamp self._handler_received_complete_hd_usage_info_record() - print(self.hd_usage_info_record) - @publish(["hd_usage_info_record"]) + @publish(["hd_usage_info_record_timestamp", "hd_usage_info_record"]) def _handler_received_complete_hd_usage_info_record(self): """ Publishes the received usage information record @@ -186,7 +185,6 @@ # Pass the software configuration record dictionary to be updated with the excel document self._utilities.write_excel_record_to_fw_record(self.hd_usage_info_record, excel_report_path, self._utilities.USAGE_INFO_RECORD_TAB_NAME) - print(self.hd_usage_info_record) # TODO remove self._cmd_set_hd_usage_info_record(self.hd_usage_info_record) def _cmd_set_hd_usage_info_record(self, previous_record: OrderedDict) -> bool: @@ -325,13 +323,11 @@ @return: none """ + # Request the HD usage record and set and observer class to callback when the record is read back + self._cmd_request_hd_usage_info_record() observer = NVUtilsObserver("hd_usage_info_record") # Attach the observer to the list self.attach(observer) - - # Request the DG usage record and set and observer class to callback when the calibration record is read - # back - self._cmd_request_hd_usage_info_record() while not observer.received: sleep(0.1) self._utilities.write_excel_record_to_fw_record(self.hd_usage_info_record, report_address, Index: tests/dg_nvm_scripts.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r82229ace97aa9278d0add3874dfc43dde9b028cc --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 82229ace97aa9278d0add3874dfc43dde9b028cc) @@ -112,13 +112,13 @@ if dg.cmd_log_in_to_dg(): - run_sw_configs_commands() + #run_sw_configs_commands() #run_calibration_commands() #run_system_commands() - #run_usage_info_commands() + run_usage_info_commands() #run_service_commands() Index: tests/hd_nvm_scripts.py =================================================================== diff -u -r5d46528dea60d95e18caada03ff8e328b52bbb38 -r82229ace97aa9278d0add3874dfc43dde9b028cc --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 82229ace97aa9278d0add3874dfc43dde9b028cc) @@ -50,12 +50,12 @@ # It creates a folder called HD_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in your computer. - #hd.calibration_record.cmd_get_hd_calibration_record_report() + hd.calibration_record.cmd_get_hd_calibration_record_report() # Use cmd_set_hd_calibration_excel_to_fw() set the changes back to firmware # This function requires an address for the excel report. Use the absolute address of your excel report like the # example below - hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2023-03-27-HD-Record.xlsx') + #hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2023-03-27-HD-Record.xlsx') # For resetting the calibration record to benign values, use the function below #hd.calibration_record.cmd_reset_hd_calibration_record() @@ -117,11 +117,11 @@ #run_sw_configs_commands() # Comment this function if not needed - # run_calibration_commands() + run_calibration_commands() #run_system_commands() - run_usage_info_commands() + #run_usage_info_commands() #run_service_commands()