Index: Accel.c =================================================================== diff -u -r4f5dd6461770d92d651d83b05c38be7da6db2f7d -r59871c9964559b5137781af9c2eeed6bab18ef73 --- Accel.c (.../Accel.c) (revision 4f5dd6461770d92d651d83b05c38be7da6db2f7d) +++ Accel.c (.../Accel.c) (revision 59871c9964559b5137781af9c2eeed6bab18ef73) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Accel.c * -* @author (last) Bill Bracken -* @date (last) 10-Apr-2023 +* @author (last) Vinayakam Mani +* @date (last) 31-Aug-2023 * * @author (original) Sean Nash * @date (original) 29-Jul-2020 @@ -40,8 +40,8 @@ static const U32 NO_NEW_ACCEL_SAMPLES_TIMEOUT = ( 100 / TASK_PRIORITY_INTERVAL ); #define NOMINAL_ACCEL_VECTOR_LENGTH ( 1.0F ) ///< Expect unit vector length when system is stable. #define MAX_ACCEL_VECTOR_LENGTH_ERROR ( 0.1F ) ///< POST test looks at vector length at presumably stable moment - should be 1 +/- 0.1. -#define MAX_TILT_ANGLE ( 7.0F ) ///< Maximum tilt of system before alarm. -#define MAX_TILT_ANGLE_TO_CLEAR_ALARM ( 5.0F ) ///< Maximum tilt of system before alarm is cleared. +#define MAX_TILT_ANGLE ( 3.0F ) ///< Maximum tilt of system before alarm. +#define MAX_TILT_ANGLE_TO_CLEAR_ALARM ( 2.0F ) ///< Maximum tilt of system before alarm is cleared. /// Maximum time (in task intervals) that a tilt in excess of limit can persist before alarm. static const U32 MAX_TILT_PERSISTENCE = ( 1 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ); #define MAX_SHOCK_ACCELERATION ( 2.5F ) ///< Maximum shock (acceleration) measured on any axis before alarm. @@ -164,8 +164,8 @@ switch ( accelState ) { - case ACCELEROMETER_START_STATE: - accelState = ACCELEROMETER_MONITOR_STATE; + case ACCELEROMETER_START_STATE: + accelState = ACCELEROMETER_MONITOR_STATE; break; case ACCELEROMETER_MONITOR_STATE: @@ -190,7 +190,7 @@ * The handleAccelMonitorState function handles the accelerometer monitor * state of the accelerometer monitor state machine. * @details Inputs: accelNoNewSampleTimerCounter, accelFPGASampleCtr, - * accelAxes, accelFPGAFaultReg, accelSensorCalRecord + * accelAxes, accelFPGAFaultReg, accelSensorCalRecord, accelSelfTestState * @details Outputs: accelNoNewSampleTimerCounter, accelFPGASampleCtr, * accelAxes * alarm if accelerometer failed @@ -250,9 +250,14 @@ // filter readings to get a stable vector for tilt filterAccelReadings(); - // check tilt and shock - checkForTiltError(); - checkForShockError(); + /* check tilt and shock once accelerometer self test completed that indicates + * calibration records read from Non volatile memory during power up. + */ + if ( ACCELEROMETER_SELF_TEST_STATE_COMPLETE == accelSelfTestState ) + { + checkForTiltError(); + checkForShockError(); + } return result; }