Index: firmware/App/Controllers/BoostPump.c =================================================================== diff -u -r2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision 2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff) +++ firmware/App/Controllers/BoostPump.c (.../BoostPump.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -44,7 +44,7 @@ #define BOOST_PRESSURE_CONTROL_P_COEFFICIENT 0.01F ///< P term for Boost pump pressure control. #define BOOST_PRESSURE_CONTROL_I_COEFFICIENT 0.01F ///< I term for Boost pump pressure control. -#define BOOST_FLOW_TO_PWM_SLOPE 0.5F ///< Slope of flow to PWM line equation. +#define BOOST_FLOW_TO_PWM_SLOPE 0.357F ///< Slope of flow to PWM line equation. #define BOOST_FLOW_TO_PWM_INTERCEPT 0.0F ///< Intercept of flow to PWM line equation. #define BOOST_PRESSURE_TO_PWM_SLOPE 0.5F ///< Slope of pressure to PWM line equation. #define BOOST_PRESSURE_TO_PWM_INTERCEPT 0.0F ///< Intercept of pressure to PWM line equation. @@ -288,13 +288,13 @@ } // Control at set interval or shut off - if ( ( getTargetBoostPumpFlowRateMLPM() == 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == boostPumpControlMode ) ) + if ( ( (F32)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 ) ); + boostPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_BOOST_PUMP_FLOW, (F32)getTargetBoostPumpFlowRateMLPM(), getFilteredFlow( P7_FLOW ) ); setFluidPumpPctToPWMDutyCycle( P40_PUMP, boostPumpDutyCyclePctSet ); boostControlTimerCounter = 0; } Index: firmware/App/Controllers/PermeateTank.c =================================================================== diff -u -r6dd382e3988fac2f9ee041b4738d67305e17a6a2 -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Controllers/PermeateTank.c (.../PermeateTank.c) (revision 6dd382e3988fac2f9ee041b4738d67305e17a6a2) +++ firmware/App/Controllers/PermeateTank.c (.../PermeateTank.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -331,7 +331,7 @@ setValveState( M4_VALV, VALVE_STATE_CLOSED ); setValveState( M7_VALV, VALVE_STATE_CLOSED ); setValveState( P6_VALV, VALVE_STATE_CLOSED ); - setValveState( P11_VALV, VALVE_STATE_CLOSED ); + setValveState( P11_VALV, VALVE_STATE_OPEN ); setValveState( P33_VALV, VALVE_STATE_OPEN ); setValveState( P34_VALV, VALVE_STATE_CLOSED ); setValveState( P37_VALV, VALVE_STATE_CLOSED ); Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -46,15 +46,15 @@ #define ROP_PRESSURE_CONTROL_P_COEFFICIENT 0.15F ///< P term for RO pump pressure control. #define ROP_PRESSURE_CONTROL_I_COEFFICIENT 0.65F ///< I term for RO pump pressure control. -#define ROP_FLOW_TO_PWM_SLOPE 0.5F ///< Slope of flow to PWM line equation. +#define ROP_FLOW_TO_PWM_SLOPE 0.357F ///< Slope of flow to PWM line equation. #define ROP_FLOW_TO_PWM_INTERCEPT 0.0F ///< Intercept of flow to PWM line equation. -#define ROP_PRESSURE_TO_PWM_SLOPE 0.5F ///< Slope of pressure to PWM line equation. +#define ROP_PRESSURE_TO_PWM_SLOPE 10.0F ///< Slope of pressure to PWM line equation. #define ROP_PRESSURE_TO_PWM_INTERCEPT 0.0F ///< Intercept of pressure to PWM line equation. #define DATA_PUBLISH_COUNTER_START_COUNT 10 ///< Data publish counter start count. -#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. +#define ROP_FLOW_TO_PWM_PCT(flow) ( ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for flow. +#define ROP_PRESSURE_TO_PWM_PCT(pres) ( ( ROP_PRESSURE_TO_PWM_SLOPE * pres + ROP_PRESSURE_TO_PWM_INTERCEPT ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for pressure. // ********** private data ********** @@ -281,13 +281,13 @@ } // Control at set interval or shut off - if ( ( getTargetROPumpFlowRateMLPM() == 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) + if ( ( (F32)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 ) ); + roPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, (F32)getTargetROPumpFlowRateMLPM(), getFilteredFlow( P16_FLOW ) ); setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpDutyCyclePctSet ); roControlTimerCounter = 0; } @@ -580,7 +580,7 @@ roPumpState = RO_PUMP_OFF_STATE; roPumpDutyCyclePctSet = 0.0F; roControlTimerCounter = 0; - roPumpOpenLoopTargetDutyCycle.data = 0; + roPumpOpenLoopTargetDutyCycle.data = 0.0F; stopPumpRequest = TRUE; stopROPump(); } Index: firmware/App/Drivers/FluidPump.h =================================================================== diff -u -r8940f67c485a23e20e14e4dc24e79339f80cc584 -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Drivers/FluidPump.h (.../FluidPump.h) (revision 8940f67c485a23e20e14e4dc24e79339f80cc584) +++ firmware/App/Drivers/FluidPump.h (.../FluidPump.h) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -32,7 +32,7 @@ // ********** public definitions ********** -#define MAX_FLUID_PUMP_PWM_DUTY_CYCLE 450 ///< Maximum settable boost pump duty cycle magnitude. +#define MAX_FLUID_PUMP_PWM_DUTY_CYCLE 500 ///< Maximum settable boost pump duty cycle magnitude. #define MIN_FLUID_PUMP_PWM_DUTY_CYCLE 0 ///< minimum settable boost pump duty cycle magnitude. #define MAX_FLUID_PUMP_DUTY_CYCLE_PCT 0.90F ///< Max duty cycle in percentage. Index: firmware/App/Modes/FlushPermeate.c =================================================================== diff -u -r2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Modes/FlushPermeate.c (.../FlushPermeate.c) (revision 2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff) +++ firmware/App/Modes/FlushPermeate.c (.../FlushPermeate.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -222,7 +222,7 @@ { setBoostPumpTargetPressure( PERMEATE_FLUSH_BOOST_PUMP_TGT_PSI ); } - setROPumpTargetPressure( PERMEATE_FLUSH_RO_PUMP_TGT_ML ); + setROPumpTargetFlowRateMLPM( PERMEATE_FLUSH_RO_PUMP_TGT_ML ); permeateFlushTimer = getMSTimerCount(); permeateFlushAlarmTimer = getMSTimerCount(); pendingStartPermeateFlushRequest = FALSE; Index: firmware/source/sys_main.c =================================================================== diff -u -r2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/source/sys_main.c (.../sys_main.c) (revision 2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff) +++ firmware/source/sys_main.c (.../sys_main.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -48,10 +48,7 @@ /* Include Files */ -#include -#include -#include -#include + #include "sys_common.h" /* USER CODE BEGIN (1) */ @@ -76,6 +73,10 @@ #include "FlushFilter.h" #include "FlushPermeate.h" #include "FpgaFP.h" +#include "FPModeFault.h" +#include "FPModeInitPOST.h" +#include "FPModeStandby.h" +#include "FPOperationModes.h" #include "InternalADC.h" #include "Interrupts.h" #include "Level.h"