Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -rf17da591ff546ff00dd52299b73c5edaad92c65a -r2acaf549519854f7e6de1511d541582267f4d1e8 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision f17da591ff546ff00dd52299b73c5edaad92c65a) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) @@ -18,7 +18,8 @@ #include "PresOccl.h" #include "AlarmMgmt.h" #include "FPGA.h" -#include "ModeTreatmentParams.h" +#include "ModeTreatmentParams.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" @@ -145,6 +146,8 @@ static U32 venPressureReadingsShortIdx = 0; ///< Index for next sample in rolling average array. static F32 venPressureReadingsShortTotal = 0.0; ///< Rolling total - used to calc average. static U32 venPressureReadingsShortCount = 0; ///< Number of samples in flow rolling average buffer. +static HD_PRESSURE_SENSORS_CAL_RECORD_T pressureSensorsCalRecord; ///< Pressure sensors calibration record. +static HD_OCCLUSION_SENSORS_CAL_RECORD_T occlusionSensorsCalRecord; ///< Occlusion sensors calibration record. // ********** private function prototypes ********** @@ -818,6 +821,37 @@ #endif return result; +} + +/*********************************************************************//** + * @brief + * The execPresOcclSelfTest function executes the PresOccl self-test. + * @details Inputs: none + * @details Outputs: pressureSensorsCalRecord, occlusionSensorsCalRecord + * @return the result of the PresOccl self-test. + *************************************************************************/ +SELF_TEST_STATUS_T execPresOcclSelfTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; + BOOL calStatus = FALSE; + + // Get the pressure sensors and occlusion sensors calibration records + calStatus |= getNVRecord2Driver( GET_CAL_PRESSURE_SENSORS, (U08*)&pressureSensorsCalRecord, sizeof( HD_PRESSURE_SENSORS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_HD_PRESSURE_SESNSORS, ALARM_ID_NO_ALARM ); + + calStatus |= getNVRecord2Driver( GET_CAL_OCCLUSION_SESNSORS, (U08*)&occlusionSensorsCalRecord, sizeof( HD_OCCLUSION_SENSORS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_OCCLUSION_SENSORS, ALARM_ID_NO_ALARM ); + + if ( TRUE == calStatus ) + { + result = SELF_TEST_STATUS_PASSED; + } + else + { + result = SELF_TEST_STATUS_FAILED; + } + + return result; } /*************************************************************************