Index: dialin/dg/calibration_record.py =================================================================== diff -u -r88b4967ce6b9ac816ac21b26326450de4b540887 -rf822b55ab067aba716dc07f7fa3f53ef9cb2c9e3 --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision 88b4967ce6b9ac816ac21b26326450de4b540887) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision f822b55ab067aba716dc07f7fa3f53ef9cb2c9e3) @@ -201,7 +201,7 @@ """ Handles setting the calibration data that is in an excel report to the firmware. - @param report_address: (str) the address in which its data must be written to excel + @param report_address: (str) the address in which its data must be written from excel @return: none """ Index: dialin/dg/system_record.py =================================================================== diff -u -r7ea4b936cef531b2cde9053ae58b7119a3bf0e6c -rf822b55ab067aba716dc07f7fa3f53ef9cb2c9e3 --- dialin/dg/system_record.py (.../system_record.py) (revision 7ea4b936cef531b2cde9053ae58b7119a3bf0e6c) +++ dialin/dg/system_record.py (.../system_record.py) (revision f822b55ab067aba716dc07f7fa3f53ef9cb2c9e3) @@ -18,11 +18,12 @@ from collections import OrderedDict 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 -from ..utils.nv_ops_utils import NVOpsUtils +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver @unique @@ -51,6 +52,8 @@ _PAYLOAD_TRANSFER_DELAY_S = 0.2 _DIALIN_RECORD_UPDATE_DELAY_S = 0.2 + _FIRMWARE_STACK_NAME = 'DG' + def __init__(self, can_interface, logger: Logger): """ @@ -98,6 +101,30 @@ """ return self.dg_system_record['system_record'] + def cmd_get_dg_system_record_report(self, report_destination: str = None): + """ + Handles getting DG system_record record from firmware and writing it to excel. + + @param report_destination: (str) the destination that the report should be written to + + @return: none + """ + # Prepare the excel report + self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._utilities.SYSTEM_RECORD_TAB_NAME, + report_destination, protect_sheet=True) + + observer = NVUtilsObserver("dg_system_record") + # Attach the observer to the list + self.attach(observer) + + # Request the DG system record and set and observer class to callback when the system record is read back + self.cmd_request_dg_system_record() + + while not observer.received: + sleep(0.1) + # Pass the DG system record to the function to write the excel + self._utilities.write_fw_record_to_excel(self.dg_system_record) + def cmd_request_dg_system_record(self) -> int: """ Handles getting DG system record from firmware. @@ -176,6 +203,28 @@ """ self.logger.debug("Received a complete dg system record.") + def cmd_set_dg_system_record_excel_to_fw(self, report_address: str): + """ + Handles setting the system data that is in an excel report to the firmware. + + @param report_address: (str) the address in which its data must be written from excel + + @return: none + """ + + # Request the DG calibration record and set and observer class to callback when the calibration record is read + # back + self.cmd_request_dg_system_record() + observer = NVUtilsObserver("dg_system_record") + # Attach the observer to the list + self.attach(observer) + while not observer.received: + sleep(0.1) + self._utilities.write_excel_record_to_fw_record(self.dg_system_record, report_address, + self._utilities.SYSTEM_RECORD_TAB_NAME) + + self.cmd_set_dg_system_record(self.dg_system_record) + def cmd_set_dg_system_record(self, dg_system_record: OrderedDict) -> bool: """ Handles updating the DG system and sends it to FW. @@ -257,8 +306,8 @@ {'system_record': {'top_level_pn': ['