Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -r364181b1c7ef0ae4d88a7bb0001a34e93fdb495f -r97ea48347859157d941d743deedb5b980b4c4594 --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 364181b1c7ef0ae4d88a7bb0001a34e93fdb495f) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 97ea48347859157d941d743deedb5b980b4c4594) @@ -31,9 +31,7 @@ #define PRESSURES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. #define DATA_PUBLISH_COUNTER_START_COUNT ( 5 ) ///< Data publish counter start count. #define PRESSURE_SAMPLE_FILTER_MS ( 50 ) ///< Filter pressure data for given time -#define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 50 ) -//#define PRESSURE_SAMPLE_FILTER_MS ( 200 ) ///< Filter pressure data for given time -//#define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 200 ) ///< Filter temperature data for given time +#define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 50 ) ///< Filter temperature data for given time #define SIZE_OF_PRESSURE_ROLLING_AVG ( PRESSURE_SAMPLE_FILTER_MS / TASK_PRIORITY_INTERVAL ) ///< Filtered pressure moving average. #define SIZE_OF_PRESSURETEMP_ROLLING_AVG ( PRESSURE_TEMP_SAMPLE_FILTER_MS / TASK_PRIORITY_INTERVAL ) ///< Filtered pressure temprature w/ 1 second moving average. #define MMHG_TO_PSI_CONVERSION 0.0193368F ///< MMHG to PSI conversion. @@ -54,42 +52,42 @@ /// Defined states for the pressures monitor state machine. typedef enum PresMonitor_States { - PRESSURE_INIT_STATE = 0, ///< Initialization state. - PRESSURE_CONTINUOUS_READ_STATE, ///< Continuous read sensors state. - NUM_OF_PRESSURE_STATES ///< Number of pressure monitor states. + PRESSURE_INIT_STATE = 0, ///< Initialization state. + PRESSURE_CONTINUOUS_READ_STATE, ///< Continuous read sensors state. + NUM_OF_PRESSURE_STATES ///< Number of pressure monitor states. } PRESSURE_STATE_T; /// Filter pressure reading. typedef struct { - F32 pressureReadings[ SIZE_OF_PRESSURE_ROLLING_AVG ]; ///< Holds pressure sample rolling average. - U32 pressureReadingsIdx; ///< Index for next sample in rolling average array. - F32 pressureReadingsTotal; ///< Rolling total - used to calc average. - U32 pressureReadingsCount; ///< Number of samples in rolling average buffer + F32 pressureReadings[ SIZE_OF_PRESSURE_ROLLING_AVG ]; ///< Holds pressure sample rolling average. + U32 pressureReadingsIdx; ///< Index for next sample in rolling average array. + F32 pressureReadingsTotal; ///< Rolling total - used to calc average. + U32 pressureReadingsCount; ///< Number of samples in rolling average buffer }FILTER_PRESSURE_READINGS_T; /// Filter pressuretemperature reading. typedef struct { - F32 pressureTempReadings[ SIZE_OF_PRESSURETEMP_ROLLING_AVG ]; ///< Holds pressure temperature sample rolling average. - U32 pressureTempReadingsIdx; ///< Index for next sample in rolling average array. - F32 pressureTempReadingsTotal; ///< Rolling total - used to calc average. - U32 pressureTempReadingsCount; ///< Number of samples in rolling average buffer + F32 pressureTempReadings[ SIZE_OF_PRESSURETEMP_ROLLING_AVG ]; ///< Holds pressure temperature sample rolling average. + U32 pressureTempReadingsIdx; ///< Index for next sample in rolling average array. + F32 pressureTempReadingsTotal; ///< Rolling total - used to calc average. + U32 pressureTempReadingsCount; ///< Number of samples in rolling average buffer }FILTER_PRESSURE_TEMPERATURE_READINGS_T; // ********** private data ********** -static OVERRIDE_F32_T filteredcurrentPressureReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< filtered current pressure sensor pressure readings (overrideable). -static OVERRIDE_F32_T filteredcurrentPresTempReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< filtered current pressure sensor temperature readings (overrideable). -//static DD_PRES_SENSORS_CAL_RECORD_T pressuresCalRecord; ///< Pressures calibration record. +static OVERRIDE_F32_T filteredcurrentPressureReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< filtered current pressure sensor pressure readings (overrideable). +static OVERRIDE_F32_T filteredcurrentPresTempReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< filtered current pressure sensor temperature readings (overrideable). +//static DD_PRES_SENSORS_CAL_RECORD_T pressuresCalRecord; ///< Pressures calibration record. -static FILTER_PRESSURE_READINGS_T filteredPressureReadings[NUM_OF_PRESSURE_SENSORS]; ///< Filtered pressure reading for pressure sensors. -static FILTER_PRESSURE_TEMPERATURE_READINGS_T filteredPressureTempReadings[NUM_OF_PRESSURE_SENSORS]; ///< Filtered pressure reading for pressure sensors. -static PRESSURE_STATE_T pressuresState; ///< current state of pressure monitor state machine. -static U32 ddPressuresDataPublicationTimerCounter; ///< used to schedule DD pressure data publication to CAN bus. -static U32 fpPressuresDataPublicationTimerCounter; ///< used to schedule FP pressure data publication to CAN bus. -static OVERRIDE_U32_T ddPressuresDataPublishInterval; ///< DD Pressure data publish interval. -static OVERRIDE_U32_T fpPressuresDataPublishInterval; ///< FP Pressure data publish interval. +static FILTER_PRESSURE_READINGS_T filteredPressureReadings[NUM_OF_PRESSURE_SENSORS]; ///< Filtered pressure reading for pressure sensors. +static FILTER_PRESSURE_TEMPERATURE_READINGS_T filteredPressureTempReadings[NUM_OF_PRESSURE_SENSORS]; ///< Filtered pressure reading for pressure sensors. +static PRESSURE_STATE_T pressuresState; ///< current state of pressure monitor state machine. +static U32 ddPressuresDataPublicationTimerCounter; ///< used to schedule DD pressure data publication to CAN bus. +static U32 fpPressuresDataPublicationTimerCounter; ///< used to schedule FP pressure data publication to CAN bus. +static OVERRIDE_U32_T ddPressuresDataPublishInterval; ///< DD Pressure data publish interval. +static OVERRIDE_U32_T fpPressuresDataPublishInterval; ///< FP Pressure data publish interval. // ********** private function prototypes ********** @@ -112,7 +110,7 @@ { U32 i; - pressuresState = PRESSURE_INIT_STATE; + pressuresState = PRESSURE_INIT_STATE; ddPressuresDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; fpPressuresDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; @@ -319,7 +317,6 @@ } } -// ToDo decide once BARO sensor location is finalized /*********************************************************************//** * @brief * The getConvertedPressure function converts the pressure in PSI unit and @@ -332,6 +329,7 @@ *************************************************************************/ static F32 getConvertedPressure( PRESSURE_SENSORS_T sensor, F32 pressure ) { + //TODO : Waiting for TD firmware implementation for Baro sensor // F32 baroPressurePSI = getPressure( BARO_PRES ) * MMHG_TO_PSI_CONVERSION; // calibrated pressure