Index: Accel.c =================================================================== diff -u -r7a2ae3f592cf60f105b932de40c387dba3939170 -r9ae166a2e7eaa0e1115ca1c46f71cd3e9ae6ba01 --- Accel.c (.../Accel.c) (revision 7a2ae3f592cf60f105b932de40c387dba3939170) +++ Accel.c (.../Accel.c) (revision 9ae166a2e7eaa0e1115ca1c46f71cd3e9ae6ba01) @@ -50,8 +50,8 @@ #define MAX_TILT_ANGLE_DEG ( 90.0F ) ///< Maximum tilt angle (in degrees). #define DATA_PUBLISH_COUNTER_START_COUNT 30 ///< Data publish counter start count. // POST test -#define ACCEl_POST_TEST_COUNT 5 ///< Number of times to repeat POST test -#define ACCEl_POST_TEST_FAIL_MAX 3 ///< Maximum number of times POST test may fail (<= ACCEl_POST_TEST_COUNT) +#define ACCEL_POST_TEST_COUNT 5 ///< Number of times to repeat POST test +#define ACCEL_POST_TEST_FAIL_MAX 3 ///< Maximum number of times POST test may fail (<= ACCEl_POST_TEST_COUNT) /// Enumeration of accelerometer monitor states. typedef enum Accelerometer_States @@ -91,6 +91,8 @@ static F32 accelTilt[ NUM_OF_ACCEL_AXES ]; ///< Axis angles for tilt determination (filtered and converted to degrees). static U32 accelTiltErrorTimerCounter = 0; ///< used for persistence requirement on tilt error. static ACCELEROMETER_SELF_TEST_STATE_T accelSelfTestState = ACCELEROMETER_SELF_TEST_STATE_START; ///< current accelerometer self-test state. +static U08 postTestCounter = 0; ///< POST test repeat counter +static U08 postFailCounter = 0; ///< POST test fail counter static BOOL tiltErrorDetected; ///< Flag indicates a tilt error has been detected and tilt must now come below alarm clear threshold to clear alarm. static BOOL shockErrorDetected; ///< Flag indicates a shock error has been detected and g-force must now come below alarm clear threshold to clear alarm. @@ -597,21 +599,17 @@ /*********************************************************************//** * @brief * The execAccelTest function executes the state machine for the - * accelerometer self-test. + * accelerometer power on self-test (POST). Verifies Accelerometer + * reading is within tolerance. 5 Repeats on 50ms interval with + * maximum of 3 fails is intended to mitigate a false fail from + * moving or bumping the machine during test. * @details Inputs: accelSelfTestState, accelCalOffsets * @details Outputs: accelSelfTestState, accelCalOffsets, Alarm is * self-test failed * @return the current state of the accelerometer self-test. *************************************************************************/ SELF_TEST_STATUS_T execAccelTest( void ) { - // TODO Remove comment: This POST test is to make sure the Accelerometer - // reading is within tolerance, but could fail if device is bumped/moved. - // 5 Repeats on 50ms interval with 3 fails required is intended to - // mitigate a false fail from bumping the machine. Test will take 250ms. - // Requirement may need to be updated. - static U08 postTestCounter = 0; - static U08 postFailCounter = 0; SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; switch ( accelSelfTestState ) @@ -646,7 +644,7 @@ } else { - if ( postFailCounter < ACCEl_POST_TEST_FAIL_MAX ) + if ( postFailCounter < ACCEL_POST_TEST_FAIL_MAX ) { // count the failures postFailCounter++; @@ -663,11 +661,10 @@ } } - if ( postTestCounter < ACCEl_POST_TEST_COUNT ) + if ( postTestCounter < ACCEL_POST_TEST_COUNT ) { // Repeat the test postTestCounter++; - accelSelfTestState = ACCELEROMETER_SELF_TEST_STATE_IN_PROGRESS; result = SELF_TEST_STATUS_IN_PROGRESS; } else