Index: dialin/dg/calibration_record.py =================================================================== diff -u -re7b8c85a964323350d72bd594a90acc0be57fd78 -r438d803f6042b14c39ffb9bbbfdf61a3d9e59d17 --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision e7b8c85a964323350d72bd594a90acc0be57fd78) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision 438d803f6042b14c39ffb9bbbfdf61a3d9e59d17) @@ -13,7 +13,9 @@ # @date (original) 12-Feb-2021 # ############################################################################ +import os.path import struct +import sys import time from collections import OrderedDict from logging import Logger @@ -234,6 +236,7 @@ @param previous_record: (OrderedDict) the dg calibration record to be sent @return: True upon success, False otherwise """ + transfer_status = 1 # Pass the new changes as well as the previous calibration record record_packets = self._utilities.prepare_record_to_send_to_fw(previous_record) self.logger.debug('Setting DG calibration started') @@ -252,14 +255,19 @@ payload=payload) received_message = self.can_interface.send(message) + transfer_status = received_message['message'][6] # If there is no content... if received_message is None: self.logger.debug("Timeout!!!!") return False + elif transfer_status == 0: + self.logger.debug("Sending DG calibration record failed") + return False - self.logger.debug("Finished sending DG calibration record.") - return True + if transfer_status == 1: + self.logger.debug("Finished sending DG calibration record.") + return True def _prepare_dg_calibration_record(self): """ Index: dialin/dg/load_cells.py =================================================================== diff -u -r3a70bfb451b74106348c064c34f19934aadd9119 -r438d803f6042b14c39ffb9bbbfdf61a3d9e59d17 --- dialin/dg/load_cells.py (.../load_cells.py) (revision 3a70bfb451b74106348c064c34f19934aadd9119) +++ dialin/dg/load_cells.py (.../load_cells.py) (revision 438d803f6042b14c39ffb9bbbfdf61a3d9e59d17) @@ -56,6 +56,11 @@ self.load_cell_B1 = 0.0 self.load_cell_B2 = 0.0 + self.load_cell_A1_raw = 0.0 + self.load_cell_A2_raw = 0.0 + self.load_cell_B1_raw = 0.0 + self.load_cell_B2_raw = 0.0 + def get_load_cells(self): """ Gets the current load cell weights @@ -74,20 +79,23 @@ @return: None """ - a1 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) - a2 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2])) - b1 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3])) - b2 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4])) + self.load_cell_A1 = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] + self.load_cell_A2 = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] + self.load_cell_B1 = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] + self.load_cell_B2 = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] + self.load_cell_A1_raw = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] + self.load_cell_A2_raw = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] + self.load_cell_B1_raw = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.load_cell_B2_raw = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] - self.load_cell_A1 = a1[0] - self.load_cell_A2 = a2[0] - self.load_cell_B1 = b1[0] - self.load_cell_B2 = b2[0] - def cmd_load_cell_override(self, sensor: int, grams: float, reset: int = NO_RESET) -> int: """ Constructs and sends the load cell override command Index: dialin/utils/nv_ops_utils.py =================================================================== diff -u -r6f64f72d83c3500fccf4dc3e235da4dd226ca2dd -r438d803f6042b14c39ffb9bbbfdf61a3d9e59d17 --- dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision 6f64f72d83c3500fccf4dc3e235da4dd226ca2dd) +++ dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision 438d803f6042b14c39ffb9bbbfdf61a3d9e59d17) @@ -814,9 +814,9 @@ temp_buffer.append(NVOpsUtils.get_processed_characters(new_record[group][key])) else: temp_buffer.append(struct.pack(data_type, current_value)) - except: # Exception as e: - raise - # self.logger.error("Failed to prepare record packets for fw: {0}".format(e)) + except: #Exception as e: + #raise + self.logger.error("Failed to prepare record packets for fw") # Return the latest calculated values as tuple return temp_buffer, current_message_count, current_payload_length Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r6f64f72d83c3500fccf4dc3e235da4dd226ca2dd -r438d803f6042b14c39ffb9bbbfdf61a3d9e59d17 --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 6f64f72d83c3500fccf4dc3e235da4dd226ca2dd) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 438d803f6042b14c39ffb9bbbfdf61a3d9e59d17) @@ -49,12 +49,12 @@ # It creates a folder called DG_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 you computer. - dg.calibration_record.cmd_get_dg_calibration_record_report() + #dg.calibration_record.cmd_get_dg_calibration_record_report() # Use cmd_set_dg_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 - #dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-08-09-DG-Record.xlsx') + dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-08-12-DG-Record.xlsx') # For resetting the calibration record to benign values, use the function below #dg.calibration_record.cmd_reset_dg_calibration_record() Index: tests/hd_nvm_scripts.py =================================================================== diff -u -re7b8c85a964323350d72bd594a90acc0be57fd78 -r438d803f6042b14c39ffb9bbbfdf61a3d9e59d17 --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision e7b8c85a964323350d72bd594a90acc0be57fd78) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 438d803f6042b14c39ffb9bbbfdf61a3d9e59d17) @@ -55,7 +55,7 @@ # 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/2022-07-26-HD-Record.xlsx') + hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-08-13-HD-Record.xlsx') # For resetting the calibration record to benign values, use the function below #hd.calibration_record.cmd_reset_hd_calibration_record() @@ -68,8 +68,8 @@ if hd.cmd_log_in_to_hd(): # Comment this function if not needed - run_sw_configs_commands() + #run_sw_configs_commands() # Comment this function if not needed - #run_calibration_commands() + run_calibration_commands()