Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -r94a190522ce398399c7b93c59f788d7666ec0060 -ra069eb423b26296eb95214e18383c81adae07497 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 94a190522ce398399c7b93c59f788d7666ec0060) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision a069eb423b26296eb95214e18383c81adae07497) @@ -84,7 +84,6 @@ // ********** private function prototypes ********** -static BOOL processCalibrationData( void ); static void monitorLoadCellsWeightOutOfRange( LOAD_CELL_ID_T loadCell ); static void monitorLoadCellsPrimaryBackupDriftOutOfRange( void ); @@ -178,8 +177,8 @@ // Check if a new calibration is available if ( TRUE == isNewCalibrationRecordAvailable() ) { - // Get the new calibration data and check its validity - processCalibrationData(); + getNVRecord2Driver( GET_CAL_LOAD_CELL_SENSORS, (U08*)&loadCellsCalRecord, sizeof( DG_LOAD_CELLS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_LOAD_CELLS, ALARM_ID_DG_LOAD_CELLS_INVALID_CALIBRATION ); // Zero the current tare values when new calibration data is available loadcells[ LOAD_CELL_RESERVOIR_1_PRIMARY ].autoCalOffset = 0.0; @@ -270,7 +269,8 @@ { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; - BOOL calStatus = processCalibrationData(); + BOOL calStatus = getNVRecord2Driver( GET_CAL_LOAD_CELL_SENSORS, (U08*)&loadCellsCalRecord, sizeof( DG_LOAD_CELLS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_LOAD_CELLS, ALARM_ID_DG_LOAD_CELLS_INVALID_CALIBRATION ); if ( TRUE == calStatus ) { @@ -440,47 +440,6 @@ /*********************************************************************//** * @brief - * The processCalibrationData function gets the calibration data and makes - * sure it is valid by checking the calibration date. The calibration date - * should not be 0. - * @details Inputs: none - * @details Outputs: loadCellsCalRecord - * @return TRUE if the calibration record is valid, otherwise FALSE - *************************************************************************/ -static BOOL processCalibrationData( void ) -{ - BOOL status = TRUE; - U32 cell; - - // Get the calibration record from NVDataMgmt - DG_LOAD_CELLS_CAL_RECORD_T calData = getDGLoadCellsCalibrationRecord(); - - for ( cell = 0; cell < NUM_OF_CAL_DATA_LOAD_CELLS; cell++ ) - { -#ifndef SKIP_CAL_CHECK - // Check if the calibration data that was received from NVDataMgmt is legitimate - // The calibration date item should not be zero. If the calibration date is 0, - // then the load cells data is not stored in the NV memory or it was corrupted. - if ( 0 == calData.loadCells[ cell ].calibrationTime ) - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_LOAD_CELLS_INVALID_CALIBRATION, (U32)cell ); - status = FALSE; - } -#endif - - // The calibration data was valid, update the local copy - loadCellsCalRecord.loadCells[ cell ].fourthOrderCoeff = calData.loadCells[ cell ].fourthOrderCoeff; - loadCellsCalRecord.loadCells[ cell ].thirdOrderCoeff = calData.loadCells[ cell ].thirdOrderCoeff; - loadCellsCalRecord.loadCells[ cell ].secondOrderCoeff = calData.loadCells[ cell ].secondOrderCoeff; - loadCellsCalRecord.loadCells[ cell ].gain = calData.loadCells[ cell ].gain; - loadCellsCalRecord.loadCells[ cell ].offset = calData.loadCells[ cell ].offset; - } - - return status; -} - -/*********************************************************************//** - * @brief * The monitorLoadCellsWeightOutOfRange function monitors the weight of the * load cells and if they are not in range, it raises an alarm. * @details Inputs: none