Index: NVDataMgmt.h =================================================================== diff -u -r32d19410fc08e86e4503f6e8af5470170bb72cdf -r0df8e5e99715de10f8936a9d41c28f4c2a4dacc6 --- NVDataMgmt.h (.../NVDataMgmt.h) (revision 32d19410fc08e86e4503f6e8af5470170bb72cdf) +++ NVDataMgmt.h (.../NVDataMgmt.h) (revision 0df8e5e99715de10f8936a9d41c28f4c2a4dacc6) @@ -19,11 +19,12 @@ #define FWCOMMON_NVDATAMGMT_H_ #include "Common.h" +#include "ConcentratePumps.h" /** * @defgroup NVDataMgmt NVDataMgmt * @brief Non-volatile data management module. Handles Bank 7 of the TI processor and the - * RAM of the RTC chip + * RAM of the RTC chip. * * @addtogroup NVDataMgmt * @{ @@ -32,7 +33,7 @@ // ********** public definitions ********** #define MAX_TOP_LEVEL_PN_CHARS 10U ///< Max number of characters for top level part number. -#define MAX_TOP_LEVEL_SN_CHARS 10U ///< Max number of characters for top level serial number. +#define MAX_TOP_LEVEL_SN_CHARS 15U ///< Max number of characters for top level serial number. #define MAX_HW_SERIAL_NUMBER_CHARACTERS 5U ///< Max number of characters for HD serial number TODO remove #define MAX_DATE_CHARACTERS 10U ///< Max number of characters for date TODO REMOVE @@ -71,6 +72,7 @@ NVDATAMGMT_READ_COMPLETE ///< Read status complete. } NVDATAMGMT_READ_STATUS_T; +/// DG pressure sensors enumeration. typedef enum dg_pressure_sensors { CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, @@ -80,12 +82,14 @@ NUM_OF_CAL_DATA_PRES_SENSORS, } CAL_DATA_DG_PRES_SENSORS_T; +/// DG flow sensors enumeration. typedef enum dg_flow_sensors { CAL_DATA_RO_PUMP_FLOW_SENSOR = 0, NUM_OF_CAL_DATA_FLOW_SENSORS, } CAL_DATA_DG_FLOW_SENSORS_T; +/// DG load cells enumeration. typedef enum dg_load_cells { CAL_DATA_LOAD_CELL_A1 = 0, @@ -95,6 +99,7 @@ NUM_OF_CAL_DATA_LOAD_CELLS, } CAL_DATA_DG_LOAD_CELLS_T; +/// DG temperature sensors enumeration. typedef enum dg_temperature_sensors { CAL_DATA_FPGA_BOARD_TEMP = 0, @@ -115,6 +120,7 @@ NUM_OF_CAL_DATA_TEMP_SENSORS, } CAL_DATA_DG_TEMP_SENSORS_T; +/// DG conductivity sensors enumeration. typedef enum dg_conductivity_sensors { CAL_DATA_CPI_COND_SENSOR = 0, @@ -124,6 +130,7 @@ NUM_OF_CAL_DATA_COND_SENSORS, } CAL_DATA_DG_COND_SENSORS_T; +/// DG pumps enumeration. typedef enum dg_pumps { CAL_DATA_CONC_PUMP_1 = 0, @@ -133,7 +140,133 @@ NUM_OF_CAL_DATA_DG_PUMPS } CAL_DATA_DG_PUMPS_T; +typedef enum dg_reservoirs +{ + CAL_DATA_RSRVR_1 = 0, + CAL_DATA_RSRVR_2, + NUM_OF_CAL_DATA_RSRVRS +} CAL_DATA_DG_RESERVOIRS_T; + #pragma pack(push, 1) +/// Payload record structure for a linear calibration message. TODO remove +typedef struct +{ + F32 gain; + F32 offset; +} LINEAR_F32_CAL_PAYLOAD_T; +// TODO remove the above structure + +/// Linear calibration structure +typedef struct +{ + F32 gain; + F32 offset; + U32 calibrationTime; + U16 crc; +} LINEAR_CAL_PAYLOAD_T; + +/// DG concentrate pumps one-gain payload +typedef struct +{ + F32 stepSpeed2FlowRatio; + U32 calibrationTime; + U16 crc; +} DG_CONC_PUMPS_CAL_RECORD_T; + +/// DG drain pump two-gain payload +typedef struct +{ + F32 voltage2SpeedRatio; + F32 stepSpeed2FlowRatio; + U32 calibrationTime; + U16 crc; +} 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; + F32 gain2Ratio; + F32 gain3Ratio; + U32 calibrationTime; + U16 crc; +} DG_RO_PUMP_CAL_RECORD_T; + +/// Pressure sensors calibration structure +typedef struct +{ + 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 +} 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 + // 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 +} 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 +} 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 + // 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 +} 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 + // 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 +} DG_COND_SENSORS_CAL_RECORD_T; + +typedef struct +{ + F32 volume; + U32 calibrationTime; + U16 crc; +} DG_DRAIN_LINE_VOLUME_T; + +typedef struct +{ + F32 pressure2FlowRatio; + F32 volume; + U32 calibrationTime; + U16 crc; +} DG_PRE_RO_PURGE_VOLUME_T; + +typedef struct +{ + F32 rsrvrVolume; + F32 normalFillVolume; + F32 maxResidualFluid; + F32 rsrvrUnfilledWeight; + U32 calibrationTime; + U16 crc; +} DG_RESERVOIR_VOLUME_T; + +typedef struct +{ + F32 volume; + U32 calibrationTime; + U16 crc; +} DG_GENERIC_VOLUME_T; + /// Manufacturing data structure. typedef struct mfg_Data { @@ -193,76 +326,8 @@ char disinfectionDate [ MAX_DATE_CHARACTERS ]; ///< Disinfection Date } DISINFECTION_DATE_T; -/// Payload record structure for a linear calibration message. TODO remove -typedef struct -{ - F32 gain; - F32 offset; -} LINEAR_F32_CAL_PAYLOAD_T; -/// Linear calibration structure -typedef struct -{ - F32 gain; - F32 offset; - U32 calibrationTime; - U16 crc; -} LINEAR_CAL_PAYLOAD_T; -/// DG concentrate pumps one-gain payload -typedef struct -{ - F32 stepSpeed2FlowRatio; - U32 calibrationTime; - U16 crc; -} DG_CONCENTRATE_PUMPS_PAYLOAD_T; - -/// DG drain pump two-gain payload -typedef struct -{ - F32 voltage2SpeedRatio; - F32 stepSpeed2FlowRatio; - U32 calibrationTime; - U16 crc; -} DG_DRAIN_PUMP_PAYLOAD_T; - -// TODO change the name of the RO pumps gains later -typedef struct -{ - F32 gain1Ratio; - F32 gain2Ratio; - F32 gain3Ratio; - U32 calibrationTime; - U16 crc; -} DG_RO_PUMP_PAYLOAD_T; - -/// One constant structure -typedef struct -{ - F32 constant; - U32 calibrationTime; - U16 crc; -} ONE_CONSTANT_PAYLOAD_T ; - -/// Two constants structure -typedef struct -{ - F32 constant1; - F32 constant2; - U32 calibrationTime; - U16 crc; -} TWO_CONSTANTS_PAYLOAD_T; - -/// Three constants structure -typedef struct -{ - F32 constant1; - F32 constant2; - F32 constant3; - U32 calibrationTime; - U16 crc; -} THREE_CONSTANTS_PAYLOAD_T; - #pragma pack(pop) void initNVDataMgmt ( void ); @@ -275,9 +340,9 @@ void execNVDataMgmtSendRecord( void ); -BOOL getDGCalibrationRecord( void ); +BOOL getCalibrationRecord( void ); -BOOL setDGCalibrationRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ); +BOOL setCalibrationRecord( U32 currentMessage, U32 totalMessages, U32 length, U08 *addressPtr ); void getDGPressureSensorsCalibrationRecord( U08* buffer );