Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -46,12 +46,15 @@ DRP_SPEED_RPM_TO_ADC_FACTOR ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ///< Drain pump minimum RPM to DAC conversion. #define DRAIN_PUMP_MAX_DAC ( ( (F32)MAX_DRAIN_PUMP_RPM * \ DRP_SPEED_RPM_TO_ADC_FACTOR ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ///< Drain pump maximum RPM to DAC conversion. -#define DRAIN_PUMP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the Drain Pump data is published on the CAN bus. +#define DRAIN_PUMP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the Drain Pump data is published on the CAN bus. -#define DRP_CONTROL_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the Drain pump is controlled. +#define DRP_CONTROL_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the Drain pump is controlled. -#define DRP_SPEED_ADC_TO_RPM_CONVERSION 12.94 ///< conversion factor from ADC counts to RPM for Drain pump. -#define DRP_SPEED_RPM_TO_ADC_FACTOR ( 1.0 / DRP_SPEED_ADC_TO_RPM_CONVERSION ) ///< conversion factor from RPM to ADC counts for Drain pump. +#define DRP_SPEED_ADC_TO_RPM_CONVERSION 12.94 ///< Conversion factor from ADC counts to RPM for Drain pump. +#define DRP_SPEED_RPM_TO_ADC_FACTOR ( 1.0 / DRP_SPEED_ADC_TO_RPM_CONVERSION ) ///< Conversion factor from RPM to ADC counts for Drain pump. + +#define TOGGLE_PERIOD_RESOLUTION_SECONDS 0.000005 ///< Toggle period to resolution in seconds. +#define ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION 4 ///< Rotational to toggle period conversion coefficient. #define DRAIN_PUMP_P_COEFFICIENT 0.5 ///< P term for drain pump delta pressure control. #define DRAIN_PUMP_I_COEFFICIENT 1.0 ///< I term for drain pump delta pressure control. @@ -89,7 +92,7 @@ #define GET_DIP_SW2_TEST() ( ( mibspiREG1->PC2 & DRAIN_PUMP_TEST2_SPI1_PORT_MASK ) != 0 ) // ********** private data ********** - + static DRAIN_PUMP_STATE_T drainPumpState = DRAIN_PUMP_OFF_STATE; ///< current state of drain pump controller state machine static U32 drainPumpDataPublicationTimerCounter = 0; ///< used to schedule drain pump data publication to CAN bus static U32 drainPumpDAC = 0; ///< initial drain pump DAC value @@ -100,8 +103,8 @@ static OVERRIDE_U32_T drainPumpDataPublishInterval = { DRAIN_PUMP_DATA_PUB_INTERVAL, DRAIN_PUMP_DATA_PUB_INTERVAL, 0, 0 }; ///< interval (in ms) at which to publish RO flow data to CAN bus -static OVERRIDE_U32_T targetDrainPumpRPM = { 0, 0, 0, 0 }; ///< Target drain pump RPM -static OVERRIDE_F32_T targetDrainPumpDeltaPressure = { 0.0, 0.0, 0.0, 0.0 }; ///< Target delta pressure for the drain pump +static U32 targetDrainPumpRPM = 0; ///< Target drain pump RPM +static F32 targetDrainPumpDeltaPressure = 0.0; ///< Target delta pressure for the drain pump static U32 drainControlTimerCounter = 0; ///< Determines when to perform control on drain pump static BOOL hasClosedLoopBeenRequested = FALSE; ///< Closed loop pump control flag @@ -112,6 +115,14 @@ static U32 drainPumpSelfTestTimerCount = 0; ///< timer counter for drain pump self test */ +/* + * Conversion of ADC count from micro seconds resolution to seconds and also converting toggle to pulse period. + * RPM = ( 1 / ADC ) * conversion coefficient. + * ADC = ( 1 / RPM ) * conversion coefficient. + */ +/// ADC to RPM conversion coefficient or RPM to ADC conversion +static const F32 conversionCoeff = SEC_PER_MIN / ( TOGGLE_PERIOD_RESOLUTION_SECONDS * ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION ); + // ********** private function prototypes ********** static DRAIN_PUMP_STATE_T handleDrainPumpOffState( void ); @@ -166,7 +177,7 @@ #else drainPumpDAC = (U32)((F32)rpm * DRP_SPEED_RPM_TO_ADC_FACTOR + FLOAT_TO_INT_ROUNDUP_OFFSET); #endif - targetDrainPumpRPM.data = rpm; + targetDrainPumpRPM = rpm; drainPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; drainPumpControlModeSet = drainPumpControlMode; result = TRUE; @@ -191,14 +202,14 @@ BOOL result = FALSE; // Check the delta pressure is in range - if ( deltaP >= MIN_ALLOWED_TARGET_DELTA_PRESSURE && deltaP <= MIN_ALLOWED_TARGET_DELTA_PRESSURE ) + if ( ( deltaP >= MIN_ALLOWED_TARGET_DELTA_PRESSURE ) && ( deltaP <= MIN_ALLOWED_TARGET_DELTA_PRESSURE ) ) { // Set all the variables for closed loop mode - targetDrainPumpDeltaPressure.data = deltaP; - hasClosedLoopBeenRequested = TRUE; - drainPumpDAC = DRAIN_PUMP_MIN_DAC; - drainPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; - drainPumpControlModeSet = drainPumpControlMode; + targetDrainPumpDeltaPressure = deltaP; + hasClosedLoopBeenRequested = TRUE; + drainPumpDAC = DRAIN_PUMP_MIN_DAC; + drainPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; + drainPumpControlModeSet = drainPumpControlMode; result = TRUE; } else @@ -224,7 +235,7 @@ stopDrainPump(); // Reset all the variables to stop mode - targetDrainPumpRPM.data = 0; + targetDrainPumpRPM = 0; drainPumpState = DRAIN_PUMP_OFF_STATE; hasClosedLoopBeenRequested = FALSE; drainPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; // Set the control mode to none @@ -241,7 +252,7 @@ void execDrainPumpMonitor( void ) { // Convert speed ADC to RPM - currentDrainPumpRPM = getFPGADrainPumpSpeed() * DRP_SPEED_ADC_TO_RPM_CONVERSION; + currentDrainPumpRPM = conversionCoeff / getFPGADrainPumpSpeed(); // The RPM is only checked in open loop state that the pump is run at a fixed RPM. // The persistent alarm waits for a couple of seconds before raising an alarm, this is supposed to cover @@ -310,39 +321,25 @@ * The getTargetDrainPumpRPM function gets the current target drain pump * RPM. * @details Inputs: targetDrainPumpRPM - * @details Outputs: targetDrainPumpRPM + * @details Outputs: none * @return: the current target drain pump RPM. *************************************************************************/ U32 getTargetDrainPumpRPM( void ) { - U32 result = targetDrainPumpRPM.data; - - if ( OVERRIDE_KEY == targetDrainPumpRPM.override ) - { - result = targetDrainPumpRPM.ovData; - } - - return result; + return targetDrainPumpRPM; } /*********************************************************************//** * @brief * The getTargetDrainPumpDeltaP function gets the current target drain pump * delta pressure. * @details Inputs: targetDrainPumpDeltaPressure - * @details Outputs: targetDrainPumpDeltaPressure + * @details Outputs: none * @return: the current target drain pump delta pressure. *************************************************************************/ F32 getTargetDrainPumpDeltaP( void ) { - F32 result = targetDrainPumpDeltaPressure.data; - - if ( OVERRIDE_KEY == targetDrainPumpDeltaPressure.override ) - { - result = targetDrainPumpDeltaPressure.ovData; - } - - return result; + return targetDrainPumpDeltaPressure; } /*********************************************************************//** @@ -584,96 +581,50 @@ * @brief * The testSetTargetDrainPumpRPMOverride function overrides the target * drain pump RPM. - * @details Inputs: targetDrainPumpRPM - * @details Outputs: targetDrainPumpRPM + * @details Inputs: none + * @details Outputs: none * @param value override target drain pump RPM * @return: TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetDrainPumpRPMOverride( U32 value ) +BOOL testSetTargetDrainPumpRPM( U32 value ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) - { - targetDrainPumpRPM.ovInitData = targetDrainPumpRPM.data; // Backup current target RPM - targetDrainPumpRPM.ovData = value; - targetDrainPumpRPM.override = OVERRIDE_KEY; - result = setDrainPumpTargetRPM( value ); + { + // Check for the RPM to be in range + if ( value >= MIN_DRAIN_PUMP_RPM && value <= MAX_DRAIN_PUMP_RPM ) + { + result = setDrainPumpTargetRPM( value ); + } } return result; } - -/*********************************************************************//** - * @brief - * The testResetTargetDrainPumpRPMOverride function resets the override - * of the target drain pump RPM. - * @details Inputs: targetDrainPumpRPM - * @details Outputs: targetDrainPumpRPM - * @return: TRUE if override reset successful, FALSE if not - *************************************************************************/ -BOOL testResetTargetDrainPumpRPMOverride( void ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - targetDrainPumpRPM.data = targetDrainPumpRPM.ovInitData; // Restore pre-override target RPM - targetDrainPumpRPM.override = OVERRIDE_RESET; - targetDrainPumpRPM.ovInitData = 0; - targetDrainPumpRPM.ovData = 0; - result = setDrainPumpTargetRPM( targetDrainPumpRPM.data ); - } - - return result; -} /*********************************************************************//** * @brief * The testSetTargetDrainPumpDeltaPressureOverride function overrides * the target drain pump delta pressure. - * @details Inputs: targetDrainPumpDeltaPressure - * @details Outputs: targetDrainPumpDeltaPressure + * @details Inputs: none + * @details Outputs: none * @param value override target drain pump delta pressure * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetDrainPumpDeltaPressureOverride( F32 value ) +BOOL testSetTargetDrainPumpDeltaPressure( F32 value ) { BOOL result = FALSE; if ( TRUE == isTestingActivated() ) { - targetDrainPumpDeltaPressure.ovInitData = targetDrainPumpDeltaPressure.data; // Backup current target delta pressure - targetDrainPumpDeltaPressure.ovData = value; - targetDrainPumpDeltaPressure.override = OVERRIDE_KEY; - result = setDrainPumpTargetDeltaPressure( value ); //TODO remove + // Check if delta pressure is in range + if ( value >= MIN_ALLOWED_TARGET_DELTA_PRESSURE && value <= MAX_ALLOWED_TARGET_DELTA_PRESSURE ) + { + result = setDrainPumpTargetDeltaPressure( value ); + } } return result; } - -/*********************************************************************//** - * @brief - * The testResetTargetDrainPumpDeltaPressureOverride function resets the - * override of the target drain pump delta pressure. - * @details Inputs: targetDrainPumpDeltaPressure - * @details Outputs: targetDrainPumpDeltaPressure - * @return: TRUE if override reset successful, FALSE if not - *************************************************************************/ -BOOL testResetTargetDrainPumpDeltaPressureOverride( void ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - targetDrainPumpDeltaPressure.data = targetDrainPumpDeltaPressure.ovInitData; // Restore pre-override target delta pressure - targetDrainPumpDeltaPressure.override = OVERRIDE_RESET; - targetDrainPumpDeltaPressure.ovInitData = 0; - targetDrainPumpDeltaPressure.ovData = 0; - result = setDrainPumpTargetDeltaPressure( targetDrainPumpDeltaPressure.data ); - } - - return result; -} /**@}*/ Index: firmware/App/Controllers/DrainPump.h =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/DrainPump.h (.../DrainPump.h) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Controllers/DrainPump.h (.../DrainPump.h) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -22,7 +22,10 @@ /** * @defgroup DrainPump DrainPump - * @brief Drain Pump monitor/controller module. Controls and monitors the drain pump. + * @brief Drain Pump monitor/controller module. Controls and monitors the drain pump. + * Drain pump manufacturer: Diener, PN: 01006-PM-0 Rev A. + * The pump shall produce flow rates of 100-2000 ml/min at 1 bar differential pressure. + * The motor used shall be either Diener part number MA0250 or MA0297. * * @addtogroup DrainPump * @{ @@ -60,14 +63,12 @@ F32 getTargetDrainPumpDeltaP( void ); -BOOL testSetDrainPumpDataPublishIntervalOverride( U32 value ); -BOOL testResetDrainPumpDataPublishIntervalOverride( void ); +BOOL testSetDrainPumpDataPublishIntervalOverride( U32 value ); +BOOL testResetDrainPumpDataPublishIntervalOverride( void ); -BOOL testSetTargetDrainPumpRPMOverride( U32 value ); -BOOL testResetTargetDrainPumpRPMOverride( void ); +BOOL testSetTargetDrainPumpRPM( U32 value ); -BOOL testSetTargetDrainPumpDeltaPressureOverride( F32 value ); -BOOL testResetTargetDrainPumpDeltaPressureOverride( void ); +BOOL testSetTargetDrainPumpDeltaPressure( F32 value ); /**@}*/ Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -20,9 +20,9 @@ #define FANS_MAX_ALLOWED_RAMP_UP_DELTA_DUTY_CYCLE 0.3 ///< Fans max allowed ramp up PWM change. #define FANS_MAX_ALLOWED_RAMP_DOWN_DELTA_DUTY_CYCLE 0.005 ///< Fans min allowed ramp down PWM change. -#define ONE_MINUTE_TO_MICRO_SECONDS ( SEC_PER_MIN * US_PER_SECOND ) ///< One minute to micro seconds conversion. -#define TOGGLE_PERIOD_RESOLUTION 2.5 ///< FPGA fans toggle period resolution in micro seconds. -#define ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION_COEFF 4 ///< FPGA rotational to toggle period conversion coefficient. +//#define ONE_MINUTE_TO_MICRO_SECONDS ( SEC_PER_MIN * US_PER_SECOND ) ///< One minute to micro seconds conversion. +#define TOGGLE_PERIOD_RESOLUTION_SECONDS 0.0000025 ///< FPGA fans toggle period resolution in micro seconds. +#define ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION 4 ///< FPGA rotational to toggle period conversion coefficient. #define FANS_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Fans publish data time interval in counts. #define FANS_CONTROL_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Fans control time interval in counts. @@ -66,7 +66,7 @@ static const F32 slope = ( FANS_MAX_DUTY_CYCLE - FANS_MIN_DUTY_CYCLE ) / ( MAX_ALLOWED_AMBINET_TEMPERATURE - MIN_ALLOWED_AMBIENT_TEMPERATURE ); /// FGPA Toggle to RPM conversion coefficient -static const F32 toggle2RPMCoefficient = ( ONE_MINUTE_TO_MICRO_SECONDS * ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION_COEFF ) / TOGGLE_PERIOD_RESOLUTION; +static const F32 toggle2RPMCoefficient = SEC_PER_MIN / ( TOGGLE_PERIOD_RESOLUTION_SECONDS * ROTATIONAL_TO_TOGGLE_PERIOD_CONVERSION ); static OVERRIDE_U32_T fansPublishInterval = { FANS_DATA_PUBLISH_INTERVAL, FANS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Fans publish time interval override @@ -76,8 +76,8 @@ static FANS_EXEC_STATES_T handleExecStateWaitForPOST( void ); static FANS_EXEC_STATES_T handleExecStateRun( void ); -static void setInletFansPWM( F32 pwm ); -static void setOutletFansPWM( F32 pwm ); +static void setInletFansDutyCycle( F32 pwm ); +static void setOutletFansDutyCycle( F32 pwm ); static F32 getMaximumTemperature( void ); static void convertFansTogglePeriod2RPM( void ); static U32 getPublishFansDataInterval( void ); @@ -160,6 +160,8 @@ break; } + convertFansTogglePeriod2RPM(); + publishFansData(); } @@ -206,6 +208,7 @@ convertFansTogglePeriod2RPM(); // Loop through all the fans to check their RPM + // Upon starting the device the RPM of the fans should be 0 for( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) { if ( fansStatus.rpm[ fan ] > 0 ) @@ -215,8 +218,8 @@ } // Set the fans to the target PWM for the next stage - setInletFansPWM( FANS_SELF_TEST_TARGET_PWM ); - setOutletFansPWM( FANS_SELF_TEST_TARGET_PWM ); + setInletFansDutyCycle( FANS_SELF_TEST_TARGET_PWM ); + setOutletFansDutyCycle( FANS_SELF_TEST_TARGET_PWM ); state = FANS_SELF_TEST_CHECK_RPM; return state; @@ -250,8 +253,8 @@ } // Turn off the fans, done with self test - setInletFansPWM( 0 ); - setOutletFansPWM( 0 ); + setInletFansDutyCycle( 0 ); + setOutletFansDutyCycle( 0 ); state = FAN_SELF_TEST_COMPLETE; } @@ -274,11 +277,14 @@ if ( fansSelfTestState == FAN_SELF_TEST_COMPLETE ) { // Start the fans with minimum PWM. The control will decide the next PWM automatically. - setInletFansPWM( FANS_MIN_DUTY_CYCLE ); - setOutletFansPWM( FANS_MIN_DUTY_CYCLE ); + setInletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); + setOutletFansDutyCycle( FANS_MIN_DUTY_CYCLE ); state = FANS_EXEC_STATE_RUN; } + // TODO REMOVE + state = FANS_EXEC_STATE_RUN; + // TODO REMOVE return state; } @@ -300,6 +306,10 @@ // Get the maximum temperature among all the thermistors and sensors to run fan from the hottest F32 temperature = getMaximumTemperature(); + //TODO REMOVE FOR TESTING + temperature = getThermistorTemperatureValue( THERMISTOR_ONBOARD_NTC ); + //TODO REMOVE FOR TESTING only + // Solve the linear equation to calculate the duty cycle from temperature F32 dutyCycle = slope * ( temperature - MIN_ALLOWED_AMBIENT_TEMPERATURE ) + FANS_MIN_DUTY_CYCLE; @@ -336,8 +346,8 @@ } // Set the PWM to inlet and outlet fans - setInletFansPWM( fansStatus.targetDutyCycle ); - setOutletFansPWM( fansStatus.targetDutyCycle ); + setInletFansDutyCycle( fansStatus.targetDutyCycle ); + setOutletFansDutyCycle( fansStatus.targetDutyCycle ); // Reset the counter fansControlCounter = 0; @@ -354,7 +364,7 @@ * @param PWM that will be set * @return none *************************************************************************/ -static void setInletFansPWM( F32 pwm ) +static void setInletFansDutyCycle( F32 pwm ) { etpwmSetCmpA( etpwmREG6, (U32)( (S32)( ( pwm * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); } @@ -367,7 +377,7 @@ * @param PWM that will be set * @return none ************************************************************************/ -static void setOutletFansPWM( F32 pwm ) +static void setOutletFansDutyCycle( F32 pwm ) { etpwmSetCmpB( etpwmREG6, (U32)( (S32)( ( pwm * (F32)(etpwmREG6->TBPRD) ) + FLOAT_TO_INT_ROUNDUP_OFFSET ) ) ); } @@ -459,7 +469,8 @@ } else { - fansStatus.rpm[ fan ] = togglePeriod * toggle2RPMCoefficient; + // Convert toggle period to RPM + fansStatus.rpm[ fan ] = toggle2RPMCoefficient / togglePeriod; } } } Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -47,7 +47,7 @@ #define RO_PUMP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the RO Pump data is published on the CAN bus. #define MAX_RO_PUMP_DUTY_CYCLE 0.99 ///< max duty cycle. -#define MIN_RO_PUMP_DUTY_CYCLE 0.1 ///< min duty cycle. +#define MIN_RO_PUMP_DUTY_CYCLE 0.0 ///< min duty cycle. #define ROP_CONTROL_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the RO pump is controlled. #define ROP_P_COEFFICIENT 0.0020 ///< P term for RO pump pressure control. @@ -121,7 +121,9 @@ 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 OVERRIDE_F32_T targetROPumpFlowRate = { 0, 0, 0, 0 }; ///< Target RO flow rate (in L/min) +static F32 targetROPumpFlowRate = 0.0; ///< Target RO flow rate (in L/min) +static U32 targetROPumpPressure = 0; ///< Target RO 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 @@ -140,8 +142,6 @@ static U32 roPumpSelfTestTimerCount = 0; ///< Timer counter for ro pump self test */ -static OVERRIDE_U32_T targetROPumpPressure = { 0, 0, 0, 0 }; ///< Target RO pressure (in PSI) - static S32 measuredFlowReadingsSum = 0; ///< Raw flow reading sums for averaging static U32 flowFilterCounter = 0; ///< Flow filtering counter static U32 rampUp2FlowTimeoutCounter = 0; ///< Counter for ramping up to flow time @@ -225,20 +225,20 @@ * can reach * @return TRUE if new target flow rate is set successfully, FALSE if not *************************************************************************/ -BOOL setROPumpTargetFlowRate( F32 roFlowRate, F32 maxPressure ) +BOOL setROPumpTargetFlowRate( F32 roFlowRate, U32 maxPressure ) { BOOL result = FALSE; // First of all, the flow rate must be in range - if ( roFlowRate < MAX_RO_FLOWRATE_LPM && roFlowRate >= MIN_RO_FLOWRATE_LPM ) + if ( ( roFlowRate < MAX_RO_FLOWRATE_LPM ) && ( roFlowRate >= MIN_RO_FLOWRATE_LPM ) ) { // Then the max pressure that we are allowed to reach must be in range - if ( maxPressure >= MIN_ALLOWED_PRESSURE_PSI && maxPressure <= MIN_ALLOWED_PRESSURE_PSI ) + if ( ( maxPressure >= MIN_ALLOWED_PRESSURE_PSI ) && ( maxPressure <= MAX_ALLOWED_PRESSURE_PSI ) ) { // For now maximum allowed pressure is inserted into the target pressure override // if the target flow rate exceeded the max pressure, it will set the maximum pressure - targetROPumpPressure.data = maxPressure; - targetROPumpFlowRate.data = roFlowRate; + targetROPumpPressure = maxPressure; + targetROPumpFlowRate = roFlowRate; roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; // Get the initial guess of the duty cycle roPumpPWMDutyCyclePct = ROP_FLOW_TO_PWM_DC( roFlowRate ); @@ -260,7 +260,7 @@ // Requested flow rate is out of range else { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_RO_PUMP_INVAID_PRESSURE_SELECTED, roFlowRate ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_RO_PUMP_INVALID_PRESSURE_SELECTED, roFlowRate ) } return result; @@ -281,7 +281,7 @@ void signalROPumpHardStop( void ) { stopROPump(); - targetROPumpFlowRate.data = 0; + targetROPumpFlowRate = 0; roPumpState = RO_PUMP_OFF_STATE; roPumpPWMDutyCyclePct = 0.0; roPumpOpenLoopTargetDutyCycle = 0.0; @@ -342,7 +342,7 @@ { F32 currentFlow = getMeasuredROFlowRate(); F32 targetFlow = getTargetROPumpFlowRate(); - F32 error = 1 - ( currentFlow / targetFlow ); + F32 error = 1.0 - ( currentFlow / targetFlow ); BOOL isFlowOutOfRange = error > MAX_ALLOWED_FLOW_DEVIATION; // Figure out whether flow is out of range from which side @@ -515,7 +515,7 @@ // and control from this if ( ++rampUp2FlowTimeoutCounter > RAMP_UP_TIME_OUT_COUNT ) { - targetROPumpPressure.data = actualPressure; + targetROPumpPressure = actualPressure; rampUp2FlowTimeoutCounter = 0; result = RO_PUMP_CONTROL_TO_TARGET_STATE; } @@ -590,7 +590,7 @@ // pressure is used as the target pressure avgPressure = avgPressure + ( avgPressure * flowRateDeviation ); // Save the target pressure - targetROPumpPressure.data = avgPressure; + targetROPumpPressure = avgPressure; } // Reset the I controller for the flow rate as it is no longer needed @@ -725,14 +725,7 @@ *************************************************************************/ F32 getTargetROPumpFlowRate( void ) { - F32 result = targetROPumpFlowRate.data; - - if ( OVERRIDE_KEY == targetROPumpFlowRate.override ) - { - result = targetROPumpFlowRate.ovData; - } - - return result; + return targetROPumpFlowRate; } /*********************************************************************//** @@ -764,14 +757,7 @@ *************************************************************************/ F32 getTargetROPumpPressure( void ) { - F32 result = targetROPumpPressure.data; - - if ( OVERRIDE_KEY == targetROPumpPressure.override ) - { - result = targetROPumpPressure.ovData; - } - - return result; + return targetROPumpPressure; } /*********************************************************************//** @@ -853,12 +839,12 @@ * @brief * The testSetTargetROPumpFlowRateOverride function overrides the target * flow rate. - * @details Inputs: targetROPumpFlowRate - * @details Outputs: targetROPumpFlowRate - * @param: value which is override target RO flow rate (in L/min) + * @details Inputs: none + * @details Outputs: none + * @param value which is override target RO flow rate (in L/min) * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetROPumpFlowAndPressure( F32 flow, F32 pressure ) +BOOL testSetTargetROPumpFlowAndPressure( F32 flow, U32 pressure ) { BOOL result = FALSE; @@ -867,50 +853,14 @@ // The flow rate and pressure must be in range if ( flow < MAX_RO_FLOWRATE_LPM && flow >= MIN_RO_FLOWRATE_LPM ) { - if ( pressure >= MIN_ALLOWED_PRESSURE_PSI && pressure <= MIN_ALLOWED_PRESSURE_PSI ) + if ( pressure >= MIN_ALLOWED_PRESSURE_PSI && pressure <= MAX_ALLOWED_PRESSURE_PSI ) { - // Set the override initial data and the override key in here for both flow and pressure. - // Both are needed in order to change the flow rate. - targetROPumpFlowRate.ovInitData = targetROPumpFlowRate.data; - targetROPumpFlowRate.override = OVERRIDE_KEY; - - targetROPumpPressure.ovInitData = targetROPumpPressure.data; - targetROPumpPressure.override = OVERRIDE_KEY; - result = setROPumpTargetFlowRate( flow, pressure ); - - // Reset is needed to turn off the override key } } } return result; -} - -/*********************************************************************//** - * @brief - * The testResetTargetROPumpFlowRateOverride function resets the override - * of the target RO flow rate. - * @details Inputs: targetROPumpFlowRate - * @details Outputs: targetROPumpFlowRate - * @return TRUE if override reset successful, FALSE if not - *************************************************************************/ -BOOL testResetTargetROPumpFlowRateOverride( void ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - // Reset the override - targetROPumpFlowRate.data = targetROPumpFlowRate.ovInitData; - targetROPumpFlowRate.override = OVERRIDE_RESET; - targetROPumpFlowRate.ovInitData = 0; - targetROPumpFlowRate.ovData = 0; - // Set the flow rate back to its original as well as the pressure - result = setROPumpTargetFlowRate( targetROPumpFlowRate.data, getTargetROPumpPressure() ); - } - - return result; } /*********************************************************************//** @@ -922,7 +872,7 @@ * @param value override target RO pressure (in psi) * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetROPumpPressureOverride( U32 value ) +BOOL testSetTargetROPumpPressure( U32 value ) { BOOL result = FALSE; @@ -931,39 +881,13 @@ // Make sure the requested pressure is in range if ( value >= MIN_ALLOWED_PRESSURE_PSI && value <= MAX_ALLOWED_PRESSURE_PSI ) { - targetROPumpPressure.ovInitData = targetROPumpPressure.data; - targetROPumpPressure.ovData = value; - targetROPumpPressure.override = OVERRIDE_KEY; + targetROPumpPressure = value; result = TRUE; } } return result; } - -/*********************************************************************//** - * @brief - * The testResetTargetROPumpPressureOverride function resets the override - * of the target RO pressure. - * @details Inputs: targetROPumpPressure - * @details Outputs: targetROPumpPressure - * @return TRUE if override reset successful, FALSE if not - *************************************************************************/ -BOOL testResetTargetROPumpPressureOverride( void ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - targetROPumpPressure.data = targetROPumpPressure.ovInitData; - targetROPumpPressure.override = OVERRIDE_RESET; - targetROPumpPressure.ovInitData = 0; - targetROPumpPressure.ovData = 0; - result = TRUE; - } - - return result; -} /*********************************************************************//** * @brief @@ -1022,7 +946,7 @@ * @param value which is the duty cycle to be set * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetDutyCycleOverride( F32 value ) +BOOL testSetTargetDutyCycle( F32 value ) { BOOL result = FALSE; @@ -1039,27 +963,4 @@ return result; } -/*********************************************************************//** - * @brief - * The testResetTargetDutyCyceOverride function resets and turns off the - * RO pump that was running at a certain duty cycle. - * @details Inputs: none - * @details Outputs: none - * @return TRUE if override successful, FALSE if not - *************************************************************************/ -BOOL testResetTargetDutyCyceOverride( void ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - // Reset of the duty cycle override means stop the pump and - // reset all its variables - signalROPumpHardStop(); - result = TRUE; - } - - return result; -} - /**@}*/ Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -49,7 +49,7 @@ void execROPumpMonitor( void ); void execROPumpController( void ); -BOOL setROPumpTargetFlowRate( F32 roFlowRate, F32 maxPressure ); +BOOL setROPumpTargetFlowRate( F32 roFlowRate, U32 maxPressure ); void signalROPumpHardStop( void ); @@ -68,16 +68,11 @@ BOOL testSetMeasuredROFlowRateOverride( F32 value ); BOOL testResetMeasuredROFlowRateOverride( void ); -// These are not sensors, but since the functions are private, -// they can only be set from Dialin -BOOL testSetTargetROPumpFlowAndPressure( F32 flow, F32 pressure ); -BOOL testResetTargetROPumpFlowRateOverride( void ); //TODO remove? +BOOL testSetTargetROPumpFlowAndPressure( F32 flow, U32 pressure ); -BOOL testSetTargetROPumpPressureOverride( U32 value ); -BOOL testResetTargetROPumpPressureOverride( void ); +BOOL testSetTargetROPumpPressure( U32 value ); -BOOL testSetTargetDutyCycleOverride( F32 value ); -BOOL testResetTargetDutyCyceOverride( void ); +BOOL testSetTargetDutyCycle( F32 value ); /**@}*/ Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r04db56ac0f515f35b7f236d607bfb6f7585f55fb -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 04db56ac0f515f35b7f236d607bfb6f7585f55fb) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -124,7 +124,6 @@ static U32 internalHeatersConversionTimer; ///< Conversion timer variable to calculate the heaters internal temperature. // From master - static F32 tempValuesForPublication [ NUM_OF_TEMPERATURE_SENSORS ]; ///< Temperature sensors data publication array. static U32 dataPublicationTimerCounter; ///< Temperature sensors data publish timer counter. static OVERRIDE_U32_T tempSensorsPublishInterval = { TEMP_SENSORS_DATA_PUBLISH_INTERVAL, @@ -716,7 +715,6 @@ { // Look at the error counter and the specific error flag to make sure the error is a temp sensor // Add a byte array to have bits for each sensor to find out exactly what sensor failed - processTempSnsrsADCRead( TEMPSENSORS_INLET_PRIMARY_HEATER, getFPGATPiTemp(), getFPGARTDErrorCount(), getFPGARTDReadCount() ); processTempSnsrsADCRead( TEMPSENSORS_OUTLET_PRIMARY_HEATER, getFPGATPoTemp(), getFPGARTDErrorCount(), getFPGARTDReadCount() ); processTempSnsrsADCRead( TEMPSENSORS_CONDUCTIVITY_SENSOR_1, getFPGACD1Temp(), getFPGARTDErrorCount(), getFPGARTDReadCount() ); Index: firmware/App/Controllers/Thermistors.c =================================================================== diff -u -r62a4d7b976107f7ac4d5013ce06f38f4a0bf65bd -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision 62a4d7b976107f7ac4d5013ce06f38f4a0bf65bd) +++ firmware/App/Controllers/Thermistors.c (.../Thermistors.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -16,12 +16,12 @@ #define THERMISTORS_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Thermistors publish data time interval. #define THERMISTORS_ADC_READ_INTERVAL ( MS_PER_SECOND / ( 2 * TASK_GENERAL_INTERVAL ) ) ///< Thermistors ADC read time interval. -#define ADC_FPGA_READ_DELAY_COUNT 1 ///< FGPA read delay upon startup. -#define ONBOARD_THERMISTOR_SOURCE_VOLTAGE 3 ///< Onboard thermistor source voltage. -#define ONBOARD_THERMISTOR_REFERENCE_RESISTOR 10 ///< Onboard thermistor reference resistor. -#define ONBOARD_THERMISTOR_BETA_VALUE 3380 ///< Onboard thermistor beta value. -#define ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE 298 ///< Onboard thermistor reference temperature. -#define TWELVE_BIT_RESOLUTION 4096 ///< 12 bit resolution conversion. +#define ADC_FPGA_READ_DELAY_COUNT 1.0 ///< FGPA read delay upon startup. +#define ONBOARD_THERMISTOR_SOURCE_VOLTAGE 3.0 ///< Onboard thermistor source voltage. +#define ONBOARD_THERMISTOR_REFERENCE_RESISTOR 10000.0 ///< Onboard thermistor reference resistor. +#define ONBOARD_THERMISTOR_BETA_VALUE 3380.0 ///< Onboard thermistor beta value. +#define ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE 298.0 ///< Onboard thermistor reference temperature. +#define TWELVE_BIT_RESOLUTION 4096.0 ///< 12 bit resolution conversion. #define CELSIUS_TO_KELVIN_CONVERSION 273.15 ///< Celsius to Kelvin temperature conversion. #define ADC_TEMP_SENSORS_CONVERSION_CONST 272.5 ///< ADC temperature sensors conversion constant. #define MIN_ALLOWED_TEMPERATURE 0 ///< Thermistors/sensors minimum allowed temperature reading. @@ -62,10 +62,9 @@ static U32 adcReadCounter; ///< Thermistors ADC read counter static const F32 fpgaBoardTempSensorConvCoeff = 503.975 / TWELVE_BIT_RESOLUTION; ///< FPGA board temperature sensor conversion coefficient -static const F32 adcTempSensorsConversionCoeff1 = 1 / 13584; ///< ADC temperature sensors conversion coefficient 1 +static const F32 adcTempSensorsConversionCoeff1 = 1.0 / 13584.0; ///< ADC temperature sensors conversion coefficient 1 static const F32 adcTempSensorsConversionCoeff2 = 0x800000 / 13584; ///< ADC temperature sensors conversion coefficient 2 -static const F32 onBoardThermistorVoltageConvCoeff = ONBOARD_THERMISTOR_SOURCE_VOLTAGE / - TWELVE_BIT_RESOLUTION; ///< On board thermistor ADC to voltage conversion coefficient +static const F32 onBoardThermistorVoltageConvCoeff = ONBOARD_THERMISTOR_SOURCE_VOLTAGE / TWELVE_BIT_RESOLUTION; ///< On board thermistor ADC to voltage conversion coefficient static const F32 onBoardThermistorBetaValueInv = 1 / ONBOARD_THERMISTOR_BETA_VALUE; ///< On board thermistor beta value inverse static const F32 onBoardThermistorRefTempInv = 1 / ONBOARD_THERMISTOR_REFERENCE_TEMPERATURE; ///< On board thermistor reference inverse @@ -421,21 +420,24 @@ /* * voltage = ADC x 3 / 2^12 * voltage = 3 x 10 / ( 10 + R(T) ) - * R(T) = 10 x e^(3380 x (1/T - 1/298)) + * R(T) = 10000 x e^(3380 x (1/T - 1/298)) * Solve for T which is temperature in Kelvin */ // Voltage = ADC x 3 / 2^12 for 12 bits resolution and a 3V ADC // The value of 3 / 2^12 has been calculated in a const to prevent the division again F32 const thermistorVoltage = adcValue * onBoardThermistorVoltageConvCoeff; + // Calculate the thermistor resistor by solving: thermistorVoltage = (3 x 10) / (10 + R(T)) F32 const thermistorResistor = ( ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * ONBOARD_THERMISTOR_SOURCE_VOLTAGE ) - ( ONBOARD_THERMISTOR_REFERENCE_RESISTOR * thermistorVoltage ) ) / thermistorVoltage; - // 1/T = Ln(thermistorResistor/10)/3380 + 1/298 - F32 const InvTemperature = ( logf( thermistorResistor / ONBOARD_THERMISTOR_REFERENCE_RESISTOR ) * onBoardThermistorBetaValueInv ) + - onBoardThermistorRefTempInv; + + // 1/T = Ln(thermistorResistor/10000)/3380 + 1/298 + F32 const invTemperature = ( logf( thermistorResistor / ONBOARD_THERMISTOR_REFERENCE_RESISTOR ) / ONBOARD_THERMISTOR_BETA_VALUE ) + + onBoardThermistorRefTempInv; + // Inverse the value to get the temperature in Kelvin and then convert it to Celsius - F32 const temperature = ( 1 / InvTemperature ) - CELSIUS_TO_KELVIN_CONVERSION; + F32 const temperature = ( 1 / invTemperature ) - CELSIUS_TO_KELVIN_CONVERSION; return temperature; } Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -re30951f62cdc9c52f20e9218df947d3860b3c7a7 -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision e30951f62cdc9c52f20e9218df947d3860b3c7a7) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -24,6 +24,7 @@ #include "Pressures.h" #include "RTC.h" #include "TemperatureSensors.h" +#include "UVReactors.h" #include "WatchdogMgmt.h" /** @@ -131,6 +132,11 @@ postState = handlePOSTStatus( testStatus ); break; + case DG_POST_STATE_UV_REACTORS: + testStatus = execUVReactorsSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); handlePOSTStatus( testStatus ); // ignoring return value because last test Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -156,7 +156,7 @@ SW_FAULT_ID_RO_PUMP_INVALID_FLOW_RATE_SET, SW_FAULT_ID_DRAIN_PUMP_INVALID_EXEC_STATE, // 65 SW_FAULT_ID_UV_REACTORS_INVALID_REACTOR_SELECTD, - SW_FAULT_ID_RO_PUMP_INVAID_PRESSURE_SELECTED, + SW_FAULT_ID_RO_PUMP_INVALID_PRESSURE_SELECTED, SW_FAULT_ID_DRAIN_PUMP_INVALID_DELTA_PRESSURE_SELECTED, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -1109,10 +1109,6 @@ handleTestPressureDataBroadcastIntervalOverrideRequest( message ); break; - case MSG_ID_RO_PUMP_SET_PT_OVERRIDE: - handleTestROPumpSetPointOverrideRequest( message ); - break; - case MSG_ID_RO_MEASURED_FLOW_OVERRIDE: handleTestROMeasuredFlowOverrideRequest( message ); break; @@ -1122,7 +1118,7 @@ break; case MSG_ID_DRAIN_PUMP_SET_RPM_OVERRIDE: - handleTestDrainPumpSetPointOverrideRequest( message ); + handleTestDrainPumpRPMOverrideRequest( message ); break; case MSG_ID_DRAIN_PUMP_SEND_INTERVAL_OVERRIDE: @@ -1177,6 +1173,10 @@ handleSetAccelCalibration( message ); break; + case MSG_ID_DRAIN_PUMP_SET_DELTA_PRESSURE_OVERRIDE: + handleSetDrainPumpDeltaPressureOverrideRequest( message ); + break; + case MSG_ID_DG_START_STOP_INLET_UV_REACTOR: handleStartStopInletUVReactor( message ); break; @@ -1216,8 +1216,6 @@ case MSG_ID_DG_RO_PUMP_TARGET_PRESSURE_OVERRIDE: break; - - default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -1561,39 +1561,6 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/*********************************************************************//** - * @brief - * The handleTestROPumpSetPointOverrideRequest function handles a request to - * override the RO pump pressure set point (in PSI). - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestROPumpSetPointOverrideRequest( MESSAGE_T *message ) -{ - TEST_OVERRIDE_PAYLOAD_T payload; - BOOL result = FALSE; - - // verify payload length - if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) - { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetROPumpPressureOverride( payload.state.u32 ); - } - else - { - result = testResetTargetROPumpPressureOverride(); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - /*********************************************************************//** * @brief * The handleTestROMeasuredFlowOverrideRequest function handles a request to @@ -1669,7 +1636,7 @@ * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleTestDrainPumpSetPointOverrideRequest( MESSAGE_T *message ) +void handleTestDrainPumpRPMOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; @@ -1678,14 +1645,8 @@ if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetDrainPumpRPMOverride( payload.state.u32 ); - } - else - { - result = testResetTargetDrainPumpRPMOverride(); - } + + result = testSetTargetDrainPumpRPM( payload.state.u32 ); } // respond to request @@ -1793,17 +1754,28 @@ /************************************************************************* * @brief - * The handleSetDrainPumpDeltaPressure function handles a \n - * request to override the delta pressure for the drain pump - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle + * The handleSetDrainPumpDeltaPressureOverrideRequest function handles a + * request to override the delta pressure for the drain pump. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle * @return none *************************************************************************/ -DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleSetDrainPumpDeltaPressureOverrideRequest, \ - testSetTargetDrainPumpDeltaPressureOverride, testResetTargetDrainPumpDeltaPressureOverride ) +void handleSetDrainPumpDeltaPressureOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = 0; + /* verify payload length */ + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + result = testSetTargetDrainPumpDeltaPressure( (U32)(payload.state.u32) ); + } + /* respond to request */ + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /************************************************************************* * @brief * The handleSetHeatDisinfectRecircStateDurationOverrideRequest function handles a \n @@ -2344,14 +2316,8 @@ if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetDutyCycleOverride( payload.state.f32 ); - } - else - { - result = testResetTargetDutyCyceOverride(); - } + + result = testSetTargetDutyCycle( payload.state.f32 ); } // respond to request @@ -2434,14 +2400,8 @@ if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetTargetROPumpPressureOverride( payload.state.f32 ); - } - else - { - result = testResetTargetROPumpPressureOverride(); - } + + result = testSetTargetROPumpPressure( payload.state.f32 ); } // respond to request Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r58129c9bb3053c39efa07f60e975f17e2a04755a -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 58129c9bb3053c39efa07f60e975f17e2a04755a) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -176,17 +176,14 @@ // MSG_ID_PRESSURE_SEND_INTERVAL_OVERRIDE: void handleTestPressureDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ); -// MSG_ID_RO_PUMP_SET_PT_OVERRIDE: -void handleTestROPumpSetPointOverrideRequest( MESSAGE_T *message ); - // MSG_ID_RO_MEASURED_FLOW_OVERRIDE: void handleTestROMeasuredFlowOverrideRequest( MESSAGE_T *message ); // MSG_ID_RO_PUMP_SEND_INTERVAL_OVERRIDE: void handleTestROPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ); // MSG_ID_DRAIN_PUMP_SET_PT_OVERRIDE: -void handleTestDrainPumpSetPointOverrideRequest( MESSAGE_T *message ); +void handleTestDrainPumpRPMOverrideRequest( MESSAGE_T *message ); // MSG_ID_DRAIN_PUMP_SEND_INTERVAL_OVERRIDE: void handleTestDrainPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ); Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r45263215b372cd579e8e16bb8073c287c726c55d -rf9b3862d01ce6c64bd05b8649e69b44fa155b8e0 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 45263215b372cd579e8e16bb8073c287c726c55d) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision f9b3862d01ce6c64bd05b8649e69b44fa155b8e0) @@ -88,7 +88,10 @@ execDrainPumpController(); // Manage fans controller - execFans(); + execFans(); + + // Manage UV reactors controller + execUVReactos(); #ifndef DISABLE_HEATERS_AND_TEMPS // Primary heaters state machine