Index: dialin/dg/calibration_record.py =================================================================== diff -u -r04d9678a26c46fe1567d9e8eecd80414a94ee4bc -re0aac8af8cd14024b89f241bb7b92ddd9bc4956e --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision 04d9678a26c46fe1567d9e8eecd80414a94ee4bc) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision e0aac8af8cd14024b89f241bb7b92ddd9bc4956e) @@ -167,6 +167,7 @@ Handles updating the DG calibration record with the newest calibration_record data of a hardware and sends it to FW. + @param dg_calibration_record: (OrderedDict) the dg calibration record to be sent @return: True upon success, False otherwise """ Index: dialin/dg/service_record.py =================================================================== diff -u -r04d9678a26c46fe1567d9e8eecd80414a94ee4bc -re0aac8af8cd14024b89f241bb7b92ddd9bc4956e --- dialin/dg/service_record.py (.../service_record.py) (revision 04d9678a26c46fe1567d9e8eecd80414a94ee4bc) +++ dialin/dg/service_record.py (.../service_record.py) (revision e0aac8af8cd14024b89f241bb7b92ddd9bc4956e) @@ -138,6 +138,7 @@ """ Handles updating the DG service record and sends it to FW. + @param dg_service_record: (OrderedDict) the dg service record to be sent @return: True upon success, False otherwise """ record_packets = self._utilities.prepare_record_to_send_to_fw(dg_service_record) Index: dialin/dg/system_record.py =================================================================== diff -u -r04d9678a26c46fe1567d9e8eecd80414a94ee4bc -re0aac8af8cd14024b89f241bb7b92ddd9bc4956e --- dialin/dg/system_record.py (.../system_record.py) (revision 04d9678a26c46fe1567d9e8eecd80414a94ee4bc) +++ dialin/dg/system_record.py (.../system_record.py) (revision e0aac8af8cd14024b89f241bb7b92ddd9bc4956e) @@ -62,13 +62,6 @@ msg_id = MsgIds.MSG_ID_DG_SEND_SYSTEM_RECORD.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_dg_system_sync) - def get_dg_system_record(self): - """ - Handles getting HD calibration_record data from firmware. - - @return: None - """ - def cmd_request_dg_system_record(self): """ Handles getting DG system record from firmware. @@ -151,6 +144,7 @@ """ Handles updating the DG system and sends it to FW. + @param dg_system_record: (OrderedDict) the dg system record to be sent @return: True upon success, False otherwise """ record_packets = self._utilities.prepare_record_to_send_to_fw(dg_system_record) Index: dialin/hd/calibration_record.py =================================================================== diff -u -r04d9678a26c46fe1567d9e8eecd80414a94ee4bc -re0aac8af8cd14024b89f241bb7b92ddd9bc4956e --- dialin/hd/calibration_record.py (.../calibration_record.py) (revision 04d9678a26c46fe1567d9e8eecd80414a94ee4bc) +++ dialin/hd/calibration_record.py (.../calibration_record.py) (revision e0aac8af8cd14024b89f241bb7b92ddd9bc4956e) @@ -52,7 +52,7 @@ self._raw_cal_record = [] self._utilities = NVOpsUtils(logger=self.logger) # HD Calibration main record - self.hd_calibration_record = OrderedDict() + self.hd_calibration_record = self._setup_base_calibration_record() if self.can_interface is not None: @@ -61,29 +61,8 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_hd_calibration_sync) - # Prepare the calibration_record record by putting sub-dictionaries together - self._setup_base_calibration_record() - - def init_excel_report(self, directory: str): + def cmd_request_hd_calibration_record(self): """ - Prepares the excel report in the provided directory - @param directory: (str) the directory - @return: None - """ - - # Prepare the excel report and workspace - self._utilities.prepare_excel_report('HD', 'Calibration', directory) - - def is_reading_record_done(self): - """ - Handles getting the status of reading record - - @return: True if reading is done otherwise False - """ - return self._utilities.get_writing_to_excel_status() - - def get_hd_calibration_record(self): - """ Handles getting HD calibration_record data from firmware. @return: None @@ -99,7 +78,7 @@ """ Handles getting HD calibration_record record from firmware. - @return: None + @return: 1 upon success, False otherwise """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, message_id=MsgIds.MSG_ID_HD_GET_CALIBRATION_RECORD.value) @@ -116,7 +95,6 @@ self.logger.debug("Timeout!!!!") return False - @_publish(["current_message", "total_messages", "received_msg_length", "service_data", "hd_calibration_record"]) def _handler_hd_calibration_sync(self, message): """ Handles published HD calibration_record record messages. DG calibration_record records are captured for @@ -153,31 +131,28 @@ # Done with receiving the messages self._is_getting_cal_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_calibration_record, self._raw_cal_record, - write_to_excel=self._write_fw_data_to_excel) + self._utilities.process_received_record_from_fw(self.hd_calibration_record, self._raw_cal_record) + self._handler_received_complete_hd_calibration_record() - def set_hd_calibration_record(self): + @_publish(["hd_calibration_record"]) + def _handler_received_complete_hd_calibration_record(self): """ + Publishes the received system record + + @return: None + """ + self.logger.debug("Received a complete hd calibration record.") + + def cmd_set_hd_calibration_record(self, hd_calibration_record: OrderedDict): + """ Handles updating the HD calibration_record record with the newest calibration_record data of a hardware and sends it to FW. + @param hd_calibration_record: (OrderedDict) the hd calibration record to be send @return: none """ - # Read the data from firmware but do not update the excel document - # At this step, another read from firmware is requested internally to update the dictionary. - # The values in the dictionary is compared against the excel report and if they are different, it automatically - # sets the calibration time and calculates the CRC for that group. By default once a read from firmware is - # requested, the excel report is updated automatically. - self._write_fw_data_to_excel = False - self.get_hd_calibration_record() - # Wait until reading calibration record from firmware is updated - while self._utilities.get_reading_record_status() is not True: - time.sleep(self._DIALIN_RECORD_UPDATE_DELAY_S) + record_packets = self._utilities.prepare_record_to_send_to_fw(hd_calibration_record) - # Write the excel record - self._utilities.write_excel_record_to_calibration_record(self.hd_calibration_record) - record_packets = self._utilities.prepare_record_to_send_to_fw(self.hd_calibration_record) - self.logger.debug('Setting HD calibration record') # Update all the data packets with the last message count since is the number of messages that firmware @@ -204,8 +179,10 @@ """ Handles assembling the sub dictionaries of each hardware group to make the main HD calibration_record record. - @return: None + @return: (OrderedDict) the assembled hd calibration record """ + result = OrderedDict() + groups_byte_size = 0 # create a list of the functions of the sub dictionaries functions = [self._prepare_pumps_record(), self._prepare_valves_record(), @@ -217,7 +194,7 @@ # Update the groups bytes size so far to be use to padding later groups_byte_size += function[1] # Update the calibration record - self.hd_calibration_record.update(function[0]) + result.update(function[0]) # Build the CRC of the main calibration_record record record_crc = OrderedDict({'crc': ['