Index: firmware/App/Controllers/BoostPump.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -78,7 +78,7 @@ static OVERRIDE_U32_T targetBoostPumpFlowRate; ///< Target Boost flow rate (in L/min). static OVERRIDE_F32_T targetBoostPumpPressure; ///< Target Boost max allowed pressure (in PSI). static F32 boostPumpDutyCyclePctSet; ///< Currently set Boost pump PWM duty cycle. -static F32 boostPumpOpenLoopTargetDutyCycle; ///< Target Boost pump open loop PWM. +static OVERRIDE_F32_T boostPumpOpenLoopTargetDutyCycle; ///< Target Boost pump open loop PWM. // ********** private function prototypes ********** @@ -97,7 +97,7 @@ * The initBoostPump function initializes the Boost Pump module. * @details \b Inputs: boostPumpState, boostPumpControlMode, isBoostPumpOn, stopPumpRequest, * boostControlTimerCounter, boostPumpDutyCyclePctSet, boostPumpOpenLoopTargetDutyCycle, boostPumpDataPublicationTimerCounter, - * boostPumpDataPublishInterval, targetBoostPumpFlowRCLOSEDate, targetBoostPumpPressure + * boostPumpDataPublishInterval, targetBoostPumpFlowRate, targetBoostPumpPressure * @details \b Outputs: Boost Pump controller unit initialized * @return none *************************************************************************/ @@ -113,26 +113,29 @@ initializePIController( PI_CONTROLLER_ID_BOOST_PUMP_PRES, MIN_FLUID_PUMP_DUTY_CYCLE_PCT, BOOST_PRESSURE_CONTROL_P_COEFFICIENT, BOOST_PRESSURE_CONTROL_I_COEFFICIENT, MIN_FLUID_PUMP_DUTY_CYCLE_PCT, MAX_FLUID_PUMP_DUTY_CYCLE_PCT, FALSE, 0 ); - boostPumpState = BOOST_PUMP_OFF_STATE; - boostPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; - isBoostPumpOn = FALSE; - stopPumpRequest = FALSE; - boostControlTimerCounter = 0; - boostPumpDutyCyclePctSet = 0.0F; - boostPumpOpenLoopTargetDutyCycle = 0.0F; - boostPumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - boostPumpDataPublishInterval.data = BOOST_DATA_PUB_INTERVAL; - boostPumpDataPublishInterval.ovData = BOOST_CONTROL_INTERVAL; - boostPumpDataPublishInterval.ovInitData = 0; - boostPumpDataPublishInterval.override = OVERRIDE_RESET; - targetBoostPumpFlowRate.data = 0; - targetBoostPumpFlowRate.ovData = 0; - targetBoostPumpFlowRate.ovInitData = 0; - targetBoostPumpFlowRate.override = OVERRIDE_RESET; - targetBoostPumpPressure.data = 0.0F; - targetBoostPumpPressure.ovData = 0.0F; - targetBoostPumpPressure.ovInitData = 0.0F; - targetBoostPumpPressure.override = OVERRIDE_RESET; + boostPumpState = BOOST_PUMP_OFF_STATE; + boostPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; + isBoostPumpOn = FALSE; + stopPumpRequest = FALSE; + boostControlTimerCounter = 0; + boostPumpDutyCyclePctSet = 0.0F; + boostPumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; + boostPumpDataPublishInterval.data = BOOST_DATA_PUB_INTERVAL; + boostPumpDataPublishInterval.ovData = BOOST_CONTROL_INTERVAL; + boostPumpDataPublishInterval.ovInitData = 0; + boostPumpDataPublishInterval.override = OVERRIDE_RESET; + targetBoostPumpFlowRate.data = 0; + targetBoostPumpFlowRate.ovData = 0; + targetBoostPumpFlowRate.ovInitData = 0; + targetBoostPumpFlowRate.override = OVERRIDE_RESET; + targetBoostPumpPressure.data = 0.0F; + targetBoostPumpPressure.ovData = 0.0F; + targetBoostPumpPressure.ovInitData = 0.0F; + targetBoostPumpPressure.override = OVERRIDE_RESET; + boostPumpOpenLoopTargetDutyCycle.data = 0.0F; + boostPumpOpenLoopTargetDutyCycle.ovData = 0.0F; + boostPumpOpenLoopTargetDutyCycle.ovInitData = 0.0F; + boostPumpOpenLoopTargetDutyCycle.override = OVERRIDE_RESET; stopBoostPump(); } @@ -215,10 +218,10 @@ } // If the target duty cycle is greater than zero (minimum is 10%) and the mode has been set to open // loop, set the duty cycle - else if ( ( boostPumpOpenLoopTargetDutyCycle > 0.0F ) && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) + else if ( ( getTargetBoostPumpDutyCyclePCT() > 0.0F ) && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpOpenLoopTargetDutyCycle ); - boostPumpDutyCyclePctSet = boostPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P40_PUMP, getTargetBoostPumpDutyCyclePCT() ); + boostPumpDutyCyclePctSet = getTargetBoostPumpDutyCyclePCT(); isBoostPumpOn = TRUE; state = BOOST_PUMP_OPEN_LOOP_STATE; } @@ -282,13 +285,18 @@ resetPIController( PI_CONTROLLER_ID_BOOST_PUMP_PRES, boostPumpDutyCyclePctSet, 0 ); state = BOOST_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE; } - else if ( boostPumpOpenLoopTargetDutyCycle > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) + else if ( getTargetBoostPumpDutyCyclePCT() > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpOpenLoopTargetDutyCycle ); - boostPumpDutyCyclePctSet = boostPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P40_PUMP, getTargetBoostPumpDutyCyclePCT() ); + boostPumpDutyCyclePctSet = getTargetBoostPumpDutyCyclePCT(); state = BOOST_PUMP_OPEN_LOOP_STATE; } - // Control at set interval + + // Control at set interval or shut off + if ( getTargetBoostPumpFlowRateMLPM() == 0.0F && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) + { + signalBoostPumpHardStop(); + } else if ( ( ++boostControlTimerCounter >= BOOST_CONTROL_INTERVAL ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) { boostPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_BOOST_PUMP_FLOW, getTargetBoostPumpFlowRateMLPM(), getFilteredFlow( P7_FLOW ) ); @@ -311,19 +319,25 @@ { BOOST_PUMP_STATE_T state = BOOST_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE; + // Check if need to switch control modes if ( ( getTargetBoostPumpFlowRateMLPM() > 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) { ///transition to target flow resetPIController( PI_CONTROLLER_ID_BOOST_PUMP_FLOW, boostPumpDutyCyclePctSet, 0.0F ); state = BOOST_PUMP_CONTROL_TO_TARGET_FLOW_STATE; } - else if ( boostPumpOpenLoopTargetDutyCycle > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) + else if ( getTargetBoostPumpDutyCyclePCT() > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == boostPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpOpenLoopTargetDutyCycle ); - boostPumpDutyCyclePctSet = boostPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P40_PUMP, getTargetBoostPumpDutyCyclePCT() ); + boostPumpDutyCyclePctSet = getTargetBoostPumpDutyCyclePCT(); state = BOOST_PUMP_OPEN_LOOP_STATE; } - // Control at set interval + + // Control at set interval or shut off + if ( getTargetBoostPumpPressure() == 0.0F && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) + { + signalBoostPumpHardStop(); + } else if ( ( ++boostControlTimerCounter >= BOOST_CONTROL_INTERVAL ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) { boostPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_BOOST_PUMP_PRES, getTargetBoostPumpPressure(), getFilteredPressure( M3_PRES ) ); @@ -363,9 +377,9 @@ { targetBoostPumpPressure.data = 0.0F; } - if ( boostPumpOpenLoopTargetDutyCycle > 0.0F ) + if ( getTargetBoostPumpDutyCyclePCT() > 0.0F ) { - boostPumpOpenLoopTargetDutyCycle = 0.0F; + boostPumpOpenLoopTargetDutyCycle.data = 0.0F; } result = TRUE; } @@ -406,9 +420,9 @@ { targetBoostPumpFlowRate.data = 0.0F; } - if ( boostPumpOpenLoopTargetDutyCycle > 0.0F ) + if ( getTargetBoostPumpDutyCyclePCT() > 0.0F ) { - boostPumpOpenLoopTargetDutyCycle = 0.0F; + boostPumpOpenLoopTargetDutyCycle.data = 0.0F; } result = TRUE; } @@ -438,12 +452,12 @@ if ( ( dutyCycle >= MIN_FLUID_PUMP_DUTY_CYCLE_PCT ) && ( dutyCycle <= MAX_FLUID_PUMP_DUTY_CYCLE_PCT ) ) { - boostPumpOpenLoopTargetDutyCycle = dutyCycle; - boostPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; - status = TRUE; + boostPumpOpenLoopTargetDutyCycle.data = dutyCycle; + boostPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; + status = TRUE; // Set the new duty cycle of the pump - setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpOpenLoopTargetDutyCycle ); + setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpOpenLoopTargetDutyCycle.data ); // Clear previous target data if ( getTargetBoostPumpFlowRateMLPM() > 0 ) { @@ -473,7 +487,9 @@ *************************************************************************/ F32 getTargetBoostPumpDutyCyclePCT( void ) { - return boostPumpOpenLoopTargetDutyCycle; + F32 dutyCycle = getF32OverrideValue( &boostPumpOpenLoopTargetDutyCycle ); + + return dutyCycle; } /*********************************************************************//** @@ -486,7 +502,7 @@ *************************************************************************/ F32 getCurrentBoostPumpDutyCyclePCT( void ) { - U16 dutyCyclePct = convertDutyCycleCntToPct( getFluidPumpReadPWMDutyCycle( P40_PUMP ) ); + F32 dutyCyclePct = convertDutyCycleCntToPct( getFluidPumpReadPWMDutyCycle( P40_PUMP ) ); return dutyCyclePct; } @@ -579,7 +595,7 @@ boostPumpState = BOOST_PUMP_OFF_STATE; boostPumpDutyCyclePctSet = 0.0F; boostControlTimerCounter = 0; - boostPumpOpenLoopTargetDutyCycle = 0.0F; + boostPumpOpenLoopTargetDutyCycle.data = 0.0F; stopBoostPump(); } @@ -632,7 +648,7 @@ pumpData.p40PumpSpeed = getFluidPumpRPM( P40_PUMP ); pumpData.p40TargetPressure = getTargetBoostPumpPressure(); pumpData.p40TargetFlow = getTargetBoostPumpFlowRateMLPM(); - pumpData.p40TargetDutyCycle = boostPumpOpenLoopTargetDutyCycle; + pumpData.p40TargetDutyCycle = getTargetBoostPumpDutyCyclePCT(); broadcastData( MSG_ID_FP_BOOST_PUMP_DATA, COMM_BUFFER_OUT_CAN_FP_BROADCAST, (U08*)&pumpData, sizeof( BOOST_PUMP_DATA_T ) ); boostPumpDataPublicationTimerCounter = 0; @@ -676,6 +692,8 @@ { BOOL result = f32Override( message, &targetBoostPumpPressure ); + setBoostPumpTargetPressure(getTargetBoostPumpPressure()); + return result; } @@ -693,7 +711,28 @@ { BOOL result = u32Override( message, &targetBoostPumpFlowRate, MIN_BOOST_FLOWRATE_MLPM, MAX_BOOST_FLOWRATE_MLPM ); + setBoostPumpTargetFlowRateMLPM(getTargetBoostPumpFlowRateMLPM()); + return result; } +/*********************************************************************//** + * @brief + * The testBoostPumpTargetDutyCycleOverride function overrides the RO pump + * duty cycle. + * @details \b Inputs: boostPumpOpenLoopTargetDutyCycle + * @details \b Outputs: boostPumpOpenLoopTargetDutyCycle + * @param message Override message from Dialin which includes the value + * of the target flow + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testBoostPumpTargetDutyCycleOverride( MESSAGE_T *message ) +{ + BOOL result = f32Override( message, &boostPumpOpenLoopTargetDutyCycle ); + + setBoostPumpTargetDutyCycle(getTargetBoostPumpDutyCyclePCT()); + + return result; +} + /**@}*/ Index: firmware/App/Controllers/BoostPump.h =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Controllers/BoostPump.h (.../BoostPump.h) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Controllers/BoostPump.h (.../BoostPump.h) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -73,6 +73,7 @@ BOOL testBoostPumpDataPublishIntervalOverride( MESSAGE_T *message ); BOOL testBoostPumpTargetPressureOverride( MESSAGE_T *message ); BOOL testBoostPumpTargetFlowOverride( MESSAGE_T *message ); +BOOL testBoostPumpTargetDutyCycleOverride( MESSAGE_T *message ); /**@}*/ Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -55,17 +55,6 @@ #define DATA_PUBLISH_COUNTER_START_COUNT 10 ///< Data publish counter start count. - -/// Enumeration of RO pump states. -typedef enum ROPump_States -{ - RO_PUMP_OFF_STATE = 0, ///< RO pump off state. - RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE, ///< RO pump control to target flow state. - RO_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE, ///< RO pump control to max pressure state. - RO_PUMP_OPEN_LOOP_STATE, ///< RO pump open loop state. - NUM_OF_RO_PUMP_STATES ///< Number of RO pump states. -} RO_PUMP_STATE_T; - // ********** private data ********** static RO_PUMP_STATE_T roPumpState; ///< Current state of pump controller state machine. @@ -78,7 +67,7 @@ static OVERRIDE_U32_T targetROPumpFlowRate; ///< Target RO flow rate (in L/min). static OVERRIDE_F32_T targetROPumpPressure; ///< Target RO max allowed pressure (in PSI). static F32 roPumpDutyCyclePctSet; ///< Currently set RO pump PWM duty cycle. -static F32 roPumpOpenLoopTargetDutyCycle; ///< Target RO pump open loop PWM. +static OVERRIDE_F32_T roPumpOpenLoopTargetDutyCycle; ///< Target RO pump open loop PWM. // ********** private function prototypes ********** @@ -113,27 +102,31 @@ initializePIController( PI_CONTROLLER_ID_RO_PUMP_PRES, MIN_FLUID_PUMP_DUTY_CYCLE_PCT, ROP_PRESSURE_CONTROL_P_COEFFICIENT, ROP_PRESSURE_CONTROL_I_COEFFICIENT, MIN_FLUID_PUMP_DUTY_CYCLE_PCT, MAX_FLUID_PUMP_DUTY_CYCLE_PCT, FALSE, 0 ); - roPumpState = RO_PUMP_OFF_STATE; - roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; - isROPumpOn = FALSE; - stopPumpRequest = FALSE; - roControlTimerCounter = 0; - roPumpDutyCyclePctSet = 0.0F; - roPumpOpenLoopTargetDutyCycle = 0.0F; - roPumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - roPumpDataPublishInterval.data = RO_PUMP_DATA_PUB_INTERVAL; - roPumpDataPublishInterval.ovData = RO_PUMP_DATA_PUB_INTERVAL; - roPumpDataPublishInterval.ovInitData = 0; - roPumpDataPublishInterval.override = OVERRIDE_RESET; - targetROPumpFlowRate.data = 0; - targetROPumpFlowRate.ovData = 0; - targetROPumpFlowRate.ovInitData = 0; - targetROPumpFlowRate.override = OVERRIDE_RESET; - targetROPumpPressure.data = 0.0F; - targetROPumpPressure.ovData = 0.0F; - targetROPumpPressure.ovInitData = 0.0F; - targetROPumpPressure.override = OVERRIDE_RESET; + roPumpState = RO_PUMP_OFF_STATE; + roPumpControlMode = NUM_OF_PUMP_CONTROL_MODES; + isROPumpOn = FALSE; + stopPumpRequest = FALSE; + roControlTimerCounter = 0; + roPumpDutyCyclePctSet = 0.0F; + roPumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; + roPumpDataPublishInterval.data = RO_PUMP_DATA_PUB_INTERVAL; + roPumpDataPublishInterval.ovData = RO_PUMP_DATA_PUB_INTERVAL; + roPumpDataPublishInterval.ovInitData = 0; + roPumpDataPublishInterval.override = OVERRIDE_RESET; + targetROPumpFlowRate.data = 0; + targetROPumpFlowRate.ovData = 0; + targetROPumpFlowRate.ovInitData = 0; + targetROPumpFlowRate.override = OVERRIDE_RESET; + targetROPumpPressure.data = 0.0F; + targetROPumpPressure.ovData = 0.0F; + targetROPumpPressure.ovInitData = 0.0F; + targetROPumpPressure.override = OVERRIDE_RESET; + roPumpOpenLoopTargetDutyCycle.data = 0; + roPumpOpenLoopTargetDutyCycle.ovData = 0; + roPumpOpenLoopTargetDutyCycle.ovInitData = 0; + roPumpOpenLoopTargetDutyCycle.override = OVERRIDE_RESET; + stopROPump(); } @@ -212,10 +205,10 @@ } // If the target duty cycle is greater than zero (minimum is 10%) and the mode has been set to open // loop, set the duty cycle - else if ( ( roPumpOpenLoopTargetDutyCycle > 0.0F ) && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) + else if ( ( getTargetROPumpDutyCyclePCT() > 0.0F ) && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpOpenLoopTargetDutyCycle ); - roPumpDutyCyclePctSet = roPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P12_PUMP, getTargetROPumpDutyCyclePCT() ); + roPumpDutyCyclePctSet = getTargetROPumpDutyCyclePCT(); isROPumpOn = TRUE; state = RO_PUMP_OPEN_LOOP_STATE; } @@ -245,15 +238,15 @@ if ( ( getTargetROPumpPressure() > 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { //transition to closed loop - resetPIController( PI_CONTROLLER_ID_RO_PUMP_PRES, roPumpDutyCyclePctSet, 0 ); + resetPIController( PI_CONTROLLER_ID_RO_PUMP_PRES, getTargetROPumpDutyCyclePCT(), 0 ); state = RO_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE; } // If there is a target flow set, transition to the PI controller and control to flow else if ( ( getTargetROPumpFlowRateMLPM() > 0 ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { ///transition to closed loop - resetPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, roPumpDutyCyclePctSet, 0 ); + resetPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, getTargetROPumpDutyCyclePCT(), 0 ); state = RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE; } @@ -279,13 +272,18 @@ resetPIController( PI_CONTROLLER_ID_RO_PUMP_PRES, roPumpDutyCyclePctSet, 0 ); state = RO_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE; } - else if ( roPumpOpenLoopTargetDutyCycle > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) + else if ( getTargetROPumpDutyCyclePCT() > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpOpenLoopTargetDutyCycle ); - roPumpDutyCyclePctSet = roPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P12_PUMP, getTargetROPumpDutyCyclePCT() ); + roPumpDutyCyclePctSet = getTargetROPumpDutyCyclePCT(); state = RO_PUMP_OPEN_LOOP_STATE; } - // Control at set interval + + // Control at set interval or shut off + if ( getTargetROPumpFlowRateMLPM() == 0.0F && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) + { + signalROPumpHardStop(); + } else if ( ( ++roControlTimerCounter >= ROP_CONTROL_INTERVAL ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { roPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, getTargetROPumpFlowRateMLPM(), getFilteredFlow( P16_FLOW ) ); @@ -308,19 +306,24 @@ { RO_PUMP_STATE_T state = RO_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE; + // Check if we are changing control if ( getTargetROPumpFlowRateMLPM() > 0 && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { - // Transition to target flow resetPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, roPumpDutyCyclePctSet, 0 ); state = RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE; } - else if ( roPumpOpenLoopTargetDutyCycle > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) + else if ( getTargetROPumpDutyCyclePCT() > 0.0F && ( PUMP_CONTROL_MODE_OPEN_LOOP == roPumpControlMode ) ) { - setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpOpenLoopTargetDutyCycle ); - roPumpDutyCyclePctSet = roPumpOpenLoopTargetDutyCycle; + setFluidPumpPctToPWMDutyCycle( P12_PUMP, getTargetROPumpDutyCyclePCT() ); + roPumpDutyCyclePctSet = getTargetROPumpDutyCyclePCT(); state = RO_PUMP_OPEN_LOOP_STATE; } - // Control at set interval + + // Control at set interval or shut off + if ( getTargetROPumpPressure() == 0.0F && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) + { + signalROPumpHardStop(); + } else if ( ( ++roControlTimerCounter >= ROP_CONTROL_INTERVAL ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { roPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_RO_PUMP_PRES, getTargetROPumpPressure(), getFilteredPressure( P17_PRES ) ); @@ -360,9 +363,9 @@ { targetROPumpPressure.data = 0.0F; } - if ( roPumpOpenLoopTargetDutyCycle > 0.0F ) + if ( getTargetROPumpDutyCyclePCT() > 0.0F ) { - roPumpOpenLoopTargetDutyCycle = 0.0F; + roPumpOpenLoopTargetDutyCycle.data = 0.0F; } result = TRUE; } @@ -403,9 +406,9 @@ { targetROPumpFlowRate.data = 0; } - if ( roPumpOpenLoopTargetDutyCycle > 0.0F ) + if ( getTargetROPumpDutyCyclePCT() > 0.0F ) { - roPumpOpenLoopTargetDutyCycle = 0.0F; + roPumpOpenLoopTargetDutyCycle.data = 0.0F; } result = TRUE; } @@ -435,12 +438,12 @@ if ( ( dutyCycle >= MIN_FLUID_PUMP_DUTY_CYCLE_PCT ) && ( dutyCycle <= MAX_FLUID_PUMP_DUTY_CYCLE_PCT ) ) { - roPumpOpenLoopTargetDutyCycle = dutyCycle; - roPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; - status = TRUE; + roPumpOpenLoopTargetDutyCycle.data = dutyCycle; + roPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; + status = TRUE; // Set the new duty cycle of the pump - setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpOpenLoopTargetDutyCycle ); + setFluidPumpPctToPWMDutyCycle( P12_PUMP, getTargetROPumpDutyCyclePCT() ); // Clear previous target data if ( getTargetROPumpFlowRateMLPM() > 0 ) { @@ -461,15 +464,17 @@ /*********************************************************************//** * @brief - * The getTargetRODutyCyclePCT function gets the current target RO pump + * The getTargetRODutyCyclePCT function gets the target RO pump * pwm. * @details \b Inputs: roPumpOpenLoopTargetDutyCycle * @details \b Outputs: none * @return the current target RO pwm between 0 and 0.99 *************************************************************************/ F32 getTargetROPumpDutyCyclePCT( void ) { - return roPumpOpenLoopTargetDutyCycle; + F32 dutyCycle = getF32OverrideValue( &roPumpOpenLoopTargetDutyCycle ); + + return dutyCycle; } /*********************************************************************//** @@ -482,7 +487,7 @@ *************************************************************************/ F32 getCurrentROPumpDutyCyclePCT( void ) { - U16 dutyCyclePct = convertDutyCycleCntToPct( getFluidPumpReadPWMDutyCycle( P12_PUMP ) ); + F32 dutyCyclePct = convertDutyCycleCntToPct( getFluidPumpReadPWMDutyCycle( P12_PUMP ) ); return dutyCyclePct; } @@ -571,9 +576,10 @@ resetPIController( PI_CONTROLLER_ID_RO_PUMP_PRES, MIN_FLUID_PUMP_DUTY_CYCLE_PCT, 0.0F ); } + roPumpState = RO_PUMP_OFF_STATE; roPumpDutyCyclePctSet = 0.0F; roControlTimerCounter = 0; - roPumpOpenLoopTargetDutyCycle = 0; + roPumpOpenLoopTargetDutyCycle.data = 0; stopPumpRequest = TRUE; stopROPump(); } @@ -626,7 +632,7 @@ pumpData.p12PumpSpeed = getFluidPumpRPM( P12_PUMP ); pumpData.p12TargetPressure = getTargetROPumpPressure(); pumpData.p12TargetFlow = getTargetROPumpFlowRateMLPM(); - pumpData.p12TargetDutyCycle = roPumpOpenLoopTargetDutyCycle; + pumpData.p12TargetDutyCycle = getTargetROPumpDutyCyclePCT(); broadcastData( MSG_ID_FP_RO_PUMP_DATA, COMM_BUFFER_OUT_CAN_FP_BROADCAST, (U08*)&pumpData, sizeof( RO_PUMP_DATA_T ) ); roPumpDataPublicationTimerCounter = 0; @@ -670,6 +676,8 @@ { BOOL result = f32Override( message, &targetROPumpPressure ); + setROPumpTargetPressure(getTargetROPumpPressure()); + return result; } @@ -687,7 +695,28 @@ { BOOL result = u32Override( message, &targetROPumpFlowRate, MIN_RO_FLOWRATE_MLPM, MAX_RO_FLOWRATE_MLPM ); + setROPumpTargetFlowRateMLPM(getTargetROPumpFlowRateMLPM()); + return result; } +/*********************************************************************//** + * @brief + * The testROPumpTargetDutyCycleOverride function overrides the RO pump + * duty cycle. + * @details \b Inputs: roPumpOpenLoopTargetDutyCycle + * @details \b Outputs: roPumpOpenLoopTargetDutyCycle + * @param message Override message from Dialin which includes the value + * of the target flow + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testROPumpTargetDutyCycleOverride( MESSAGE_T *message ) +{ + BOOL result = f32Override( message, &roPumpOpenLoopTargetDutyCycle ); + + setROPumpTargetDutyCycle(getTargetROPumpDutyCyclePCT()); + + return result; +} + /**@}*/ Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -40,6 +40,16 @@ #define ROP_FLOW_TO_PWM(flow) ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) ///< PWM line equation for flow. #define ROP_PRESSURE_TO_PWM(pres) ( ROP_PRESSURE_TO_PWM_SLOPE * pres + ROP_PRESSURE_TO_PWM_INTERCEPT ) ///< PWM line equation for pressure. +/// Enumeration of RO pump states. +typedef enum ROPump_States +{ + RO_PUMP_OFF_STATE = 0, ///< RO pump off state. + RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE, ///< RO pump control to target flow state. + RO_PUMP_CONTROL_TO_TARGET_PRESSURE_STATE, ///< RO pump control to max pressure state. + RO_PUMP_OPEN_LOOP_STATE, ///< RO pump open loop state. + NUM_OF_RO_PUMP_STATES ///< Number of RO pump states. +} RO_PUMP_STATE_T; + /// RO pump data record. typedef struct { @@ -73,6 +83,7 @@ BOOL testROPumpDataPublishIntervalOverride( MESSAGE_T *message ); BOOL testROPumpTargetPressureOverride( MESSAGE_T *message ); BOOL testROPumpTargetFlowOverride( MESSAGE_T *message ); +BOOL testROPumpTargetDutyCycleOverride( MESSAGE_T *message ); /**@}*/ Index: firmware/App/FPCommon.h =================================================================== diff -u -re5b0e2aedae6e58251b8a028c7fabd947c53abaa -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/FPCommon.h (.../FPCommon.h) (revision e5b0e2aedae6e58251b8a028c7fabd947c53abaa) +++ firmware/App/FPCommon.h (.../FPCommon.h) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -6,10 +6,10 @@ // ********** version ********** -#define RO_VERSION_MAJOR 0 -#define RO_VERSION_MINOR 0 -#define RO_VERSION_MICRO 0 -#define RO_VERSION_BUILD 3 +#define FP_VERSION_MAJOR 0 +#define FP_VERSION_MINOR 0 +#define FP_VERSION_MICRO 0 +#define FP_VERSION_BUILD 3 // ********** development build switches ********** @@ -33,20 +33,30 @@ #pragma pack(push,1) -/// Payload record structure for an RO versions message. +/// Payload record structure for an FP versions message. typedef struct { - U08 major; ///< RO version major revision. - U08 minor; ///< RO version minor revision. - U08 micro; ///< RO version micro revision. - U16 build; ///< RO build version. - U08 fpgaId; ///< RO FPGA ID. - U08 fpgaMajor; ///< RO FPGA major revision. - U08 fpgaMinor; ///< RO FPGA minor revision. - U08 fpgaLab; ///< RO FPGA lab revision. - U32 compatibilityRev; ///< RO compatibility revision. -} RO_VERSIONS_T; + U08 major; ///< FP version major revision. + U08 minor; ///< FP version minor revision. + U08 micro; ///< FP version micro revision. + U16 build; ///< FP build version. + U08 fpgaId; ///< FP FPGA ID. + U08 fpgaMajor; ///< FP FPGA major revision. + U08 fpgaMinor; ///< FP FPGA minor revision. + U08 fpgaLab; ///< FP FPGA lab revision. + U32 compatibilityRev; ///< FP compatibility revision. +} FP_VERSIONS_T; +/// Record defining the fields in a UI version request message. +typedef struct +{ + U08 major; ///< Major version for UI software. + U08 minor; ///< Minor version for UI software. + U08 micro; ///< Micro version for UI software. + U16 build; ///< Build number for UI software. + U32 compatibility; ///< Compatibility revision. +} UI_VERSIONS_T; + #pragma pack(pop) // **** Common Macros **** Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r129a1c2f4343bc85efdb4767c2dec35e4ba8ce98 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 129a1c2f4343bc85efdb4767c2dec35e4ba8ce98) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -1,7 +1,15 @@ +#include "BoostPump.h" +#include "ModePreGenPermeateDefeatured.h" +#include "ModePreGenPermeate.h" +#include "ModeStandby.h" +#include "OperationModes.h" +#include "PersistentAlarm.h" +#include "ROPump.h" +#include "SystemCommFP.h" +#include "TaskGeneral.h" +#include "Valves.h" -#include "ModeFault.h" - /** * @addtogroup ROFaultMode * @{ @@ -17,6 +25,17 @@ U32 transitionToFaultMode( void ) { + setValveState( M4_VALV,VALVE_STATE_CLOSED ); + setValveState( P6_VALV,VALVE_STATE_CLOSED ); + setValveState( P11_VALV,VALVE_STATE_CLOSED ); + setValveState( P33_VALV, VALVE_STATE_CLOSED ); + setValveState( P34_VALV,VALVE_STATE_CLOSED ); + setValveState( P37_VALV, VALVE_STATE_CLOSED ); + setValveState( P39_VALV,VALVE_STATE_CLOSED ); + setValveState( M7_VALV, VALVE_STATE_CLOSED ); + setValveState( P20_VALV,VALVE_STATE_CLOSED ); + + signalROPumpHardStop(); return 0; } Index: firmware/App/Modes/ModeGenPermeate.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/ModeGenPermeate.c (.../ModeGenPermeate.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Modes/ModeGenPermeate.c (.../ModeGenPermeate.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -40,6 +40,7 @@ #define GEN_PERMEATE_TANK_FULL_SWITCH_MS ( 6 * MS_PER_SECOND ) ///< state switch timeout (in ms) #define GEN_PERMEATE_TANK_FULL_TIMEOUT_MS ( 60 * MS_PER_SECOND ) #define GEN_PERMEATE_BOOST_PUMP_TGT_PSI 25 +#define GEN_PERMEATE_PWM_DEFAULT 0.22F // ********** private data ********** @@ -94,6 +95,7 @@ { initGenPermeateMode(); setCurrentSubState( genPermeateState ); + setModeGenPTransition( genPermeateState ); return genPermeateState; } @@ -113,11 +115,11 @@ switch ( genPermeateState ) { case FP_GENP_TANK_FILL_STATE: - genPermeateState = handleGenPTankFullState(); + genPermeateState = handleGenPTankFillState(); break; case FP_GENP_TANK_FULL_STATE: - genPermeateState = handleGenPTankFillState(); + genPermeateState = handleGenPTankFullState(); break; default: @@ -162,7 +164,14 @@ { setBoostPumpTargetPressure( GEN_PERMEATE_BOOST_PUMP_TGT_PSI ); } - setROPumpTargetDutyCycle( getGenPermeateRODutyCycle() ); + if ( 0.0F == getGenPermeateRODutyCycle() ) + { + setROPumpTargetDutyCycle( GEN_PERMEATE_PWM_DEFAULT ); + } + else + { + setROPumpTargetDutyCycle( getGenPermeateRODutyCycle() ); + } break; case FP_GENP_TANK_FULL_STATE: @@ -178,7 +187,14 @@ } tankFullDelayTime = getMSTimerCount(); tankFullAlarmTimeout = getMSTimerCount(); - setROPumpTargetDutyCycle( getGenPermeateRODutyCycle() ); + if ( 0.0F == getGenPermeateRODutyCycle() ) + { + setROPumpTargetDutyCycle( GEN_PERMEATE_PWM_DEFAULT ); + } + else + { + setROPumpTargetDutyCycle( getGenPermeateRODutyCycle() ); + } break; default: @@ -372,15 +388,10 @@ *************************************************************************/ BOOL requestGenWaterStart( void ) { - BOOL result = FALSE; + BOOL result = TRUE; + pendingStartGenRequest = TRUE; + requestNewOperationMode( FP_MODE_GENP ); - if ( FP_PRE_GENP_VERIFY_WATER == getCurrentPreGenPState() ) - { - result = TRUE; - pendingStartGenRequest = TRUE; - requestNewOperationMode( FP_MODE_GENP ); - } - return result; } Index: firmware/App/Modes/ModePreGenPermeate.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Modes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -72,7 +72,7 @@ *************************************************************************/ void initPreGenPMode( void ) { - preGenPState = FP_PRE_GENP_PAUSED; + preGenPState = FP_PRE_GENP_INLET_PRESSURE_CHECK; preGenPDataPublishInterval.data = PRE_GENP_DATA_PUBLISH_INTERVAL; preGenPDataPublishInterval.ovData = PRE_GENP_DATA_PUBLISH_INTERVAL; preGenPDataPublishInterval.ovInitData = 0; @@ -95,6 +95,7 @@ { initPreGenPMode(); setCurrentSubState( preGenPState ); + setModePreGenPTransition( preGenPState ); return preGenPState; } Index: firmware/App/Modes/ModePreGenPermeateDefeatured.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/ModePreGenPermeateDefeatured.c (.../ModePreGenPermeateDefeatured.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Modes/ModePreGenPermeateDefeatured.c (.../ModePreGenPermeateDefeatured.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -50,7 +50,7 @@ static FP_PRE_GENP_DEF_MODE_STATE_T handlePreGenPDefFlushState( void ); static FP_PRE_GENP_DEF_MODE_STATE_T handlePreGenPDefInletWaterState( void ); static FP_PRE_GENP_DEF_MODE_STATE_T handlePreGenPDefPausedState( void ); -static void setModePreGenPDefTransition( FP_GENP_DEF_MODE_STATE_T state ); +static void setModePreGenPDefTransition( FP_PRE_GENP_DEF_MODE_STATE_T state ); static U32 getPreGenPermeateDefDataPublishInterval( void ); static void publishPreGenPDefModeData( void ); @@ -143,7 +143,7 @@ * @param state gen permeate state enum * @return none *************************************************************************/ -static void setModePreGenPDefTransition( FP_GENP_DEF_MODE_STATE_T state ) +static void setModePreGenPDefTransition( FP_PRE_GENP_DEF_MODE_STATE_T state ) { // Execute on running state switch( state ) Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -15,13 +15,16 @@ * ***************************************************************************/ +#include "BoostPump.h" #include "ModePreGenPermeateDefeatured.h" #include "ModePreGenPermeate.h" #include "ModeStandby.h" #include "OperationModes.h" #include "PersistentAlarm.h" +#include "ROPump.h" #include "SystemCommFP.h" #include "TaskGeneral.h" +#include "Valves.h" /** * @addtogroup FPStandbyMode @@ -63,6 +66,24 @@ { initStandbyMode(); + setValveState( M4_VALV,VALVE_STATE_CLOSED ); + setValveState( P6_VALV,VALVE_STATE_CLOSED ); + setValveState( P11_VALV,VALVE_STATE_CLOSED ); + setValveState( P33_VALV, VALVE_STATE_CLOSED ); + setValveState( P34_VALV,VALVE_STATE_CLOSED ); + setValveState( P37_VALV, VALVE_STATE_CLOSED ); + setValveState( P39_VALV,VALVE_STATE_CLOSED ); + setValveState( M7_VALV, VALVE_STATE_CLOSED ); + setValveState( P20_VALV,VALVE_STATE_CLOSED ); + + signalROPumpHardStop(); + + if ( TRUE == isBoostPumpInstalled() ) + { + signalBoostPumpHardStop(); + } + + return standbyState; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r410afd26b3ae5e372310c696c82f58c59235e10d -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 410afd26b3ae5e372310c696c82f58c59235e10d) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -58,7 +58,7 @@ /* FAUL */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, /* SERV */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, /* INIT */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_INIT, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, -/* STAN */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_DEGW }, +/* STAN */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_DPGW, FP_MODE_DEGW }, /* PGEN */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, /* GENW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, /* DPGW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_DPGW, FP_MODE_DEGW }, Index: firmware/App/Services/AlarmMgmtFP.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Services/AlarmMgmtFP.c (.../AlarmMgmtFP.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Services/AlarmMgmtFP.c (.../AlarmMgmtFP.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -112,7 +112,7 @@ if ( TRUE == isTransitionToFaultRequired() ) { - // If alarm is a DD fault and the alarm manager can transition to fault immediately, go to fault mode + // If alarm is a FP fault and the alarm manager can transition to fault immediately, go to fault mode requestNewOperationMode( FP_MODE_FAUL ); } } Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r8d272582cbd2cb5fc0c6af0fead2867ce02658b0 -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 8d272582cbd2cb5fc0c6af0fead2867ce02658b0) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -144,10 +144,10 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( RO_WATER_REQ_PAYLOAD_T ) ) + if ( message->hdr.payloadLen == sizeof( FP_WATER_REQ_PAYLOAD_T ) ) { - RO_WATER_REQ_PAYLOAD_T cmd; - memcpy( &cmd, message->payload, sizeof( RO_WATER_REQ_PAYLOAD_T ) ); + FP_WATER_REQ_PAYLOAD_T cmd; + memcpy( &cmd, message->payload, sizeof( FP_WATER_REQ_PAYLOAD_T ) ); switch ( cmd.cmdID ) { @@ -234,7 +234,7 @@ BOOL result = FALSE; FP_OP_MODE_T roMode = getCurrentOperationMode(); - if ( ( FP_MODE_PGEN == roMode ) && ( TRUE == start ) ) + if ( TRUE == start ) { setDDPermeateFlowRate( roRate ); if ( TRUE == isDefeatured() ) @@ -248,26 +248,13 @@ } } - else if ( FP_MODE_GENP == roMode ) + else { - if ( FALSE == start ) - { - result = requestGenWaterStop(); - } - - else - { - // Set flow rate and delivery. - setDDPermeateFlowRate( roRate ); - result = TRUE; - } + // Set flow rate and delivery. + result = requestGenWaterStop(); + result = TRUE; } - else if ( FP_MODE_DEGW == roMode ) - { - result = requestGenWaterDefStop(); - } - return result; } Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r410afd26b3ae5e372310c696c82f58c59235e10d -r1cf11f4c1f6a1f1fd40270889723fbec040fc7ec --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 410afd26b3ae5e372310c696c82f58c59235e10d) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 1cf11f4c1f6a1f1fd40270889723fbec040fc7ec) @@ -1,7 +1,8 @@ -#include + #include // for memcpy() +#include "BoostPump.h" #include "Compatible.h" #include "Conductivity.h" #include "DDInterface.h" @@ -10,6 +11,7 @@ #include "Level.h" #include "Messaging.h" #include "ModeGenPermeate.h" +#include "ModePreGenPermeate.h" #include "OperationModes.h" #include "PAL.h" #include "Pressure.h" @@ -71,10 +73,10 @@ { MSG_ID_FP_VALVE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testValvesStatesPublishIntervalOverride }, { MSG_ID_FP_VALVE_CMD_STATE_OVERRIDE_REQUEST, &testValveStateOverride }, { MSG_ID_FP_VALVE_SENSED_STATE_OVERRIDE_REQUEST, &testValveSensedStateOverride }, -{ MSG_ID_FP_BOOST_PUMP_SET_PWM_REQUEST, &testSetFluidPumpPWM }, -{ MSG_ID_FP_BOOST_PUMP_READ_PWM_OVERRIDE_REQUEST, &testFluidPumpPWMOverride }, -{ MSG_ID_FP_BOOST_PUMP_SPEED_OVERRIDE_REQUEST, &testFluidPumpRPMOverride }, -{ MSG_ID_FP_BOOST_PUMPS_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testROPumpDataPublishIntervalOverride }, +{ MSG_ID_FP_FLUID_PUMP_SET_PWM_REQUEST, &testSetFluidPumpPWM }, +{ MSG_ID_FP_FLUID_PUMP_READ_PWM_OVERRIDE_REQUEST, &testFluidPumpPWMOverride }, +{ MSG_ID_FP_FLUID_PUMP_SPEED_OVERRIDE_REQUEST, &testFluidPumpRPMOverride }, +{ MSG_ID_FP_RO_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testROPumpDataPublishIntervalOverride }, { MSG_ID_FP_PRESSURE_OVERRIDE_REQUEST, &testPressureSensorReadingsOverride }, { MSG_ID_FP_PRESSURE_TEMP_OVERRIDE_REQUEST, &testPressureSensorTemperatureReadingsOverride }, { MSG_ID_FP_PRESSURE_READ_COUNT_OVERRIDE_REQUEST, &testPressureSensorReadCounterOverride }, @@ -97,6 +99,13 @@ { MSG_ID_FP_PRE_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPreGenDataPublishIntervalOverride }, { MSG_ID_FP_SET_OPERATION_MODE_REQUEST, &testSetOperationMode }, { MSG_ID_FP_TEMPERATURE_SENSOR_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testTemperatureSensorsDataPublishIntervalOverride }, +{ MSG_ID_FP_RO_PUMP_TARGET_PRESSURE_OVERRIDE_REQUEST, &testROPumpTargetPressureOverride }, +{ MSG_ID_FP_RO_PUMP_TARGET_FLOW_OVERRIDE_REQUEST, &testROPumpTargetFlowOverride }, +{ MSG_ID_FP_RO_PUMP_TARGET_PWM_OVERRIDE_REQUEST, &testROPumpTargetDutyCycleOverride }, +{ MSG_ID_FP_BOOST_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testBoostPumpDataPublishIntervalOverride }, +{ MSG_ID_FP_BOOST_PUMP_TARGET_PRESSURE_OVERRIDE_REQUEST, &testBoostPumpTargetPressureOverride }, +{ MSG_ID_FP_BOOST_PUMP_TARGET_FLOW_OVERRIDE_REQUEST, &testBoostPumpTargetFlowOverride }, +{ MSG_ID_FP_BOOST_PUMP_TARGET_PWM_OVERRIDE_REQUEST, &testBoostPumpTargetDutyCycleOverride }, }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLER_LOOKUP) / sizeof(MSG_HANDLER_LOOKUP_T)) @@ -516,6 +525,42 @@ return status; } +/*********************************************************************//** + * @brief + * The handleVersionRequestMessage function handles a UI request for FP + * version information. + * @details \b Message \b Sent: MSG_ID_FP_VERSION_REPONSE + * @details \b Inputs: none + * @details \b Outputs: FP version info. + * @param message Pointer to the UI version request message which contains + * the UI version information as well. + * @return TRUE if request handled successfully, FALSE if not + *************************************************************************/ +//BOOL handleVersionRequestMessage( MESSAGE_T *message ) +//{ +// BOOL result = FALSE; +// +// if ( message->hdr.payloadLen == sizeof( UI_VERSIONS_T ) ) +// { +// FP_VERSIONS_T fpVersionRecord; +// +// // Record UI version information +// memcpy( (U08*)(&uiVersionRecord), &message->payload, sizeof( UI_VERSIONS_T ) ); +// +// // Build DD version record +// ddVersionRecord.major = DD_VERSION_MAJOR; +// ddVersionRecord.minor = DD_VERSION_MINOR; +// ddVersionRecord.micro = DD_VERSION_MICRO; +// ddVersionRecord.build = DD_VERSION_BUILD; +// getFPGAVersions( &ddVersionRecord.fpgaId, &ddVersionRecord.fpgaMajor, &ddVersionRecord.fpgaMinor, &ddVersionRecord.fpgaLab ); +// ddVersionRecord.compatibilityRev = SW_COMPATIBILITY_REV; +// +// // Send DD version information +// result = sendMessage( MSG_ID_DD_VERSION_RESPONSE, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&ddVersionRecord, sizeof( DD_VERSIONS_T ) ); +// } +// +// return result; +//} /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/