Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -rbe4507c7fef6c9d987eba9e34369402e989e962e --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision be4507c7fef6c9d987eba9e34369402e989e962e) @@ -100,10 +100,6 @@ /// Conversion of reservoir tau in C/min to C/ms. static const F32 RESERVOIR_TAU_C_PER_MS = RESERVOIR_TEMPERATURE_TAU_C_PER_MIN / ( SEC_PER_MIN * MS_PER_SECOND ); -// ********** private function prototypes ********** - -static BOOL processCalibrationData( void ); - /*********************************************************************//** * @brief * The initReservoirs function initializes the Reservoirs module. @@ -134,7 +130,8 @@ if ( TRUE == isNewCalibrationRecordAvailable() ) { // Get the new calibration data and check its validity - processCalibrationData(); + getNVRecord2Driver( GET_CAL_RSRVRS_VOL_RECORD, (U08*)&reservoirsCalRecord, sizeof( reservoirsCalRecord ), + NUM_OF_CAL_DATA_RSRVRS, ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD ); } // publish active reservoir, fill/drain volume targets at 1 Hz. @@ -171,7 +168,8 @@ { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; - BOOL calStatus = processCalibrationData(); + BOOL calStatus = getNVRecord2Driver( GET_CAL_RSRVRS_VOL_RECORD, (U08*)&reservoirsCalRecord, sizeof( reservoirsCalRecord ), + NUM_OF_CAL_DATA_RSRVRS, ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD ); if ( TRUE == calStatus ) { @@ -754,47 +752,7 @@ return tareLoadCellRequest; } -/*********************************************************************//** - * @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: reservoirsCalRecord - * @return TRUE if the calibration record is valid, otherwise FALSE - *************************************************************************/ -static BOOL processCalibrationData( void ) -{ - BOOL status = TRUE; - U32 reservoir; - // Get the calibration record from NVDataMgmt - DG_RESERVOIR_VOLUME_RECORD_T calData = getDGReservoirsVolumeRecord(); - - for ( reservoir = 0; reservoir < NUM_OF_CAL_DATA_RSRVRS; reservoir++ ) - { -#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 data is not stored in the NV memory or it was corrupted. - if ( 0 == calData.reservoir[ reservoir ].calibrationTime ) - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_RESERVOIRS_INVALID_CAL_RECORD, (U32)reservoir ); - status = FALSE; - } -#endif - - // The calibration data was valid, update the local copy - reservoirsCalRecord.reservoir[ reservoir ].maxResidualFluid = calData.reservoir[ reservoir ].maxResidualFluid; - reservoirsCalRecord.reservoir[ reservoir ].normalFillVolume = calData.reservoir[ reservoir ].normalFillVolume; - reservoirsCalRecord.reservoir[ reservoir ].rsrvrUnfilledWeight = calData.reservoir[ reservoir ].rsrvrUnfilledWeight; - reservoirsCalRecord.reservoir[ reservoir ].rsrvrVolume = calData.reservoir[ reservoir ].rsrvrVolume; - } - - return status; -} - - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/