Index: Accel.c =================================================================== diff -u -r87250a29e916894bc2ee2b6966e7df521a905bc6 -r19d562b24a5269e04108116ad942d31dbb3961f1 --- Accel.c (.../Accel.c) (revision 87250a29e916894bc2ee2b6966e7df521a905bc6) +++ Accel.c (.../Accel.c) (revision 19d562b24a5269e04108116ad942d31dbb3961f1) @@ -37,9 +37,10 @@ #define NOMINAL_ACCEL_VECTOR_LENGTH ( 1.0 ) ///< Expect unit vector length when system is stable #define MAX_ACCEL_VECTOR_LENGTH_ERROR ( 0.1 ) ///< POST test looks at vector length at presumably stable moment - should be 1 +/- 0.1 #define MAX_TILT_ANGLE ( 7.0 ) ///< Maximum tilt of system before alarm -#define MIN_TILT_ANGLE_TO_CLEAR_ALARM ( 5.0 ) ///< Minimum tilt of system before alarm is cleared +#define MAX_TILT_ANGLE_TO_CLEAR_ALARM ( 5.0 ) ///< Maximum tilt of system before alarm is cleared #define MAX_TILT_PERSISTENCE ( 1 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Maximum time (in task intervals) that a tilt in excess of limit can persist before alarm -#define MAX_SHOCK_ACCELERATION ( 4.0 ) ///< Maximum shock (acceleration) measured on any axis before alarm +#define MAX_SHOCK_ACCELERATION ( 5.0 ) ///< Maximum shock (acceleration) measured on any axis before alarm +#define MAX_SHOCK_TO_CLEAR_ALARM ( 1.0 ) ///< Maximum shock (acceleration) measured on any axis in order to clear alarm #define MAX_TILT_G ( 1.0 ) ///< Maximum tilt (in g) #define MAX_TILT_ANGLE_DEG ( 90.0 ) ///< Maximum tilt angle (in degrees) @@ -171,7 +172,7 @@ F32 xMax, yMax, zMax; // max axis readings (in gs) U16 cnt; // FPGA read counter - // read FPGA accelerometer registers + // Read FPGA accelerometer registers getFPGAAccelAxes( &x, &y, &z ); getFPGAAccelMaxes( &xm, &ym, &zm ); getFPGAAccelStatus( &cnt, &accelFPGAFaultReg ); @@ -351,9 +352,9 @@ F32 zt = accelTilt[ ACCEL_AXIS_Z ]; broadcastAccelData( x, y, z, xm, ym, zm, xt, yt, zt ); - // reset publication timer counter + // Reset publication timer counter accelDataPublicationTimerCounter = 0; - // reset max axes + // Reset max axes accelMaxs[ ACCEL_AXIS_X ].data = 0.0; accelMaxs[ ACCEL_AXIS_Y ].data = 0.0; accelMaxs[ ACCEL_AXIS_Z ].data = 0.0; @@ -480,7 +481,7 @@ #endif } } - else if ( ( fabs( x ) <= MIN_TILT_ANGLE_TO_CLEAR_ALARM ) && ( fabs( y ) <= MIN_TILT_ANGLE_TO_CLEAR_ALARM ) ) + else if ( ( fabs( x ) <= MAX_TILT_ANGLE_TO_CLEAR_ALARM ) && ( fabs( y ) <= MAX_TILT_ANGLE_TO_CLEAR_ALARM ) ) { accelTiltErrorTimerCounter = 0; #ifdef _DG_ @@ -533,6 +534,14 @@ #else SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_SHOCK, (F32)maxAxis, getMaxAccelAxis( maxAxis ) ) #endif + } + else if ( maxAll <= MAX_SHOCK_TO_CLEAR_ALARM ) + { +#ifdef _DG_ + clearAlarmCondition( ALARM_ID_DG_SHOCK ); +#else + clearAlarmCondition( ALARM_ID_HD_SHOCK ); +#endif } } @@ -554,7 +563,7 @@ { CALIBRATION_DATA_T cal; - // retrieve blood flow sensor calibration data + // Retrieve blood flow sensor calibration data if ( TRUE == getCalibrationData( &cal ) ) { accelCalOffsets[ ACCEL_AXIS_X ] = cal.accelXOffset;