Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -rd0ddf8fe0bc062cbf2f3520134dbe1d5a5b85115 -rf2e1d5b6ec4faef967685db28cdba82b060e9e8d --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision d0ddf8fe0bc062cbf2f3520134dbe1d5a5b85115) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision f2e1d5b6ec4faef967685db28cdba82b060e9e8d) @@ -102,35 +102,35 @@ // ********** private data ********** -static RO_PUMP_STATE_T roPumpState = RO_PUMP_OFF_STATE; ///< current state of RO pump controller state machine -static U32 roPumpDataPublicationTimerCounter = 0; ///< used to schedule RO pump data publication to CAN bus -static BOOL isROPumpOn = FALSE; ///< RO pump is currently running -static F32 roPumpPWMDutyCyclePct = 0.0; ///< initial RO pump PWM duty cycle -static F32 roPumpDutyCyclePctSet = 0.0; ///< currently set RO pump PWM duty cycle -static PUMP_CONTROL_MODE_T roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested RO pump control mode -static PUMP_CONTROL_MODE_T roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set RO pump control mode +static RO_PUMP_STATE_T roPumpState = RO_PUMP_OFF_STATE; ///< current state of RO pump controller state machine. +static U32 roPumpDataPublicationTimerCounter = 0; ///< used to schedule RO pump data publication to CAN bus. +static BOOL isROPumpOn = FALSE; ///< RO pump is currently running. +static F32 roPumpPWMDutyCyclePct = 0.0; ///< initial RO pump PWM duty cycle. +static F32 roPumpDutyCyclePctSet = 0.0; ///< currently set RO pump PWM duty cycle. +static PUMP_CONTROL_MODE_T roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested RO pump control mode. +static PUMP_CONTROL_MODE_T roPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set RO pump control mode. -static F32 targetROPumpFlowRate = 0.0; ///< Target RO flow rate (in L/min) -static U32 targetROPumpPressure = 0; ///< Target RO pressure (in PSI) +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 -static OVERRIDE_F32_T measuredROFlowRateLPM = { 0.0, 0.0, 0.0, 0 }; ///< measured RO flow rate (in L/min) + 0, 0 }; ///< Interval (in ms) at which to publish RO flow data to CAN bus. +static OVERRIDE_F32_T measuredROFlowRateLPM = { 0.0, 0.0, 0.0, 0 }; ///< measured RO flow rate (in L/min). -static U32 flowVerificationCounter = 0; ///< Counter to verify the flow is in range -static U32 roControlTimerCounter = 0; ///< determines when to perform control on RO pump -static F32 roPumpOpenLoopTargetDutyCycle = 0; ///< Target RO pump open loop PWM -static F32 roPumpFlowRateRunningSum = 0; ///< RO pump flow rate running sum -static F32 roPumpPressureRunningSum = 0; ///< RO pump pressure running sum +static U32 flowVerificationCounter = 0; ///< Counter to verify the flow is in range. +static U32 roControlTimerCounter = 0; ///< determines when to perform control on RO pump. +static F32 roPumpOpenLoopTargetDutyCycle = 0; ///< Target RO pump open loop PWM. +static F32 roPumpFlowRateRunningSum = 0; ///< RO pump flow rate running sum. +static F32 roPumpPressureRunningSum = 0; ///< RO pump pressure running sum. /* TODO These variables are used for POST. POST has not been implemented yet -static RO_PUMP_SELF_TEST_STATE_T roPumpSelfTestState = RO_PUMP_SELF_TEST_STATE_START; ///< Current ro pump self test state -static U32 roPumpSelfTestTimerCount = 0; ///< Timer counter for ro pump self test +static RO_PUMP_SELF_TEST_STATE_T roPumpSelfTestState = RO_PUMP_SELF_TEST_STATE_START; ///< Current RO pump self test state. +static U32 roPumpSelfTestTimerCount = 0; ///< Timer counter for RO pump self test. */ -static S32 measuredFlowReadingsSum = 0; ///< Raw flow reading sums for averaging -static U32 flowFilterCounter = 0; ///< Flow filtering counter +static S32 measuredFlowReadingsSum = 0; ///< Raw flow reading sums for averaging. +static U32 flowFilterCounter = 0; ///< Flow filtering counter. // ********** private function prototypes ********** @@ -317,9 +317,9 @@ // meaning, it is controlling to a certain pressure if ( roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP && roPumpState == RO_PUMP_CONTROL_TO_TARGET_STATE ) { - F32 currentFlow = getMeasuredROFlowRate(); - F32 targetFlow = getTargetROPumpFlowRate(); - F32 error = fabs( 1.0 - ( currentFlow / targetFlow ) ); + F32 currentFlow = getMeasuredROFlowRate(); + F32 targetFlow = getTargetROPumpFlowRate(); + F32 error = fabs( 1.0 - ( currentFlow / targetFlow ) ); // Figure out whether flow is out of range from which side if ( error > MAX_ALLOWED_FLOW_DEVIATION )