Index: Accel.c =================================================================== diff -u -r78ae73c1838249f3f6391cf2590d3b7f028f667c -rce0f1a57c2433cf33d61b8da37fab91f2012d723 --- Accel.c (.../Accel.c) (revision 78ae73c1838249f3f6391cf2590d3b7f028f667c) +++ Accel.c (.../Accel.c) (revision ce0f1a57c2433cf33d61b8da37fab91f2012d723) @@ -84,10 +84,10 @@ static U32 accelReadingsCount = 0; ///< number of samples in flow rolling average buffer static F32 accelAvgVector[ NUM_OF_ACCEL_AXES ]; ///< Filtered accelerometer vector for tilt 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 U32 accelTiltErrorTimerCounter = 0; ///< used for persistence requirement on tilt error 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. +static BOOL shockErrorDetected; ///< Flag indicates a shock error has been detected and g-force must now come below alarm clear threshold to clear alarm. static ACCELEROMETER_SELF_TEST_STATE_T accelSelfTestState = ACCELEROMETER_SELF_TEST_STATE_START; ///< current accelerometer self-test state @@ -500,6 +500,14 @@ SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_EXCESSIVE_TILT, x, y ) #endif } + else if ( ( TRUE == tiltErrorDetected ) && ( fabs( x ) > MAX_TILT_ANGLE_TO_CLEAR_ALARM ) && ( fabs( y ) > MAX_TILT_ANGLE_TO_CLEAR_ALARM ) ) + { +#ifdef _DG_ + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_EXCESSIVE_TILT, x, y ) +#else + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_EXCESSIVE_TILT, x, y ) +#endif + } else if ( ( fabs( x ) <= MAX_TILT_ANGLE_TO_CLEAR_ALARM ) && ( fabs( y ) <= MAX_TILT_ANGLE_TO_CLEAR_ALARM ) ) { accelTiltErrorTimerCounter = 0; @@ -548,8 +556,8 @@ // has system just experienced an excessive shock? if ( maxAll > MAX_SHOCK_ACCELERATION ) - { - shockErrorDetected = TRUE; + { + shockErrorDetected = TRUE; #ifdef _DG_ SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_SHOCK, (F32)maxAxis, getMaxAccelAxis( maxAxis ) ) #else