Index: NVDataMgmt.h =================================================================== diff -u -r0df8e5e99715de10f8936a9d41c28f4c2a4dacc6 -r45f39d237e109f91b4b7e40fdb2dc00bd673eef0 --- NVDataMgmt.h (.../NVDataMgmt.h) (revision 0df8e5e99715de10f8936a9d41c28f4c2a4dacc6) +++ NVDataMgmt.h (.../NVDataMgmt.h) (revision 45f39d237e109f91b4b7e40fdb2dc00bd673eef0) @@ -75,11 +75,11 @@ /// DG pressure sensors enumeration. typedef enum dg_pressure_sensors { - CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, - CAL_DATA_RO_PUMP_OUTLET_PRES_SENSOR, - CAL_DATA_DRAIN_PUMP_INLET_PRES_SENSOR, - CAL_DATA_DRAIN_PUMP_OUTLET_PRES_SENSOR, - NUM_OF_CAL_DATA_PRES_SENSORS, + CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, ///< DG calibration data RO pump inlet pressure sensor. + 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. + NUM_OF_CAL_DATA_PRES_SENSORS, ///< Number of calibration data pressure sensors. } CAL_DATA_DG_PRES_SENSORS_T; /// DG flow sensors enumeration. @@ -147,6 +147,26 @@ NUM_OF_CAL_DATA_RSRVRS } CAL_DATA_DG_RESERVOIRS_T; +typedef enum dg_acid_concentrate +{ + CAL_DATA_ACID_CONCENTRATE_1 = 0, + CAL_DATA_ACID_CONCENTRATE_2, + CAL_DATA_ACID_CONCENTRATE_3, + CAL_DATA_ACID_CONCENTRATE_4, + CAL_DATA_ACID_CONCENTRATE_5, + NUM_OF_CAL_DATA_ACID_CONCENTRATES +} CAL_DATA_DG_ACID_CONCENTRATE_T; + +typedef enum dg_bicarb_concentrate +{ + CAL_DATA_BICARB_CONCENTRATE_1 = 0, + CAL_DATA_BICARB_CONCENTRATE_2, + CAL_DATA_BICARB_CONCENTRATE_3, + CAL_DATA_BICARB_CONCENTRATE_4, + CAL_DATA_BICARB_CONCENTRATE_5, + NUM_OF_CAL_DATA_BICARB_CONCENTRATES +} CAL_DATA_DG_BICARB_CONCENTRATE_T; + #pragma pack(push, 1) /// Payload record structure for a linear calibration message. TODO remove typedef struct @@ -183,7 +203,6 @@ } DG_DRAIN_PUMP_CAL_RECORD_T; /// DG RO pump calibration structure. -// TODO make this more specific once more data was defined by the systems team typedef struct { F32 gain1Ratio; @@ -196,78 +215,170 @@ /// Pressure sensors calibration structure typedef struct { - LINEAR_CAL_PAYLOAD_T pressureSensors[ NUM_OF_CAL_DATA_PRES_SENSORS ]; ///< Pressure sensors to calibrate + LINEAR_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 - LINEAR_CAL_PAYLOAD_T reservedSpace[ 6 ]; ///< Reserved space for future pressure sensors + LINEAR_CAL_PAYLOAD_T reservedSpace[ 6 ]; ///< Reserved space for future pressure sensors. } DG_PRES_SENSORS_CAL_RECORD_T; /// Flow sensors calibration structure typedef struct { - LINEAR_CAL_PAYLOAD_T flowSensors[ NUM_OF_CAL_DATA_FLOW_SENSORS ]; ///< Flow sensors to calibrate + LINEAR_CAL_PAYLOAD_T flowSensors[ NUM_OF_CAL_DATA_FLOW_SENSORS ]; ///< Flow 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 - LINEAR_CAL_PAYLOAD_T reservedSpace[ 3 ]; ///< Reserved space for future flow sensors + LINEAR_CAL_PAYLOAD_T reservedSpace[ 3 ]; ///< Reserved space for future flow sensors. } DG_FLOW_SENSORS_CAL_RECORD_T; /// Load cells calibration structure typedef struct { - LINEAR_CAL_PAYLOAD_T loadCells[ NUM_OF_CAL_DATA_LOAD_CELLS ]; ///< Load cells to calibrate + LINEAR_CAL_PAYLOAD_T loadCells[ NUM_OF_CAL_DATA_LOAD_CELLS ]; ///< Load cells to calibrate. } DG_LOAD_CELLS_CAL_RECORD_T; /// Temperature sensors calibration structure typedef struct { - LINEAR_CAL_PAYLOAD_T tempSensors[ NUM_OF_CAL_DATA_TEMP_SENSORS ]; ///< Temperature sensors to calibrate + LINEAR_CAL_PAYLOAD_T tempSensors[ NUM_OF_CAL_DATA_TEMP_SENSORS ]; ///< Temperature 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 - LINEAR_CAL_PAYLOAD_T reservedSpace[ 5 ]; ///< Reserved space for future temp sensors + LINEAR_CAL_PAYLOAD_T reservedSpace[ 5 ]; ///< Reserved space for future temperature sensors. } DG_TEMP_SENSORS_CAL_RECORD_T; /// Conductivity sensors calibration structure typedef struct { - LINEAR_CAL_PAYLOAD_T condSensors[ NUM_OF_CAL_DATA_COND_SENSORS ]; ///< Conductivity sensors to calibrate + LINEAR_CAL_PAYLOAD_T condSensors[ NUM_OF_CAL_DATA_COND_SENSORS ]; ///< Conductivity 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 - LINEAR_CAL_PAYLOAD_T reservedSpace[ 2 ]; ///< Reserved space for future conductivity sensors + LINEAR_CAL_PAYLOAD_T reservedSpace[ 2 ]; ///< Reserved space for future conductivity sensors. } DG_COND_SENSORS_CAL_RECORD_T; +/// Drain line volume calibration structure typedef struct { - F32 volume; - U32 calibrationTime; - U16 crc; + F32 volume; ///< DG Drain line volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. } DG_DRAIN_LINE_VOLUME_T; +/// DG pre RO purge volume calibration structure typedef struct { - F32 pressure2FlowRatio; - F32 volume; - U32 calibrationTime; - U16 crc; + F32 pressure2FlowRatio; ///< Pressure to flow ratio. + F32 volume; ///< Volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. } DG_PRE_RO_PURGE_VOLUME_T; +/// DG reservoir volume calibration structure typedef struct { - F32 rsrvrVolume; - F32 normalFillVolume; - F32 maxResidualFluid; - F32 rsrvrUnfilledWeight; - U32 calibrationTime; - U16 crc; + F32 rsrvrVolume; ///< Reservoir volume. + F32 normalFillVolume; ///< Normal fill volume. + F32 maxResidualFluid; ///< Max residual fluid. + F32 rsrvrUnfilledWeight; ///< Reservoir unfilled weight. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. } DG_RESERVOIR_VOLUME_T; +/// DG generic volumes (reserved space) typedef struct { - F32 volume; - U32 calibrationTime; - U16 crc; + F32 volume; ///< Volume. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. } DG_GENERIC_VOLUME_T; -/// Manufacturing data structure. +/// DG acid concentrate +typedef struct +{ + F32 acidConcMixRatio; ///< Acid concentrate mix ratio. + F32 startVolume; ///< Start volume. + F32 reserverdSpace; ///< Reserved space. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_ACID_CONCENTRATE_T; + +/// DG bicarb concentrate +typedef struct +{ + F32 bicarbConcMixRatio; ///< Bicarb concentrate mix ratio. + F32 startVolume; ///< Start volume. + F32 reservedSpace; ///< Reserved space. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_BICARB_CONCENTRATE_T; + +/// DG acid concentrates +typedef struct +{ + DG_ACID_CONCENTRATE_T acidConcentrate[ NUM_OF_CAL_DATA_ACID_CONCENTRATES ]; ///< DG acid concentrates. +} DG_ACID_CONCENTRATES_T; + +/// DG bicarb concentrates +typedef struct +{ + DG_BICARB_CONCENTRATE_T bicarbConcentrate[ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ]; ///< DG bicarb concentrates. +} DG_BICARB_CONCENTRATES_T; + +/// DG filter calibration record +typedef struct +{ + F32 reservedSpace1; ///< DG filter reserved space 1. + F32 reservedSpace2; ///< DG filter reserved space 2. + F32 reservedSpace3; ///< DG filter reserved space 3 + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_FILTER_CAL_RECORD_T; + +/// DG filters calibration data structure +typedef struct +{ + DG_FILTER_CAL_RECORD_T roFilter; ///< RO filter. + DG_FILTER_CAL_RECORD_T ultraFilter; ///< Ultra filter. + DG_FILTER_CAL_RECORD_T sedimentFilter; ///< Sediment filter. + DG_FILTER_CAL_RECORD_T carbonFilter; ///< Carbon filter. + DG_FILTER_CAL_RECORD_T carbonPolishFilter; ///< Carbon polish filter. +} DG_FILTERS_CAL_RECORD_T; + +/// DG fan calibration data structure +typedef struct +{ + F32 reservedSpace1; ///< Reserved space 1. + F32 reservedSpace2; ///< Reserved space 2. + U32 calibrationTime; ///< Calibration time. + U16 crc; ///< CRC. +} DG_FAN_CAL_RECORD_T; + +/// DG fans calibration data structure +typedef struct +{ + DG_FAN_CAL_RECORD_T fan1; ///< Fan 1. + DG_FAN_CAL_RECORD_T fan2; ///< Fan 2. +} DG_FANS_CAL_RECORD_T; + +/// DG systems record structure +typedef struct +{ + char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DG top level part number. + char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DG top level serial number. + MFG_LOCATION_T mfgLocation; ///< DG manufacturing location. + U32 mfgDate; ///< DG manufacturing date. + U16 crc; ///< CRC for the DG system record structure. +} DG_SYSTEM_RECORD_T; + +/// DG last service record structure +typedef struct +{ + LAST_SERVICE_LOCATION_T lastServiceLoc; ///< DG last service location. + U32 lastServiceDate; ///< DG last service date. + U16 crc; ///< CRC for the DG last service record structure. +} DG_LAST_SERVICE_RECORD_T; + + +/********************** OLD STRUCTS REMOVE ******************/ +/// Manufacturing data structure. TODO remove typedef struct mfg_Data { char SYSSerialNumber [ MAX_TOP_LEVEL_PN_CHARS ]; ///< SYS serial number. @@ -293,12 +404,13 @@ char calDateAccel[ MAX_DATE_CHARACTERS ]; ///< Last calibration date of accelerometer } CALIBRATION_DATA_T; -/// Service dates structure. +/// Service dates structure. TODo remove typedef struct service_dates { char currentServiceDate [ MAX_DATE_CHARACTERS ]; ///< Current service date char nextServiceDate [ MAX_DATE_CHARACTERS ]; ///< Next service date } SERVICE_DATA_T; +/********************** OLD STRUCTS REMOVE ******************/ /// Read data status structure. typedef struct get_data @@ -326,8 +438,6 @@ char disinfectionDate [ MAX_DATE_CHARACTERS ]; ///< Disinfection Date } DISINFECTION_DATE_T; - - #pragma pack(pop) void initNVDataMgmt ( void ); @@ -338,14 +448,15 @@ SELF_TEST_STATUS_T execNVDataMgmtSelfTest ( void ); -void execNVDataMgmtSendRecord( void ); +void execNVDataMgmtProcessRecord( void ); BOOL getCalibrationRecord( void ); - BOOL setCalibrationRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ); -void getDGPressureSensorsCalibrationRecord( U08* buffer ); +BOOL getSystemRecord( void ); +BOOL setSystemRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ); +DG_PRES_SENSORS_CAL_RECORD_T getDGPressureSensorsCalibrationRecord( void ); void getDGFlowSensorsCalibrationRecord( U08* buffer ); BOOL setBootloaderFlag ( U32 flag );