Index: firmware/.launches/DG.launch =================================================================== diff -u -r45f4646609e6dd39691102e109d0b5c14f97e054 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/.launches/DG.launch (.../DG.launch) (revision 45f4646609e6dd39691102e109d0b5c14f97e054) +++ firmware/.launches/DG.launch (.../DG.launch) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -1,5 +1,6 @@ +<<<<<<< HEAD @@ -17,6 +18,13 @@ +======= + + + + + +>>>>>>> staging Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r45f4646609e6dd39691102e109d0b5c14f97e054 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 45f4646609e6dd39691102e109d0b5c14f97e054) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -20,7 +20,6 @@ #include "etpwm.h" #include "mibspi.h" -#include "AlarmDefs.h" #include "FPGA.h" #include "OperationModes.h" #include "PIControllers.h" @@ -35,9 +34,6 @@ #ifdef EMC_TEST_BUILD #include "Heaters.h" #endif -#ifdef ENABLE_DIP_SWITCHES -#include "Valves.h" -#endif /** * @addtogroup ROPump @@ -53,7 +49,7 @@ #define ROP_CONTROL_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the RO pump is controlled. #define ROP_RAMP_UP_CONTROL_INTERVAL ( 500 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the RO pump is controlled. -#define ROP_RAMP_UP_P_COEFFICIENT 0.22 ///< P term for RO pump ramp up to flow control. +#define ROP_RAMP_UP_P_COEFFICIENT 0.22 ///< P term for RO pump ramp up to flow control. #define ROP_FLOW_CONTROL_P_COEFFICIENT 0.25 ///< P term for RO pump flow control. #define ROP_FLOW_CONTROL_I_COEFFICIENT 0.25 ///< I term for RO pump flow control. #define ROP_MAX_PRESSURE_P_COEFFICIENT 0.01 ///< P term for RO pump max pressure control. @@ -78,7 +74,7 @@ #define FLOW_SENSOR_ZERO_READING 0xFFFF ///< Flow sensor reading indicates zero flow (or flow lower than can be detected by sensor). #define MAX_ALLOWED_FLOW_DEVIATION 0.1 ///< Max allowed deviation from target flow. -#define FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ( 10 * MS_PER_SECOND ) ///< Flow out of range time out in counts. +#define FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in counts. #define MAX_PRESSURE_TARGET_TOLERANCE 5 ///< Pressure tolerance from maximum set pressure by user in psi. #define MAX_ALLOWED_PRESSURE_PSI 130 ///< Maximum allowed pressure that the RO pump can go to. #define MIN_ALLOWED_PRESSURE_PSI 10 ///< Minimum allowed pressure that the RO pump can go to. @@ -110,23 +106,24 @@ // ********** private data ********** -static RO_PUMP_STATE_T roPumpState = RO_PUMP_OFF_STATE; ///< current state of RO pump controller state machine. -static U32 roPumpDataPublicationTimerCounter = 0; ///< used to schedule RO pump data publication to CAN bus. +static RO_PUMP_STATE_T roPumpState = RO_PUMP_OFF_STATE; ///< Current state of RO pump controller state machine. +static U32 roPumpDataPublicationTimerCounter = 0; ///< Used to schedule RO pump data publication to CAN bus. static BOOL isROPumpOn = FALSE; ///< RO pump is currently running. -static F32 roPumpPWMDutyCyclePct = 0.0; ///< initial RO pump PWM duty cycle. -static F32 roPumpDutyCyclePctSet = 0.0; ///< currently set RO pump PWM duty cycle. -static PUMP_CONTROL_MODE_T roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested RO pump control mode. -static PUMP_CONTROL_MODE_T roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set RO pump control mode. +static F32 roPumpPWMDutyCyclePct = 0.0; ///< Initial RO pump PWM duty cycle. +static F32 roPumpDutyCyclePctSet = 0.0; ///< Currently set RO pump PWM duty cycle. +static PUMP_CONTROL_MODE_T roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Requested RO pump control mode. +static PUMP_CONTROL_MODE_T roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Currently set RO pump control mode. TODO do we need this? static F32 targetROPumpFlowRate = 0.0; ///< Target RO flow rate (in L/min). static F32 targetROPumpMaxPressure = 0.0; ///< Target RO max allowed pressure (in PSI). static OVERRIDE_U32_T roPumpDataPublishInterval = { RO_PUMP_DATA_PUB_INTERVAL, RO_PUMP_DATA_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish RO flow data to CAN bus. -static OVERRIDE_F32_T measuredROFlowRateLPM = { 0.0, 0.0, 0.0, 0 }; ///< measured RO flow rate (in L/min). +static OVERRIDE_F32_T measuredROFlowRateLPM = { 0.0, 0.0, 0.0, 0 }; ///< Measured RO flow rate (in L/min). -static U32 roControlTimerCounter = 0; ///< determines when to perform control on RO pump. +static U32 roControlTimerCounter = 0; ///< Determines when to perform control on RO pump. + static F32 roPumpOpenLoopTargetDutyCycle = 0; ///< Target RO pump open loop PWM. /* TODO These variables are used for POST. POST has not been implemented yet @@ -197,6 +194,7 @@ roPumpState = RO_PUMP_OFF_STATE; roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; roPumpControlModeSet = roPumpControlMode; + isROPumpOn = FALSE; } /*********************************************************************//** @@ -231,6 +229,7 @@ // Get the initial guess of the duty cycle roPumpPWMDutyCyclePct = ROP_FLOW_TO_PWM_DC( roFlowRate ); roControlTimerCounter = 0; + isROPumpOn = TRUE; result = TRUE; } // Requested max pressure is out of range @@ -316,12 +315,15 @@ flowFilterCounter = 0; } - // To monitor the flow, the control mode must be in closed loop and the pump should be control to target state, - // meaning, it is controlling to a certain pressure - /*if ( roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP && roPumpState == RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE ) +#ifndef IGNORE_RO_PUMP_MONITOR + // To monitor the flow, the control mode must be in closed loop mode and the pump should be control to flow state + // If the pump is controlled to the maximum pressure, the flow might be different from the target flow for more than 10% + // but the pump is not able to achieve the flow. + if ( ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) && ( RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE == roPumpState ) ) { F32 const currentFlow = getMeasuredROFlowRate(); F32 const targetFlow = getTargetROPumpFlowRate(); + // The flow cannot be out of range for than 10% of the target flow BOOL const isFlowOutOfRange = fabs( 1.0 - ( currentFlow / targetFlow ) ) > MAX_ALLOWED_FLOW_DEVIATION; // Figure out whether flow is out of range from which side BOOL const isFlowOutOfUpperRange = isFlowOutOfRange && ( currentFlow > targetFlow ); @@ -344,7 +346,8 @@ { activateSafetyShutdown(); } - }*/ + } +#endif // Publish RO pump data on interval publishROPumpData(); @@ -475,15 +478,6 @@ F32 flowRateDeviation = fabs( targetFlowRate - actualFlowRate ) / targetFlowRate; BOOL isFlowOutOfRange = flowRateDeviation > ROP_FLOW_TARGET_TOLERANCE; - // If the ramp up persistent alarm is active, turn off the pump and go to off state - /*if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_RO_PUMP_RAMP_UP_TO_FLOW_TIMEOUT, isFlowOutOfRange ) ) - { - stopROPump(); - result = RO_PUMP_OFF_STATE; - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_RO_PUMP_RAMP_UP_TO_FLOW_TIMEOUT, actualFlowRate, MAX_ALLOWED_RAMP_UP_TIME ); - }*/ - // Control at set interval - //else if ( ++roControlTimerCounter >= ROP_RAMP_UP_CONTROL_INTERVAL ) if ( ++roControlTimerCounter >= ROP_RAMP_UP_CONTROL_INTERVAL ) { F32 targetPressure = getTargetROPumpPressure(); Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -32,11 +32,12 @@ // ********** private definitions ********** -#define PRIMARY_HEATER_EXT_TEMP_SENSORS_GAIN 8U ///< Primary heater external temperature sensors gain. +#define PRIMARY_HEATER_EXT_TEMP_SENSORS_GAIN 8U ///< Primary heater external temperature sensors gain. #define PRIMARY_HEATER_EXT_TEMP_SENSORS_REF_RESISTANCE 19600U ///< Primary heater external temperature sensors reference resistance. #define PRIMARY_HEATER_EXT_TEMP_SENSORS_0_DEGREE_RESISTANCE 1000U ///< Primary heater external temperature sensors zero degree resistance. -#define COND_SENSORS_TEMP_SENSOR_GAIN 8U ///< Temperature sensor for conductivity gain. +#define COND_SENSORS_TEMP_SENSOR_GAIN 8U ///< Temperature sensor for conductivity gain. + #define COND_SENSORS_TEMP_SENSOR_REF_RESISTANCE 19600U ///< Temperature sensor for conductivity reference resistance. #define COND_SENSORS_TEMP_SENSOR_0_DEGREE_RESISTANCE 1000U ///< Temperature sensor for conductivity zero degree resistance. @@ -53,7 +54,7 @@ #define SHIFT_BITS_BY_2_FOR_AVERAGING 2U ///< Shift the ADCs of the temperature sensors by 2 to average them. #define INLET_WATER_TEMPERATURE_PERSISTENCE_PERIOD ( 5 * MS_PER_SECOND ) ///< Persistence period for temperature sensors out of range error period. -#define MIN_WATER_INPUT_TEMPERATURE 10U ///< Minimum water input temperature. +#define MIN_WATER_INPUT_TEMPERATURE 22U ///< Minimum water input temperature. #define MAX_WATER_INPUT_TEMPERATURE 35U ///< Maximum water input temperature. #define HEATERS_INTERNAL_TEMPERTURE_CALCULATION_INTERVAL 20U ///< Time interval that is used to calculate the heaters internal temperature. @@ -76,56 +77,54 @@ #define TEMPERATURE_SENSORS_INTERNAL_ERROR_PERSISTENT_PERIOD ( 3 * MS_PER_SECOND ) ///< Temperature sensors internal error persistent period. #define FPGA_RAW_ADC_READ_INTERVAL_COUNT 8 ///< Time interval in counts to read the raw ADC reads from FPGA. - /// Temperature sensor self-test states. typedef enum tempSensors_Self_Test_States { - TEMPSENSORS_SELF_TEST_START = 0, ///< Temperature sensors self-test start - TEMPSENSORS_SELF_TEST_ADC_CHECK, ///< Temperature sensors self ADC check - TEMPSENSORS_SELF_TEST_COMPLETE, ///< Temperature sensors self-test complete - NUM_OF_TEMPSENSORS_SELF_TEST_STATES ///< Total number of self-test states + TEMPSENSORS_SELF_TEST_START = 0, ///< Temperature sensors self-test start + TEMPSENSORS_SELF_TEST_ADC_CHECK, ///< Temperature sensors self ADC check + TEMPSENSORS_SELF_TEST_COMPLETE, ///< Temperature sensors self-test complete + NUM_OF_TEMPSENSORS_SELF_TEST_STATES ///< Total number of self-test states } TEMPSENSORS_SELF_TEST_STATES_T; /// Temperature sensor exec states. typedef enum tempSensors_Exec_States { - TEMPSENSORS_EXEC_STATE_START = 0, ///< Temperature sensors exec start - TEMPSENSORS_EXEC_STATE_GET_ADC_VALUES, ///< Temperature sensors exec get ADC values - NUM_OF_TEMPSENSORS_EXEC_STATES, ///< Total number of exec states + TEMPSENSORS_EXEC_STATE_START = 0, ///< Temperature sensors exec start + TEMPSENSORS_EXEC_STATE_GET_ADC_VALUES, ///< Temperature sensors exec get ADC values + NUM_OF_TEMPSENSORS_EXEC_STATES, ///< Total number of exec states } TEMPSENSORS_EXEC_STATES_T; /// Temperature sensor struct. typedef struct { - F32 gain; ///< ADC gain - F32 refResistance; ///< ADC reference resistance - F32 conversionCoeff; ///< ADC conversion coefficient - F32 zeroDegreeResistance; ///< ADC zero degree resistance - S32 rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES ]; ///< Raw ADC reads array - S32 adcNextIndex; ///< Next ADC read index - S32 adcRunningSum; ///< ADC running sum - U32 readCount; ///< Read counts from FPGA - OVERRIDE_F32_T temperatureValues; ///< Temperature values with override + F32 gain; ///< ADC gain + F32 refResistance; ///< ADC reference resistance + F32 conversionCoeff; ///< ADC conversion coefficient + F32 zeroDegreeResistance; ///< ADC zero degree resistance + S32 rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES ]; ///< Raw ADC reads array + S32 adcNextIndex; ///< Next ADC read index + S32 adcRunningSum; ///< ADC running sum + U32 readCount; ///< Read counts from FPGA + OVERRIDE_F32_T temperatureValues; ///< Temperature values with override } TEMP_SENSOR_T; // ********** private data ********** -static SELF_TEST_STATUS_T tempSensorsSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< Self-test result of the TemperatureSensors module. -static TEMPSENSORS_SELF_TEST_STATES_T tempSensorsSelfTestState; ///< TemperatureSensor self-test state. -static TEMPSENSORS_EXEC_STATES_T tempSensorsExecState; ///< TemperatureSensor exec state. -static TEMP_SENSOR_T tempSensors [ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors' data structure. -static U32 fpgaRawADCReadInterval = 0; ///< FPGA raw ADC read interval count. -static U32 elapsedTime = 0; ///< Elapsed time variable. -static U32 internalHeatersConversionTimer = 0; ///< Conversion timer variable to calculate the heaters internal temperature. +static SELF_TEST_STATUS_T tempSensorsSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< Self-test result of the TemperatureSensors module. +static TEMPSENSORS_SELF_TEST_STATES_T tempSensorsSelfTestState; ///< TemperatureSensor self-test state. +static TEMPSENSORS_EXEC_STATES_T tempSensorsExecState; ///< TemperatureSensor exec state. +static TEMP_SENSOR_T tempSensors [ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors' data structure. +static U32 fpgaRawADCReadInterval = 0; ///< FPGA raw ADC read interval count. +static U32 elapsedTime = 0; ///< Elapsed time variable. +static U32 internalHeatersConversionTimer = 0; ///< Conversion timer variable to calculate the heaters internal temperature. -static F32 tempValuesForPublication [ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors data publication array. -static U32 dataPublicationTimerCounter; ///< Temperature sensors data publish timer counter. +static U32 dataPublicationTimerCounter; ///< Temperature sensors data publish timer counter. static OVERRIDE_U32_T tempSensorsPublishInterval = { TEMP_SENSORS_DATA_PUBLISH_INTERVAL, - TEMP_SENSORS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Temperature sensors publish time interval override. + TEMP_SENSORS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Temperature sensors publish time interval override. -static const F32 POSITIVE_TC_EXP_A0 = 0.118597600000E0; ///< K TC positive temperature exponent coefficient A0. -static const F32 POSITIVE_TC_EXP_A1 = -0.118343200000E-3; ///< K TC positive temperature exponent coefficient A1. -static const F32 POSITIVE_TC_EXP_A2 = 0.126968600000E3; ///< K TC positive temperature exponent coefficient A2. +static const F32 POSITIVE_TC_EXP_A0 = 0.118597600000E0; ///< K TC positive temperature exponent coefficient A0. +static const F32 POSITIVE_TC_EXP_A1 = -0.118343200000E-3; ///< K TC positive temperature exponent coefficient A1. +static const F32 POSITIVE_TC_EXP_A2 = 0.126968600000E3; ///< K TC positive temperature exponent coefficient A2. static const F32 POSITIVE_TC_COEFFS [ SIZE_OF_THERMOCOUPLE_COEFFICIENTS ] = { @@ -134,18 +133,18 @@ 0.318409457190E-9, -0.560728448890E-12, 0.560750590590E-15,-0.320207200030E-18, 0.971511471520E-22,-0.121047212750E-25 -}; ///< Thermocouple correction coefficients for positive cold junction temperature. +}; ///< Thermocouple correction coefficients for positive cold junction temperature. static const F32 POSITIVE_TC_INVERSER_COEFFS [ SIZE_OF_THERMOCOUPLE_COEFFICIENTS ] = { 0.0, 2.508355E1, 7.860106E-2, -2.503131E-1, 8.315270E-2, -1.228034E-2, 9.804036E-4, -4.413030E-5, 1.057734E-6, -1.052755E-8 -}; ///< Thermocouple inverse coefficient for positive cold junction temperature. +}; ///< Thermocouple inverse coefficient for positive cold junction temperature. -static const U32 TEMP_SENSORS_ADC_MAX_COUNT = ( 1 << TEMP_SENSORS_ADC_BITS ) - 1; ///< ADC 24 bit max count which is (2^24 - 1). -static const U32 TEMP_EQUATION_RESISTOR_CALC = 1 << ( TEMP_SENSORS_ADC_BITS - 1 ); ///< Temperature sensors resistor calculation (2^(24 - 1)). -static const F32 TEMP_EQUATION_COEFF_A = 3.9083E-3; ///< ADC to temperature conversion coefficient A. -static const F32 TEMP_EQUATION_COEFF_B = -5.775E-7; ///< ADC to temperature conversion coefficient B. +static const U32 TEMP_SENSORS_ADC_MAX_COUNT = ( 1 << TEMP_SENSORS_ADC_BITS ) - 1; ///< ADC 24 bit max count which is (2^24 - 1). +static const U32 TEMP_EQUATION_RESISTOR_CALC = 1 << ( TEMP_SENSORS_ADC_BITS - 1 ); ///< Temperature sensors resistor calculation (2^(24 - 1)). +static const F32 TEMP_EQUATION_COEFF_A = 3.9083E-3; ///< ADC to temperature conversion coefficient A. +static const F32 TEMP_EQUATION_COEFF_B = -5.775E-7; ///< ADC to temperature conversion coefficient B. // ********** private function prototypes ********** @@ -159,7 +158,7 @@ static void getHeaterInternalTemp( U32 TCIndex, U32 CJIndex ); static void processTempSnsrsADCRead( U32 sensorIndex, U32 adc, U32 fpgaError, U32 fpgaCount ); -static void processHtrsTempSnsrsADCRead( U32 sensorIndex, U32 adc, U32 fpgaError, U32 fpgaCount ); +static void processHtrsTempSnsrsADCRead( U32 sensorIndex, U16 adc, U32 fpgaError, U32 fpgaCount ); static BOOL isADCReadValid( U32 sensorIndex, U32 fpgaError, U32 fpgaCount ); static void processADCRead( U32 sensorIndex, S32 adc ); static void publishTemperatureSensorsData( void ); @@ -240,7 +239,7 @@ // FPGA board temperature conversion coefficient tempSensors[ TEMPSENSORS_FPGA_BOARD_SENSOR ].conversionCoeff = 503.975 / (F32)TWELVE_BIT_RESOLUTION; - F32 const conversionCoeff = 1.0 / 13584.0; + F32 const conversionCoeff = 1.0 / 13584.0; // Board temperature sensors conversion coefficient tempSensors[ TEMPSENSORS_LOAD_CELL_A1_B1 ].conversionCoeff = conversionCoeff; @@ -284,8 +283,7 @@ break; default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_TEMPERATURE_SENSORS_INVALID_SELF_TEST_STATE, - tempSensorsSelfTestState ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_TEMPERATURE_SENSORS_INVALID_SELF_TEST_STATE, tempSensorsSelfTestState ); tempSensorsSelfTestState = TEMPSENSORS_SELF_TEST_COMPLETE; break; } @@ -333,12 +331,14 @@ *************************************************************************/ void checkInletWaterTemperature( void ) { +#ifndef DISABLE_WATER_QUALITY_CHECK F32 const temperature = getTemperatureValue( TEMPSENSORS_INLET_PRIMARY_HEATER ); BOOL const isWaterTempTooHigh = temperature > MAX_WATER_INPUT_TEMPERATURE; BOOL const isWaterTempTooLow = temperature < MIN_WATER_INPUT_TEMPERATURE; checkPersistentAlarm( ALARM_ID_INLET_WATER_HIGH_TEMPERATURE, isWaterTempTooHigh, temperature, MAX_WATER_INPUT_TEMPERATURE ); checkPersistentAlarm( ALARM_ID_INLET_WATER_LOW_TEMPERATURE, isWaterTempTooLow, temperature, MIN_WATER_INPUT_TEMPERATURE ); +#endif } /*********************************************************************//** @@ -396,7 +396,7 @@ // R(RTD) = R(ref) * ( adc – 2^(N - 1) ) / ( G * 2^(N - 1) ); F32 resistance = ( refResistance * ( avgADC - TEMP_EQUATION_RESISTOR_CALC ) ) / ( gain * TEMP_EQUATION_RESISTOR_CALC ); // T = (-A + √( A^2 - 4B * ( 1 - R_T / R_0 ) ) ) / 2B - F32 secondSqrtPart = 4 * TEMP_EQUATION_COEFF_B * (1 - ( resistance / zeroDegResistance ) ); + F32 secondSqrtPart = 4 * TEMP_EQUATION_COEFF_B * ( 1 - ( resistance / zeroDegResistance ) ); temperature = ( -TEMP_EQUATION_COEFF_A + sqrt( pow( TEMP_EQUATION_COEFF_A, 2 ) - secondSqrtPart ) ) / ( 2 * TEMP_EQUATION_COEFF_B ); } else @@ -465,7 +465,7 @@ } // Check which heater's internal temperature is being calculated - if ( TCIndex == TEMPSENSORS_PRIMARY_HEATER_THERMO_COUPLE ) + if ( TEMPSENSORS_PRIMARY_HEATER_THERMO_COUPLE == TCIndex ) { tempSensors[ TEMPSENSORS_PRIMARY_HEATER_INTERNAL ].temperatureValues.data = temperature; } @@ -493,7 +493,7 @@ { S32 convertedADC = (S32)( adc & MASK_OFF_U32_MSB ); - if ( isADCReadValid( sensorIndex, fpgaError, fpgaCount ) ) + if ( TRUE == isADCReadValid( sensorIndex, fpgaError, fpgaCount ) ) { processADCRead( sensorIndex, convertedADC ); } @@ -514,32 +514,13 @@ * @param fpgaCount reported read count by FPGA * @return none *************************************************************************/ -static void processHtrsTempSnsrsADCRead( U32 sensorIndex, U32 adc, U32 fpgaError, U32 fpgaCount ) +static void processHtrsTempSnsrsADCRead( U32 sensorIndex, U16 adc, U32 fpgaError, U32 fpgaCount ) { - U16 adcConv = 0; - S16 convertedADC = 0; - - if ( ( sensorIndex == TEMPSENSORS_PRIMARY_HEATER_THERMO_COUPLE ) || ( sensorIndex == TEMPSENSORS_TRIMMER_HEATER_THERMO_COUPLE ) ) + if ( TRUE == isADCReadValid( sensorIndex, fpgaError, fpgaCount ) ) { - // Cast the adc from U32 to U16 and shift it to left by 2 - adcConv = ( (U16)adc ) << SHIFT_BITS_BY_2; - // Cast from U16 to S16 and shift the bits to right by 2 - // so if the sign bit is 1, the sign bit is extended - convertedADC = ( (S32)adcConv ) >> SHIFT_BITS_BY_2; + S16 convert = (S16)adc; + processADCRead( sensorIndex, (S32)convert ); } - else if ( ( sensorIndex == TEMPSENSORS_PRIMARY_HEATER_COLD_JUNCTION ) || ( sensorIndex == TEMPSENSORS_TRIMMER_HEATER_COLD_JUNCTION ) ) - { - // Cast the adc from U32 to U16 and shift it by 4 - adcConv = ( (U16)adc ) << SHIFT_BITS_BY_4; - // Cast from U16 to S16 and shift the bits to right by 4 - // so if the sign bit is 1, the sign bit is extended - convertedADC = ( (S32)adcConv ) >> SHIFT_BITS_BY_4; - } - - if ( isADCReadValid( sensorIndex, fpgaError, fpgaCount ) ) - { - processADCRead( sensorIndex, (S32)convertedADC ); - } } /*********************************************************************//** @@ -567,17 +548,19 @@ BOOL isFPGAErrorZero = fpgaError == 0; BOOL isFPGACountChanging = tempSensors[ sensorIndex ].readCount != fpgaCount; - if ( isFPGAErrorZero ) + if ( TRUE == isFPGAErrorZero ) { - if ( isFPGACountChanging ) + if ( TRUE == isFPGACountChanging ) { tempSensors[ sensorIndex ].readCount = fpgaCount; isADCValid = TRUE; } } - checkPersistentAlarm( ALARM_ID_TEMPERATURE_SENSORS_FAULT, !isFPGACountChanging || !isFPGAErrorZero, sensorIndex, TEMPERATURE_SENSORS_FPGA_ERROR_PERSISTENT_PERIOD ); + BOOL isThereAnError = !isFPGACountChanging || !isFPGAErrorZero; + checkPersistentAlarm( ALARM_ID_TEMPERATURE_SENSORS_FAULT, isThereAnError, sensorIndex, TEMPERATURE_SENSORS_FPGA_ERROR_PERSISTENT_PERIOD ); + return isADCValid; } @@ -684,7 +667,7 @@ BOOL const isLessThanZero = tpiADC <= 0; BOOL const isGreaterThanFullScale = tpiADC >= TEMP_SENSORS_ADC_MAX_COUNT; - if ( isLessThanZero || isGreaterThanFullScale ) + if ( ( TRUE == isLessThanZero ) || ( TRUE == isGreaterThanFullScale ) ) { tempSensorsSelfTestResult = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TEMPERATURE_SENSORS_FAULT, TEMPSENSORS_SELF_TEST_ADC_CHECK ); @@ -710,7 +693,7 @@ elapsedTime = getMSTimerCount(); } // A delay to let FPGA to boot up - else if ( didTimeout( elapsedTime, ADC_FPGA_READ_DELAY ) ) + else if ( TRUE == didTimeout( elapsedTime, ADC_FPGA_READ_DELAY ) ) { elapsedTime = 0; state = TEMPSENSORS_EXEC_STATE_GET_ADC_VALUES; @@ -810,15 +793,35 @@ { if ( ++dataPublicationTimerCounter >= getPublishTemperatureSensorsDataInterval() ) { - U32 i; + TEMPERATURE_SENSORS_DATA_T data; - // Populate all the temperature values - for ( i = 0; i < NUM_OF_TEMPERATURE_SENSORS; i++ ) - { - tempValuesForPublication[ i ] = getTemperatureValue ( i ); - } + data.inletPrimaryHeater = getTemperatureValue ( TEMPSENSORS_INLET_PRIMARY_HEATER ); + data.outletPrimaryHeater = getTemperatureValue ( TEMPSENSORS_OUTLET_PRIMARY_HEATER ); + data.conductivitySensor1 = getTemperatureValue ( TEMPSENSORS_CONDUCTIVITY_SENSOR_1 ); + data.conductivitySensor2 = getTemperatureValue ( TEMPSENSORS_CONDUCTIVITY_SENSOR_2 ); + data.outletRedundant = getTemperatureValue ( TEMPSENSORS_OUTLET_REDUNDANT ); + data.inletDialysate = getTemperatureValue ( TEMPSENSORS_INLET_DIALYSATE ); + data.primaryHeaterThermocouple = getTemperatureValue ( TEMPSENSORS_PRIMARY_HEATER_THERMO_COUPLE ); + data.trimmerHeaterThermocouple = getTemperatureValue ( TEMPSENSORS_TRIMMER_HEATER_THERMO_COUPLE ); + data.priamyHeaterColdjunction = getTemperatureValue ( TEMPSENSORS_PRIMARY_HEATER_COLD_JUNCTION ); + data.trimmerHeaterColdjunction = getTemperatureValue ( TEMPSENSORS_TRIMMER_HEATER_COLD_JUNCTION ); + data.primaryHeaterInternal = getTemperatureValue ( TEMPSENSORS_PRIMARY_HEATER_INTERNAL ); + data.trimmerHeaterInternal = getTemperatureValue ( TEMPSENSORS_TRIMMER_HEATER_INTERNAL ); + data.fpgaBoard = getTemperatureValue ( TEMPSENSORS_FPGA_BOARD_SENSOR ); + data.loadCellA1B1 = getTemperatureValue ( TEMPSENSORS_LOAD_CELL_A1_B1 ); + data.loadCellA2B2 = getTemperatureValue ( TEMPSENSORS_LOAD_CELL_A2_B2 ); + data.internalTHDORTD = getTemperatureValue ( TEMPSENSORS_INTERNAL_THDO_RTD ); + data.internalTDIRTD = getTemperatureValue ( TEMPSENSORS_INTERNAL_TDI_RTD ); + data.internalCondSnsrTemp = getTemperatureValue ( TEMPSENSORS_INTERNAL_COND_TEMP_SENSOR ); + data.primaryThermoCoupleRaw = tempSensors[ TEMPSENSORS_PRIMARY_HEATER_THERMO_COUPLE ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; + data.primaryColdjuncRaw = tempSensors[ TEMPSENSORS_PRIMARY_HEATER_COLD_JUNCTION ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; + data.trimmerThermoCoupleRaw = tempSensors[ TEMPSENSORS_TRIMMER_HEATER_THERMO_COUPLE ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; + data.trimmerColdjuncRaw = tempSensors[ TEMPSENSORS_TRIMMER_HEATER_COLD_JUNCTION ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; + data.cond1Raw = tempSensors[ TEMPSENSORS_CONDUCTIVITY_SENSOR_1 ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; + data.cond2Raw = tempSensors[ TEMPSENSORS_CONDUCTIVITY_SENSOR_2 ].rawADCReads[ MAX_NUM_OF_RAW_ADC_SAMPLES - 1 ]; - broadcastTemperatureSensorsData( (U08*)(&tempValuesForPublication), NUM_OF_TEMPERATURE_SENSORS * sizeof(F32) ); + broadcastTemperatureSensorsData( &data ); + dataPublicationTimerCounter = 0; } } Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r370877da1639ae01135cf4c5f1e009e1517bbf03 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 370877da1639ae01135cf4c5f1e009e1517bbf03) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -19,13 +19,15 @@ #include "CPLD.h" #include "DrainPump.h" #include "Heaters.h" +#include "ModeStandby.h" #include "OperationModes.h" #include "Reservoirs.h" #include "ROPump.h" #include "SystemComm.h" +#include "SystemCommMessages.h" +#include "TaskGeneral.h" #include "Timers.h" #include "Valves.h" -#include "ModeStandby.h" /** * @addtogroup DGStandbyMode @@ -34,18 +36,29 @@ // ********** private definitions ********** -#define WATER_SAMPLE_TIME_MS ( 10 * MS_PER_SECOND ) ///< Duration of water sample state (in ms). +#define FILTER_FLUSH_TIME_MS ( 120 * MS_PER_SECOND ) ///< Duration of filter flush state (in ms). +#define MAX_WATER_SAMPLE_TIME_MS ( 10 * MS_PER_SECOND ) ///< Maximum duration of water sample state (in ms). +#define FLUSH_EXPIRATION_TIME_MS ( 10 * SEC_PER_MIN * MS_PER_SECOND ) ///< Duration in which a filter flush is valid (in ms). +#define FILTER_FLUSH_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Filter flush data broadcast interval. // ********** private data ********** static DG_STANDBY_MODE_STATE_T standbyState = DG_STANDBY_MODE_STATE_START; ///< Currently active standby state. -static BOOL pendingSampleWaterRequest = FALSE; ///< Flag indicating HD has requested a water sample. +static BOOL stopSampleWaterRequest = FALSE; ///< Flag indicating HD has requested to stop sample water +static BOOL startSampleWaterRequest = FALSE; ///< Flag indicating HD has requested to start sample water +static BOOL flushFilterRequest = FALSE; ///< Flag indicating HD has requested to flush filters +static BOOL endSampleWaterRequest = FALSE; ///< Flag indicating HD has requested to end sample water + static BOOL pendingStartDGRequest = FALSE; ///< Flag indicating HD has requested DG start (go to re-circulate mode). static U32 waterSampleStartTime = 0; ///< Time stamp for start of water sample state. +static U32 filterFlushStartTime = 0; ///< Time stamp for start of filter flush state. +static U32 filterFlushPublishTimerCounter = 0; ///< Filter flush data publish timer counter. // ********** private function prototypes ********** static DG_STANDBY_MODE_STATE_T handleStandbyIdleState( void ); +static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterState( void ); +static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterIdleState( void ); static DG_STANDBY_MODE_STATE_T handleStandbySampleWaterState( void ); /*********************************************************************//** @@ -58,9 +71,15 @@ void initStandbyMode( void ) { standbyState = DG_STANDBY_MODE_STATE_START; - pendingSampleWaterRequest = FALSE; - pendingStartDGRequest = FALSE; + stopSampleWaterRequest = FALSE; + startSampleWaterRequest = FALSE; + flushFilterRequest = FALSE; + endSampleWaterRequest = FALSE; + waterSampleStartTime = 0; + filterFlushStartTime = 0; + filterFlushPublishTimerCounter = 0; + pendingStartDGRequest = FALSE; } /*********************************************************************//** @@ -76,21 +95,26 @@ initStandbyMode(); // set initial actuator states - setValveState( VPI, VALVE_STATE_CLOSED ); - setValveState( VSP, VALVE_STATE_CLOSED ); + setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); + setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); + setValveState( VRD, VALVE_STATE_R2_C_TO_NO ); + setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); - setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); + setValveState( VPI, VALVE_STATE_CLOSED ); + setValveState( VSP, VALVE_STATE_CLOSED ); + signalROPumpHardStop(); signalDrainPumpHardStop(); stopPrimaryHeater(); stopTrimmerHeater(); - requestConcentratePumpsOff( CONCENTRATEPUMPS_CP1 ); - requestConcentratePumpsOff( CONCENTRATEPUMPS_CP2 ); - // UV off + requestConcentratePumpsOff( CONCENTRATEPUMPS_CP1_ACID ); + requestConcentratePumpsOff( CONCENTRATEPUMPS_CP2_BICARB ); - resetReservoirLoadCellsOffset( DG_RESERVOIR_1 ); - resetReservoirLoadCellsOffset( DG_RESERVOIR_2 ); + // UV off + turnOffUVReactor( INLET_UV_REACTOR ); + turnOffUVReactor( OUTLET_UV_REACTOR ); } /*********************************************************************//** @@ -113,12 +137,20 @@ standbyState = handleStandbyIdleState(); break; + case DG_STANDBY_MODE_STATE_FLUSH_FILTER: + standbyState = handleStandbyFlushFilterState(); + break; + + case DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE: + standbyState = handleStandbyFlushFilterIdleState(); + break; + case DG_STANDBY_MODE_STATE_SAMPLE_WATER: standbyState = handleStandbySampleWaterState(); break; default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, 0, standbyState ) // TODO - add s/w fault enum to 1st data param + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_STANDBY_MODE_INVALID_EXEC_STATE, standbyState ) standbyState = DG_STANDBY_MODE_STATE_START; break; } @@ -136,52 +168,112 @@ *************************************************************************/ static DG_STANDBY_MODE_STATE_T handleStandbyIdleState( void ) { - DG_STANDBY_MODE_STATE_T result = DG_STANDBY_MODE_STATE_IDLE; + DG_STANDBY_MODE_STATE_T state = DG_STANDBY_MODE_STATE_IDLE; // go to standby solo mode if HD is turned off or stops communicating. if ( FALSE == isHDCommunicating() ) { // TODO if HD comm loss, should we wait an hour or so before going to solo standby? requestNewOperationMode( DG_MODE_SOLO ); } // if HD requests water sample, go to water sample state - else if ( TRUE == pendingSampleWaterRequest ) + else if ( TRUE == flushFilterRequest ) { - pendingSampleWaterRequest = FALSE; - waterSampleStartTime = getMSTimerCount(); + flushFilterRequest = FALSE; + filterFlushStartTime = getMSTimerCount(); setValveState( VPI, VALVE_STATE_OPEN ); - setValveState( VSP, VALVE_STATE_OPEN ); - result = DG_STANDBY_MODE_STATE_SAMPLE_WATER; + setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 + state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; } else if ( TRUE == pendingStartDGRequest ) { pendingStartDGRequest = FALSE; requestNewOperationMode( DG_MODE_CIRC ); } - return result; + return state; } /*********************************************************************//** * @brief + * The handleStandbyFilterFlushState function executes the flush filter state + * of the standby mode state machine. + * @details Inputs: filterFLushStartTime + * @details Outputs: Flushed the filters + * @return the next state + *************************************************************************/ +static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterState( void ) +{ + DG_STANDBY_MODE_STATE_T state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; + + if ( TRUE == didTimeout( filterFlushStartTime, FILTER_FLUSH_TIME_MS ) ) + { + state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; + } + + if ( FILTER_FLUSH_DATA_PUBLISH_INTERVAL <= filterFlushPublishTimerCounter++ ) + { + U32 const timeout = FILTER_FLUSH_TIME_MS / MS_PER_SECOND; + U32 const countdown = timeout - ( calcTimeSince( filterFlushStartTime ) / MS_PER_SECOND ); + filterFlushPublishTimerCounter = 0; + + broadcastFilterFlushData( timeout, countdown ); + } + + return state; +} + +/*********************************************************************//** + * @brief + * The handleStandbyFlushFilterIdleState function executes the flush filter state + * of the standby mode state machine. + * @details Inputs: filterFLushStartTime + * @details Outputs: Flushed the filters + * @return the next state + *************************************************************************/ +static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterIdleState( void ) +{ + DG_STANDBY_MODE_STATE_T state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; + + if ( TRUE == startSampleWaterRequest ) + { + startSampleWaterRequest = FALSE; + waterSampleStartTime = getMSTimerCount(); + setValveState( VPI, VALVE_STATE_OPEN ); + setValveState( VSP, VALVE_STATE_OPEN ); + state = DG_STANDBY_MODE_STATE_SAMPLE_WATER; + } + + if ( TRUE == endSampleWaterRequest ) + { + setValveState( VPI, VALVE_STATE_CLOSED ); + setValveState( VPD, VALVE_STATE_CLOSED ); + state = DG_STANDBY_MODE_STATE_IDLE; + } + + return state; +} + +/*********************************************************************//** + * @brief * The handleStandbySampleWaterState function executes the sample water state * of the standby mode state machine. - * @details Inputs: none - * @details Outputs: Sample water state of the standby mode executed + * @details Inputs: stopSampleWaterRequest, waterSampleStartTime + * @details Outputs: Finished sample water and closed valve * @return the next state *************************************************************************/ static DG_STANDBY_MODE_STATE_T handleStandbySampleWaterState( void ) { - DG_STANDBY_MODE_STATE_T result = DG_STANDBY_MODE_STATE_SAMPLE_WATER; + DG_STANDBY_MODE_STATE_T state = DG_STANDBY_MODE_STATE_SAMPLE_WATER; - // VPi and VSP valves open for 10 seconds, then close and return to idle state - if ( TRUE == didTimeout( waterSampleStartTime, WATER_SAMPLE_TIME_MS ) ) + // After HD requests to stop or 10 seconds has elapsed, close and return to idle state + if ( ( TRUE == stopSampleWaterRequest ) || ( TRUE == didTimeout( waterSampleStartTime, MAX_WATER_SAMPLE_TIME_MS ) ) ) { - setValveState( VPI, VALVE_STATE_CLOSED ); setValveState( VSP, VALVE_STATE_CLOSED ); - result = DG_STANDBY_MODE_STATE_IDLE; + setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 + state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } - return result; + return state; } /*********************************************************************//** @@ -191,17 +283,58 @@ * @details Outputs: pendingSampleWaterRequest * @return TRUE if request accepted, FALSE if not. *************************************************************************/ -BOOL requestWaterSample( void ) +void waterSampleCommandHandler( SAMPLE_WATER_CMD_T sampleWaterCmd ) { - BOOL result = FALSE; + DG_CMD_RESPONSE_T cmdResponse; - if ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) + cmdResponse.commandID = DG_CMD_SAMPLE_WATER; + cmdResponse.rejected = TRUE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_INVALID_MODE; + + switch ( sampleWaterCmd ) { - result = TRUE; - pendingSampleWaterRequest = TRUE; + case SAMPLE_WATER_CMD_STOP: + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_SAMPLE_WATER == standbyState ) ) + { + stopSampleWaterRequest = TRUE; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + } + break; + + case SAMPLE_WATER_CMD_START: + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE == standbyState ) ) + { + startSampleWaterRequest = TRUE; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + } + break; + + case SAMPLE_WATER_CMD_FLUSH: + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) ) + { + flushFilterRequest = TRUE; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + } + break; + + case SAMPLE_WATER_CMD_END: + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE == standbyState ) ) + { + endSampleWaterRequest = TRUE; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + } + break; + + default: + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_INVALID_PARAMETER; + break; } - return result; + sendCommandResponseMsg( &cmdResponse ); } /*********************************************************************//** @@ -249,6 +382,29 @@ /*********************************************************************//** * @brief + * The startDGHeatDisinfect function starts heat disinfect mode. + * @details Inputs: standbyState + * @details Outputs: none + * @return: TRUE if the switch was successful + *************************************************************************/ +BOOL startDGHeatDisinfect( void ) +{ + BOOL status = FALSE; + + // If DG is in standby mode and the standby mode is in Idle state or if DG is in solo mode, request DG heat disinfect + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) || + ( DG_MODE_SOLO == getCurrentOperationMode() ) ) + { + requestNewOperationMode( DG_MODE_HEAT ); + + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief * The getCurrentStandbyState function returns the current state of standby mode. * @details Inputs: standbyState * @details Outputs: none Index: firmware/App/Modes/ModeStandby.h =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -39,11 +39,13 @@ DG_STANDBY_MODE_STATE_T getCurrentStandbyState( void ); // get the current state of the standby mode. -BOOL requestWaterSample( void ); // HD requests water sample +void waterSampleCommandHandler( SAMPLE_WATER_CMD_T sampleWaterCmd ); BOOL requestDGStart( void ); // HD requests DG start (go to re-circulate mode) BOOL startDGFlush( void ); +BOOL startDGHeatDisinfect( void ); // HD start heat disinfect mode + /**@}*/ #endif Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -165,6 +165,14 @@ SW_FAULT_ID_DRAIN_PUMP_INVALID_RPM_SELECTED, SW_FAULT_ID_ALARM_MGMT_INVALID_ALARM_ID, SW_FAULT_ID_DG_FLUSH_INVALID_EXEC_STATE, // 75 + SW_FAULT_ID_HEAT_DISINFECT_INVALID_EXEC_STATE, + SW_FAULT_ID_INVALID_DG_RESERVOIR_SELECTED, + SW_FAULT_ID_STANDBY_MODE_INVALID_EXEC_STATE, + SW_FAULT_ID_RECIRC_MODE_INVALID_EXEC_STATE, + SW_FAULT_ID_DRAIN_MODE_INVALID_EXEC_STATE, // 80 + SW_FAULT_ID_FILL_MODE_INVALID_EXEC_STATE, + SW_FAULT_ID_PRESSURE_INVALID_EXEC_STATE, + SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r45f4646609e6dd39691102e109d0b5c14f97e054 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 45f4646609e6dd39691102e109d0b5c14f97e054) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -23,34 +23,35 @@ #include "Reservoirs.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" -#include "Timers.h" -#include "Valves.h" +#include "Timers.h" +#include "Valves.h" + +/** + * @addtogroup Reservoirs + * @{ + */ + +// ********** private definitions ********** + +#define MIN_RESERVOIR_VOLUME_ML 0 ///< Minimum reservoir volume in mL. +#define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. +#define DEFAULT_FILL_VOLUME_ML 1700 ///< Default fill volume for treatment in mL. +#define DISINFECT_FILL_VOLUME_ML 2400 ///< Fill volume for disinfection in mL. +#define MAX_FILL_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum fill volume in mL. +#define DEFAULT_DRAIN_VOLUME_ML 0 ///< Default drain volume in mL. +#define MAX_DRAIN_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum drain volume in mL. -/** - * @addtogroup Reservoirs - * @{ - */ +#define MAX_RESERVOIR_WEIGHT 10000 ///< Maximum reservoir weight in grams. + +#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. -// ********** private definitions ********** +// ********** private data ********** + +static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. + +static OVERRIDE_U32_T activeReservoir = { 0, 0, 0, 0 }; ///< The active reservoir that the DG is filling/draining/etc. +static OVERRIDE_U32_T fillVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir fill volume (in mL). -#define MIN_RESERVOIR_VOLUME_ML 0 ///< Minimum reservoir volume in mL. -#define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. -#define DEFAULT_FILL_VOLUME_ML 1700 ///< Default fill volume for treatment in mL. -#define DISINFECT_FILL_VOLUME_ML 2400 ///< Fill volume for disinfection in mL. -#define MAX_FILL_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum fill volume in mL. -#define DEFAULT_DRAIN_VOLUME_ML 0 ///< Default drain volume in mL. -#define MAX_DRAIN_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum drain volume in mL. - -#define MAX_RESERVOIR_WEIGHT 10000 ///< Maximum reservoir weight in grams. - -#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. - -// ********** private data ********** - -static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. - -static OVERRIDE_U32_T activeReservoir = { 0, 0, 0, 0 }; ///< The active reservoir that the DG is filling/draining/etc. -static OVERRIDE_U32_T fillVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir fill volume (in mL). static OVERRIDE_U32_T drainVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir drain volume (in mL). /// The reservoirs' associate load cell. @@ -67,58 +68,54 @@ static DG_RESERVOIR_ID_T getActiveReservoir( void ); static U32 getReservoirFillVolumeTargetMl( void ); -static U32 getReservoirDrainVolumeTargetMl( void ); -/*********************************************************************//** - * @brief - * The initReservoirs function initializes the Reservoirs module. - * @details Inputs: none - * @details Outputs: Reservoirs module initialized - * @return none - *************************************************************************/ -void initReservoirs( void ) +static U32 getReservoirDrainVolumeTargetMl( void ); + +/*********************************************************************//** + * @brief + * The initReservoirs function initializes the Reservoirs module. + * @details Inputs: none + * @details Outputs: Reservoirs module initialized + * @return none + *************************************************************************/ +void initReservoirs( void ) { activeReservoir.data = (U32)DG_RESERVOIR_1; - setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); - setValveState( VRD, VALVE_STATE_R2_C_TO_NO ); - setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); - setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); - - fillVolumeTargetMl.data = DEFAULT_FILL_VOLUME_ML; - drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; -} - -/*********************************************************************//** - * @brief - * The execReservoirs function manages periodic tasks for the Reservoirs module. - * @details Inputs: none - * @details Outputs: Reservoir data broadcast on interval - * @return none - *************************************************************************/ -void execReservoirs( void ) + fillVolumeTargetMl.data = DEFAULT_FILL_VOLUME_ML; + drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; +} + +/*********************************************************************//** + * @brief + * The execReservoirs function manages periodic tasks for the Reservoirs module. + * @details Inputs: none + * @details Outputs: Reservoir data broadcast on interval + * @return none + *************************************************************************/ +void execReservoirs( void ) +{ + // publish active reservoir, fill/drain volume targets at 1 Hz. + if ( ++reservoirDataPublicationTimerCounter >= RESERVOIR_DATA_PUB_INTERVAL ) + { + U32 actRes = getActiveReservoir(); + U32 filVol = getReservoirFillVolumeTargetMl(); + U32 drnVol = getReservoirDrainVolumeTargetMl(); + broadcastReservoirData( actRes, filVol, drnVol ); + reservoirDataPublicationTimerCounter = 0; + } +} + +/*********************************************************************//** + * @brief + * The setActiveReservoirCmd function sets the given reservoir as active + * (meaning HD will be drawing from this reservoir). + * @details Inputs: none + * @details Outputs: Specified reservoir is set as active. + * @param resID ID of reservoir to set as active + * @return none + *************************************************************************/ +void setActiveReservoirCmd( DG_RESERVOIR_ID_T resID ) { - // publish active reservoir, fill/drain volume targets at 1 Hz. - if ( ++reservoirDataPublicationTimerCounter >= RESERVOIR_DATA_PUB_INTERVAL ) - { - U32 actRes = getActiveReservoir(); - U32 filVol = getReservoirFillVolumeTargetMl(); - U32 drnVol = getReservoirDrainVolumeTargetMl(); - broadcastReservoirData( actRes, filVol, drnVol ); - reservoirDataPublicationTimerCounter = 0; - } -} - -/*********************************************************************//** - * @brief - * The setActiveReservoirCmd function sets the given reservoir as active - * (meaning HD will be drawing from this reservoir). - * @details Inputs: none - * @details Outputs: Specified reservoir is set as active. - * @param resID ID of reservoir to set as active - * @return none - *************************************************************************/ -void setActiveReservoirCmd( DG_RESERVOIR_ID_T resID ) -{ DG_CMD_RESPONSE_T cmdResponse; cmdResponse.commandID = DG_CMD_SWITCH_RESERVOIR; @@ -440,7 +437,21 @@ BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId, U32 timeout ) { BOOL result = FALSE; - F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + + F32 loadcellWeight = 0.0; + + // TODO remove this code once the load cell is repaired + if ( DG_RESERVOIR_1 == reservoirId ) + { + loadcellWeight = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_BACKUP ); + } + else + { + loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + } + // TODO remove the above code the load cell is repaired + + //F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); U32 const targetDrainVolume = getReservoirDrainVolumeTargetMl(); if ( loadcellWeight < reservoirLowestWeight[ reservoirId ] ) @@ -470,21 +481,6 @@ /*********************************************************************//** * @brief - * The resetReservoirLoadCellsOffset function sets the reservoir's load cells - * offset to zero. - * @details Inputs: associateLoadCell[], redundantLoadCell[] - * @details Outputs: reset reservoir's associate load cells auto calibration offset - * @param reservoirId reservoir id - * @return none - *************************************************************************/ -void resetReservoirLoadCellsOffset( DG_RESERVOIR_ID_T reservoirId ) -{ - resetLoadCellOffset( associatedLoadCell[ reservoirId ] ); - resetLoadCellOffset( redundantLoadCell[ reservoirId ] ); -} - -/*********************************************************************//** - * @brief * The getActiveReservoir function gets the active reservoir. * @details Inputs: activeReservoir * @details Outputs: none Index: firmware/App/Services/Reservoirs.h =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -33,6 +33,13 @@ #pragma pack(push,1) +/// Fill command data structure. +typedef struct +{ + U32 fillToVolumeMl; ///< Target volume to fill to (in mL) + U32 cmd; ///< General command (start/stop) +} FILL_CMD_T; + /// Drain command data structure. typedef struct { @@ -48,18 +55,26 @@ U32 rejectCode; ///< Reason code for rejecting the command } DG_CMD_RESPONSE_T; -#pragma pack(pop) +/// Reservoir data struct. +typedef struct +{ + U32 activeReservoir; ///< Active reservoir ID + U32 fillToVolumeMl; ///< Volume target to fill to + U32 drainToVolumeMl; ///< Volume target to drain to +} RESERVOIR_DATA_T; -// ********** public function prototypes ********** +#pragma pack(pop) + +// ********** public function prototypes ********** + +void initReservoirs( void ); +void execReservoirs( void ); -void initReservoirs( void ); -void execReservoirs( void ); - void setActiveReservoirCmd( DG_RESERVOIR_ID_T resID ); // handle switch reservoirs command from HD -void changeValveSettingCmd( DG_VALVE_SETTING_ID_T valveSettingID ); // handle valve setting change command from HD -void startFillCmd( U32 fillToVolMl ); // handle fill command from HD -void stopFillCmd( void ); // handle stop fill command from HD -void startDrainCmd( DRAIN_CMD_T drainCmd ); // handle drain command from HD +void changeValveSettingCmd( DG_VALVE_SETTING_ID_T valveSettingID ); // handle valve setting change command from HD +void startFillCmd( U32 fillToVolMl ); // handle fill command from HD +void stopFillCmd( void ); // handle stop fill command from HD +void startDrainCmd( DRAIN_CMD_T drainCmd ); // handle drain command from HD void stopDrainCmd( void ); // handle stop drain command from HD void tareReservoir( void ); @@ -71,16 +86,14 @@ BOOL hasTargetFillVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId ); BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId , U32 timeout ); - -void resetReservoirLoadCellsOffset( DG_RESERVOIR_ID_T reservoirId ); - -BOOL testSetDGActiveReservoirOverride( DG_RESERVOIR_ID_T value ); -BOOL testResetDGActiveReservoirOverride( void ); -BOOL testSetReservoirFillVolumeMlOverride( U32 value ); -BOOL testResetReservoirFillVolumeMlOverride( void ); -BOOL testSetReservoirDrainVolumeMlOverride( U32 value ); -BOOL testResetReservoirDrainVolumeMlOverride( void ); - -/**@}*/ - -#endif + +BOOL testSetDGActiveReservoirOverride( DG_RESERVOIR_ID_T value ); +BOOL testResetDGActiveReservoirOverride( void ); +BOOL testSetReservoirFillVolumeMlOverride( U32 value ); +BOOL testResetReservoirFillVolumeMlOverride( void ); +BOOL testSetReservoirDrainVolumeMlOverride( U32 value ); +BOOL testResetReservoirDrainVolumeMlOverride( void ); + +/**@}*/ + +#endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -37,11 +37,11 @@ // ********** private definitions ********** #define NUM_OF_CAN_OUT_BUFFERS 5 ///< Number of CAN buffers for transmit -#define NUM_OF_CAN_IN_BUFFERS 6 ///< Number of CAN buffers for receiving +#define NUM_OF_CAN_IN_BUFFERS 7 ///< Number of CAN buffers for receiving #ifndef DEBUG_ENABLED - #define NUM_OF_MSG_IN_BUFFERS 6 ///< Number of Msg buffers for receiving + #define NUM_OF_MSG_IN_BUFFERS 7 ///< Number of Msg buffers for receiving #else - #define NUM_OF_MSG_IN_BUFFERS 7 + #define NUM_OF_MSG_IN_BUFFERS 8 #define SCI1_RECEIVE_DMA_REQUEST 30 #define SCI1_TRANSMIT_DMA_REQUEST 31 #endif @@ -81,9 +81,9 @@ { COMM_BUFFER_OUT_CAN_DG_ALARM, COMM_BUFFER_OUT_CAN_DG_2_HD, + COMM_BUFFER_OUT_CAN_DG_2_UI, COMM_BUFFER_OUT_CAN_DG_BROADCAST, - COMM_BUFFER_OUT_CAN_PC, - COMM_BUFFER_OUT_CAN_DG_2_UI + COMM_BUFFER_OUT_CAN_PC }; /// Array of in-coming CAN buffers. @@ -93,6 +93,7 @@ COMM_BUFFER_IN_CAN_UI_ALARM, COMM_BUFFER_IN_CAN_HD_2_DG, COMM_BUFFER_IN_CAN_HD_BROADCAST, + COMM_BUFFER_IN_CAN_UI_2_DG, COMM_BUFFER_IN_CAN_UI_BROADCAST, COMM_BUFFER_IN_CAN_PC, #ifdef DEBUG_ENABLED @@ -999,6 +1000,10 @@ handlePowerOffWarning( message ); break; + case MSG_ID_ALARM_CLEARED: + handleAlarmClear( message ); + break; + case MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS: handleSetDialysateTemperatureCmd( message ); break; @@ -1043,6 +1048,10 @@ handleStartStopDGFlush( message ); break; + case MSG_ID_DG_START_STOP_HEAT_DISINFECT: + handleStartStopDGHeatDisinfect( message ); + break; + default: // unrecognized message ID received - ok, ignore - may be a test message handled below break; @@ -1208,6 +1217,38 @@ handleTestUVReactorsHealthOverride( message ); break; + case MSG_ID_DG_SET_CALIBRATION_RECORD: + handleSetDGCalibrationRecord( message ); + break; + + case MSG_ID_DG_GET_CALIBRATION_RECORD: + handleGetDGCalibrationRecord( message ); + break; + + case MSG_ID_DG_SET_SYSTEM_RECORD: + handleSetDGSystemRecord( message ); + break; + + case MSG_ID_DG_GET_SYSTEM_RECORD: + handleGetDGSystemRecord( message ); + break; + + case MSG_ID_DG_GET_SERVICE_RECORD: + handleGetDGServiceRecord( message ); + break; + + case MSG_ID_DG_SET_SERVICE_RECORD: + handleSetDGServiceRecord( message ); + break; + + case MSG_ID_DG_GET_SCHEDULED_RUNS_RECORD: + handleGetDGScheduledRunsRecord( message ); + break; + + case MSG_ID_DG_SET_SCHEDULED_RUNS_RECORD: + handleSetDGScheduledRunsRecord( message ); + break; + case MSG_ID_DG_FLUID_LEAK_SEND_INTERVAL_OVERRIDE: handleSetFluidLeakBroadcastIntervalOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r3f7419dca9422a1e65ca166c250ae599634a2a90 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3f7419dca9422a1e65ca166c250ae599634a2a90) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -26,7 +26,6 @@ #include "FPGA.h" #include "Heaters.h" #include "LoadCell.h" -#include "MessagePayloads.h" #include "ModeFlush.h" #include "ModeStandby.h" #include "ModeRecirculate.h" @@ -43,7 +42,6 @@ #include "TemperatureSensors.h" #include "Thermistors.h" #include "Utilities.h" -#include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" #include "UVReactors.h" @@ -416,7 +414,7 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); return result; -} +} /*********************************************************************//** * @brief @@ -449,31 +447,24 @@ /*********************************************************************//** * @brief * The broadcastHeatersData function sends out DG heaters data - * @details Inputs: heaters data - * @details Outputs: heatears data msg constructed and queued - * @param mainPrimaryDC main primary heater duty cycle - * @param smallPrimaryDC small primary heater duty cycle - * @param trimmerDC trimmer heater duty cycle + * @details Inputs: none + * @details Outputs: heaters data msg constructed and queued + * @param heatersData which is the heaters data structure pointer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastHeatersData ( U32 mainPrimaryDC, U32 smallPrimaryDC, U32 trimmerDC ) +BOOL broadcastHeatersData ( HEATERS_DATA_T *heatersData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - HEATERS_DATA_T payload; - + // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_HEATERS_DATA; msg.hdr.payloadLen = sizeof( HEATERS_DATA_T ); - payload.mainPrimayHeaterDC = mainPrimaryDC; - payload.smallPrimaryHeaterDC = smallPrimaryDC; - payload.trimmerHeaterDC = trimmerDC; + memcpy( payloadPtr, heatersData, sizeof( HEATERS_DATA_T ) ); - memcpy( payloadPtr, &payload, sizeof( HEATERS_DATA_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); @@ -672,11 +663,10 @@ * sensors data. * @details Inputs: none * @details Outputs: temperature sensors data message constructed and queued - * @param sensorsValue sensors value array - * @param byteLength payload length in bytes + * @param tempSensorsData which is constructed and queued * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ) +BOOL broadcastTemperatureSensorsData ( TEMPERATURE_SENSORS_DATA_T* tempSensorsData ) { BOOL result; MESSAGE_T msg; @@ -685,9 +675,9 @@ // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_TEMPERATURE_DATA; - msg.hdr.payloadLen = byteLength; + msg.hdr.payloadLen = sizeof( TEMPERATURE_SENSORS_DATA_T ); - memcpy( payloadPtr, sensorsValue, byteLength ); + memcpy( payloadPtr, tempSensorsData, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); @@ -774,6 +764,25 @@ /*********************************************************************//** * @brief + * The handleAlarmClear function handles a clear alarm message from the HD. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleAlarmClear( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U32 alarmId; + + memcpy(&alarmId, message->payload, sizeof( U32 ) ); + clearAlarm( (ALARM_ID_T)alarmId ); + } +} + +/*********************************************************************//** + * @brief * The handleSetDialysateTemperatureCmd function handles a dialysate temperature * set points message from the HD. * @details Inputs: none @@ -883,6 +892,104 @@ return result; } +/*********************************************************************//** + * @brief + * The broadcastHeatDisinfectData function sends out the heat disinfect + * mode data. + * @details Inputs: none + * @details Outputs: heat disinfect data msg constructed and queued + * @param heatDisinfectData which is heat disinfect msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastHeatDisinfectData( MODE_HEAT_DISINFECT_DATA_T *heatDisinfectData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_HEAT_DISINFECT_DATA; + msg.hdr.payloadLen = sizeof( MODE_HEAT_DISINFECT_DATA_T ); + + memcpy( payloadPtr, heatDisinfectData, sizeof( MODE_HEAT_DISINFECT_DATA_T ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The broadcastFilterFlushData function sends out the filter flush progress data. + * @details Inputs: none + * @details Outputs: filter flush data msg constructed and queued + * @param timeout flush filter timeout (in sec) + * @param countdown flush filter timeout count down (in sec) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_FILTER_FLUSH_PROGRESS; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &timeout, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &countdown, sizeof( U32 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGCalibrationRecord function sends out the DG calibration + * record. + * @details Inputs: none + * @details Outputs: DG calibration record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param calRcrdAddress: start address of the calibration record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_CALIBRATION_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, calRcrdAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + /***********************************************************************//** * @brief * The broadcastFluidLeakState function constructs a DG fluid leak state msg to \n @@ -941,6 +1048,123 @@ /*********************************************************************//** * @brief + * The sendDGSystemRecord function sends out the DG system record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param sysRcrdAddress: start address of the system record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SYSTEM_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, sysRcrdAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGServiceRecord function sends out the DG service record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param srvcRcrdAddress: start address of the service record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SERVICE_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, srvcRcrdAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendDGServiceRecord function sends out the DG service record. + * @details Inputs: none + * @details Outputs: DG system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param scheduledRcrdAddress: start address of the scheduled runs record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, scheduledRcrdAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The sendCommandResponseMsg function constructs a command response to HD * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -1032,13 +1256,21 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( U32 ) ) + if ( message->hdr.payloadLen == sizeof( FILL_CMD_T ) ) { - U32 fillToVolumeMl; + FILL_CMD_T fillCmd; result = TRUE; - memcpy( &fillToVolumeMl, message->payload, sizeof( U32 ) ); - startFillCmd( fillToVolumeMl ); + memcpy( &fillCmd, message->payload, sizeof( FILL_CMD_T ) ); + + if ( DG_CMD_START == fillCmd.cmd ) + { + startFillCmd( fillCmd.fillToVolumeMl ); + } + else + { + stopFillCmd(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); @@ -1138,12 +1370,13 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == 0 ) + if ( message->hdr.payloadLen == sizeof( U32 ) ) { - if ( DG_MODE_STAN == getCurrentOperationMode() ) - { - result = requestWaterSample(); - } + SAMPLE_WATER_CMD_T sampleWaterCmd; + + result = TRUE; + memcpy( &sampleWaterCmd, message->payload, sizeof( U32 ) ); + waterSampleCommandHandler( sampleWaterCmd ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); @@ -1962,31 +2195,6 @@ /*********************************************************************//** * @brief - * The handleSetAccelCalibration function handles a request to set - * accelerometer calibration factors. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleSetAccelCalibration( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == sizeof( ACCEL_CAL_PAYLOAD_T ) ) - { - ACCEL_CAL_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof( ACCEL_CAL_PAYLOAD_T ) ); - result = setAccelCalibration( payload.xOffset, payload.yOffset, payload.zOffset ); - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestSetConductivityOverrideRequest function handles a * request to override a conductivity sensor's value * @details Inputs: none @@ -2566,8 +2774,74 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/************************************************************************* + * @brief + * The handleStartStopDGHeatDisinfect function handles a request start or + * stop DG heat disifect cycle. + * @details Inputs: none + * @details Outputs: message handled + * @param message: a pointer to the message to handle + * @return result + *************************************************************************/ +BOOL handleStartStopDGHeatDisinfect( MESSAGE_T *message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGHeatDisinfect; + + memcpy( &startingDGHeatDisinfect, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGHeatDisinfect ) + { + status = startDGHeatDisinfect(); + } + else + { + status = stopDGHeatDisinfect(); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); + + return status; +} + /*********************************************************************//** * @brief +* The handleSetDGCalibrationRecord function handles a request to set the DG +* calibration data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGCalibrationRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setCalibrationRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief * The handleStartStopDGFlush function handles a request to override start * or stop DG flush mode. * @details Inputs: none @@ -2603,4 +2877,208 @@ return result; } +/*********************************************************************//** +* @brief +* The handleGetDGCalibrationRecord function handles a request to get the DG +* calibration data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGCalibrationRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getCalibrationRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGSystemRecord function handles a request to set the DG +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGSystemRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setSystemRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGSystemRecord function handles a request to get the DG +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGSystemRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getSystemRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGServiceRecord function handles a request to get the DG +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGServiceRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getServiceRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGServiceRecord function handles a request to set the DG +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGServiceRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setServiceRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** +* @brief +* The handleGetDGServiceRecord function handles a request to get the DG +* scheduled runs data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetDGScheduledRunsRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getScheduledRunsRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetDGScheduledRunsRecord function handles a request to set the DG +* scheduled runs data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetDGScheduledRunsRecord( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = setScheduledRunsRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r5d8530d242d8065178eab9e3e5d8e4561b790e01 -r3eb7c2e62c727be195cd937d49957db9d4ba83b4 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5d8530d242d8065178eab9e3e5d8e4561b790e01) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 3eb7c2e62c727be195cd937d49957db9d4ba83b4) @@ -22,10 +22,14 @@ #include "DrainPump.h" #include "Fans.h" #include "FluidLeak.h" +#include "Heaters.h" #include "ModeFlush.h" +#include "ModeHeatDisinfect.h" #include "MsgQueues.h" +#include "NVDataMgmt.h" #include "Reservoirs.h" #include "ROPump.h" +#include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -84,10 +88,10 @@ BOOL broadcastReservoirData( U32 resID, U32 fillToVol, U32 drainToVol ); // MSG_ID_HEATERS_READINGS -BOOL broadcastHeatersData ( U32 mainPrimaryDC, U32 smallPrimaryDC, U32 trimmerDC ); +BOOL broadcastHeatersData( HEATERS_DATA_T *heatersData ); // MSG_ID_TEMPERATURE_SENSORS_READINGS -BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ); +BOOL broadcastTemperatureSensorsData( TEMPERATURE_SENSORS_DATA_T* tempSensorsData ); // MSG_ID_DG_CONDUCTIVITY_DATA BOOL broadcastConductivityData( void * conductivityDataPtr ); @@ -101,6 +105,9 @@ // MSG_ID_DG_UV_REACTORS_DATA BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ); +// MSG_ID_DG_FILTER_FLUSH_PROGRESS +BOOL broadcastFilterFlushData( U32 timeout, U32 countdown ); + // MSG_ID_DG_FLUID_LEAK_STATE BOOL broadcastFluidLeakState( FLUID_LEAK_STATES_T state); @@ -113,6 +120,9 @@ // MSG_ID_POWER_OFF_WARNING void handlePowerOffWarning( MESSAGE_T *message ); +// MSG_ID_ALARM_CLEARED +void handleAlarmClear( MESSAGE_T *message ); + // MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS void handleSetDialysateTemperatureCmd( MESSAGE_T *message ); @@ -143,6 +153,24 @@ // MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD void handleStartStopTrimmerHeaterCmd( MESSAGE_T *message ); +// MSG_ID_DG_UV_REACTORS_DATA +BOOL broadcastUVReactorsData( UV_REACTORS_DATA_T *uvReactorsData ); + +// MSG_ID_DG_HEAT_DISINFECT_DATA +BOOL broadcastHeatDisinfectData( MODE_HEAT_DISINFECT_DATA_T *heatDisinfectData ); + +// MSG_ID_DG_SEND_CALIBRATION_DATA +BOOL sendDGCalibrationRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* calRcrdAddress ); + +// MSG_ID_DG_SEND_SYSTEM_RECORD +BOOL sendDGSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ); + +// MSG_ID_DG_SEND_SERVICE_RECORD +BOOL sendDGServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ); + +// MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD +BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ); + // *********** public test support message functions ********** #ifdef DEBUG_ENABLED @@ -226,9 +254,6 @@ // MSG_ID_DG_ACCEL_SEND_INTERVAL_OVERRIDE: void handleTestDGAccelBroadcastIntervalOverrideRequest( MESSAGE_T *message ); -// MSG_ID_DG_ACCEL_SET_CALIBRATION: -void handleSetAccelCalibration( MESSAGE_T *message ); - // MSG_ID_DG_START_STOP_INLET_UV_REACTOR void handleStartStopUVReactors( MESSAGE_T *message ); @@ -283,6 +308,33 @@ // MSG_ID_DG_START_STOP_FLUSH BOOL handleStartStopDGFlush( MESSAGE_T *message ); +// MSG_ID_DG_START_STOP_HEAT_DISINFECT +BOOL handleStartStopDGHeatDisinfect( MESSAGE_T *message ); + +// MSG_ID_DG_SET_CALIBRATION_DATA +void handleSetDGCalibrationRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_CALIBRATION_RECORD +void handleGetDGCalibrationRecord( MESSAGE_T *message ); + +// MSG_ID_DG_SET_SYSTEM_DATA +void handleSetDGSystemRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SYSTEM_DATA +void handleGetDGSystemRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SERVICE_RECORD +void handleGetDGServiceRecord( MESSAGE_T *message ); + +// MSG_ID_DG_SET_SERVICE_RECORD +void handleSetDGServiceRecord( MESSAGE_T *message ); + +// MSG_ID_DG_GET_SCHEDULED_RUNS_RECORD +void handleGetDGScheduledRunsRecord( MESSAGE_T *message ); + +// MSG_ID_DG_SET_SCHEDULED_RUNS_RECORD +void handleSetDGScheduledRunsRecord( MESSAGE_T *message ); + /**@}*/ #endif