Index: Common.h =================================================================== diff -u -r193839467da470a839ec2f2a3a04d7ed1a2ad837 -r6f87c4d6e2c23308af2524cea6aed41e679ca000 --- Common.h (.../Common.h) (revision 193839467da470a839ec2f2a3a04d7ed1a2ad837) +++ Common.h (.../Common.h) (revision 6f87c4d6e2c23308af2524cea6aed41e679ca000) @@ -34,6 +34,7 @@ typedef float F32; ///< 32-bit floating point type typedef double F64; ///< 64-bit floating point type +typedef long long U64; ///< 64-bit signed integer type typedef unsigned int U32; ///< 32-bit unsigned integer type typedef int S32; ///< 32-bit signed integer type typedef unsigned short U16; ///< 16-bit unsigned integer type @@ -86,7 +87,7 @@ // **** Common Definitions **** #define NEARLY_INFINITY 1.0E20 ///< Value that is nearly infinity. -#define NEARLY_ZERO 0.00000001 ///< Value that is nearly zero. Used for floating point zero comparisons (e.g. divide by zero checks) +#define NEARLY_ZERO 0.00000001F ///< Value that is nearly zero. Used for floating point zero comparisons (e.g. divide by zero checks) #define HEX_64_K 0x10000 ///< 64K (65536 in decimal) #define HEX_32_BIT_FULL_SCALE 0xFFFFFFFF ///< 32-bit full scale value #define MASK_OFF_MSB 0x00FF ///< Bits to mask off the most significant byte of a 2-byte word Index: NVDataMgmtDGRecords.h =================================================================== diff -u -r449284762afeab963030f9eccd6cfded649abbad -r6f87c4d6e2c23308af2524cea6aed41e679ca000 --- NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision 449284762afeab963030f9eccd6cfded649abbad) +++ NVDataMgmtDGRecords.h (.../NVDataMgmtDGRecords.h) (revision 6f87c4d6e2c23308af2524cea6aed41e679ca000) @@ -100,6 +100,7 @@ CAL_DATA_RO_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data RO pump outlet pressure sensor. CAL_DATA_DRAIN_PUMP_INLET_PRES_SENSOR, ///< DG calibration data drain pump inlet pressure sensor. CAL_DATA_DRAIN_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data drain pump outlet pressure sensor. + CAL_DATA_BAROMETRIC_PRES_SENSOR, ///< DG calibration data barometric pressure sensor. NUM_OF_CAL_DATA_PRES_SENSORS, ///< Number of calibration data pressure sensors. } CAL_DATA_DG_PRES_SENSORS_T; @@ -263,7 +264,7 @@ POLYNOMIAL_CAL_PAYLOAD_T pressureSensors[ NUM_OF_CAL_DATA_PRES_SENSORS ]; ///< Pressure sensors to calibrate. // NOTE: The reserved space is for 6 sensors. This portion of the struct should be eventually be // reduced, so #define was not used for the size of the array - POLYNOMIAL_CAL_PAYLOAD_T reservedSpace[ 6 ]; ///< Reserved space for future pressure sensors. + POLYNOMIAL_CAL_PAYLOAD_T reservedSpace[ 5 ]; ///< Reserved space for future pressure sensors. } DG_PRES_SENSORS_CAL_RECORD_T; /// Flow sensors calibration structure Index: RTC.c =================================================================== diff -u -r9994d19d718b4a64426a4dd93b5a33fa55e5e2c4 -r6f87c4d6e2c23308af2524cea6aed41e679ca000 --- RTC.c (.../RTC.c) (revision 9994d19d718b4a64426a4dd93b5a33fa55e5e2c4) +++ RTC.c (.../RTC.c) (revision 6f87c4d6e2c23308af2524cea6aed41e679ca000) @@ -178,37 +178,31 @@ // ********** private data ********** -static RTC_SELF_TEST_STATE_T RTCSelfTestState = RTC_SELF_TEST_STATE_START; ///< Self test variable. -static RTC_GET_DATA_STATE_T RTCServiceState = RTC_SEND_COMMAND; ///< RTC get data variable. -static RTC_EXEC_STATE_T RTCExecState = RTC_EXEC_STATE_WAIT_FOR_POST; ///< RTC exec state variable. -static SELF_TEST_STATUS_T RTCSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< RTC self-test status variable. -static RTC_RAM_STATUS_T RTCRAMStatus = RTC_RAM_STATUS_IDLE; ///< RTC RAM status variable. -static RTC_RAM_STATE_T RTCRAMState = RTC_RAM_STATE_READY; ///< RTC RAM state. +static RTC_SELF_TEST_STATE_T RTCSelfTestState; ///< Self test variable. +static RTC_GET_DATA_STATE_T RTCServiceState; ///< RTC get data variable. +static RTC_EXEC_STATE_T RTCExecState; ///< RTC exec state variable. +static SELF_TEST_STATUS_T RTCSelfTestResult; ///< RTC self-test status variable. +static RTC_RAM_STATUS_T RTCRAMStatus; ///< RTC RAM status variable. +static RTC_RAM_STATE_T RTCRAMState; ///< RTC RAM state. static RTC_TIMESTAMP_T RTCTimestampStruct; ///< Timestamp record - last read from RTC. static RTC_TIMESTAMP_T RTCNewTimestampStruct; ///< New timestamp record that will hold the new time to be written to RTC. - -static U32 RTCSelfTestTimer = 0; ///< Self test timer. -static U32 RTCPreviousSecond = 0; ///< Previous second for self-test comparison. -static U32 RAMBufferLength = 0; ///< RAM buffer length for RAM operations. -static U32 lastEpochTime = 0; ///< Last epoch time. -static U32 previousTransferLength = 0; ///< Previous transfer length. - -static U32 timeCounter = 1; ///< Initial time counter (1). -static U32 numberOfFailedRTCTransfers = 1; ///< Initial number of failed RTC transactions (1). - -static BOOL hasWriteToRTCRequested = FALSE; ///< Flag to request RTC write. -static BOOL hasWriteToRAMRequested = FALSE; ///< Flag to write to RTC RAM. -static BOOL hasReadFromRAMRequested = FALSE; ///< Flag to read from RTC RAM. -static BOOL isRTCServiceOnEntry = FALSE; ///< Flag to check if service is on entry. -static BOOL isTimestampBufferReady = FALSE; ///< Flag to check if the timestamp buffer is ready. - +static U32 RTCSelfTestTimer; ///< Self test timer. +static U32 RTCPreviousSecond; ///< Previous second for self-test comparison. +static U32 RAMBufferLength; ///< RAM buffer length for RAM operations. +static U32 lastEpochTime; ///< Last epoch time. +static U32 previousTransferLength; ///< Previous transfer length. +static U32 timeCounter; ///< Initial time counter (1). +static U32 numberOfFailedRTCTransfers; ///< Initial number of failed RTC transactions (1). +static BOOL hasWriteToRTCRequested; ///< Flag to request RTC write. +static BOOL hasWriteToRAMRequested; ///< Flag to write to RTC RAM. +static BOOL hasReadFromRAMRequested; ///< Flag to read from RTC RAM. +static BOOL isRTCServiceOnEntry; ///< Flag to check if service is on entry. +static BOOL isTimestampBufferReady; ///< Flag to check if the timestamp buffer is ready. static U16 rxBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to receive data from RTC. static U16 txBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to transmit data to RTC. - static U16 prepRAMBuffer[ RTC_RAM_PREP_BUFFER_LENGTH ]; ///< Buffer to send prep read/write commands to RTC RAM. static U16 RAMBuffer[ MIBSPI_MAX_BUFFER_LENGTH ]; ///< Buffer to read RTC RAM data. - -static U16 previousFPGATimerCount = 0; ///< Previous FPGA timer count; +static U16 previousFPGATimerCount; ///< Previous FPGA timer count; /// Array of days in each month. Assumes non-leap year. Must adjust days in February if leap year. static U32 daysInMonth[ 12 ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; @@ -246,8 +240,25 @@ *************************************************************************/ void initRTC( void ) { - RTCSelfTestState = RTC_SELF_TEST_STATE_START; - RTCServiceState = RTC_SEND_COMMAND; + RTCSelfTestState = RTC_SELF_TEST_STATE_START; + RTCServiceState = RTC_SEND_COMMAND; + RTCExecState = RTC_EXEC_STATE_WAIT_FOR_POST; + RTCSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; + RTCRAMStatus = RTC_RAM_STATUS_IDLE; + RTCRAMState = RTC_RAM_STATE_READY; + RTCSelfTestTimer = 0; + RTCPreviousSecond = 0; + RAMBufferLength = 0; + lastEpochTime = 0; + previousTransferLength = 0; + timeCounter = 1; + numberOfFailedRTCTransfers = 1; + hasWriteToRTCRequested = FALSE; + hasWriteToRAMRequested = FALSE; + hasReadFromRAMRequested = FALSE; + isRTCServiceOnEntry = FALSE; + isTimestampBufferReady = FALSE; + previousFPGATimerCount = 0; } /*********************************************************************//** @@ -1321,8 +1332,8 @@ if ( TRUE == isRTCFunctional() ) { U32 RTCCurrentSecond = rxBuffer[ RTC_SECONDS_INDEX ]; - RTCPreviousSecond = RTCCurrentSecond; - result = RTC_SELF_TEST_STATE_WAIT_FOR_FIRST_SECOND; + RTCPreviousSecond = RTCCurrentSecond; + result = RTC_SELF_TEST_STATE_WAIT_FOR_FIRST_SECOND; } else {