Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r44c977966ab7cfecbfbf5110e6abe4ec45ebab62 -r93dc3570f6a7581dd82f7f76e256784be29d5530 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 44c977966ab7cfecbfbf5110e6abe4ec45ebab62) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 93dc3570f6a7581dd82f7f76e256784be29d5530) @@ -7,8 +7,8 @@ * * @file ROPump.c * -* @author (last) Sean Nash -* @date (last) 19-Aug-2020 +* @author (last) Quang Nguyen +* @date (last) 14-Sep-2020 * * @author (original) Sean * @date (original) 04-Apr-2020 @@ -70,13 +70,13 @@ NUM_OF_RO_PUMP_STATES ///< Number of RO pump states } RO_PUMP_STATE_T; -/// Enumeration of RO pump self test states. +/// Enumeration of RO pump self-test states. typedef enum ROPump_Self_Test_States { - RO_PUMP_SELF_TEST_STATE_START = 0, ///< RO pump self test start state - RO_PUMP_TEST_STATE_IN_PROGRESS, ///< RO pump self tests in progress state - RO_PUMP_TEST_STATE_COMPLETE, ///< RO pump self tests completed state - NUM_OF_RO_PUMP_SELF_TEST_STATES ///< Number of RO pump self test states + RO_PUMP_SELF_TEST_STATE_START = 0, ///< RO pump self-test start state + RO_PUMP_TEST_STATE_IN_PROGRESS, ///< RO pump self-tests in progress state + RO_PUMP_TEST_STATE_COMPLETE, ///< RO pump self-tests completed state + NUM_OF_RO_PUMP_SELF_TEST_STATES ///< Number of RO pump self-test states } RO_PUMP_SELF_TEST_STATE_T; // TODO - test code - remove later @@ -106,8 +106,8 @@ static U32 roControlTimerCounter = 0; ///< Timer counter for perform control on RO pump. -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. // ********** private function prototypes ********** @@ -121,9 +121,8 @@ /*********************************************************************//** * @brief * The initROPump function initializes the ROPump module. - * @details - * Inputs : none - * Outputs : ROPump module initialized. + * @details Inputs: none + * @details Outputs: ROPump module initialized. * @return none *************************************************************************/ void initROPump( void ) @@ -138,9 +137,8 @@ /*********************************************************************//** * @brief * The setROPumpTargetPressure function sets a new target pressure for the RO pump. - * @details - * Inputs : none - * Outputs : targetROPumpPressure, roPumpPWMDutyCyclePct + * @details Inputs: none + * @details Outputs: targetROPumpPressure, roPumpPWMDutyCyclePct * @param roPressure new target RO pressure * @param mode new control mode * @return TRUE if new target pressure is set, FALSE if not @@ -174,9 +172,8 @@ /*********************************************************************//** * @brief * The signalROPumpHardStop function stops the RO pump immediately. - * @details - * Inputs : none - * Outputs : RO pump stopped, set point reset, state changed to off + * @details Inputs: none + * @details Outputs: RO pump stopped, set point reset, state changed to off * @return none *************************************************************************/ void signalROPumpHardStop( void ) @@ -192,9 +189,8 @@ /*********************************************************************//** * @brief * The execROPumpMonitor function executes the RO Pump monitor. - * @details - * Inputs : flowFilterCounter - * Outputs : measuredROPumpPressure, measuredROFlowRateLPM + * @details Inputs: flowFilterCounter + * @details Outputs: measuredROPumpPressure, measuredROFlowRateLPM * @return none *************************************************************************/ void execROPumpMonitor( void ) @@ -234,9 +230,8 @@ /*********************************************************************//** * @brief * The execROPumpController function executes the RO Pump controller. - * @details - * Inputs : roPumpState - * Outputs : roPumpState + * @details Inputs: roPumpState + * @details Outputs: roPumpState * @return none *************************************************************************/ void execROPumpController( void ) @@ -261,9 +256,8 @@ /*********************************************************************//** * @brief * The isROPumpOn function returns the status of RO pump. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @return isROPumpOn *************************************************************************/ BOOL isReverseOsmosisPumpOn( void ) @@ -275,9 +269,8 @@ * @brief * The handleROPumpOffState function handles the RO pump off state of the * RO pump controller state machine. - * @details - * Inputs : targetROPumpPressure - * Outputs : roPumpPWMDutyCyclePctSet, isROPumpOn + * @details Inputs: targetROPumpPressure + * @details Outputs: roPumpPWMDutyCyclePctSet, isROPumpOn * @return next state *************************************************************************/ static RO_PUMP_STATE_T handleROPumpOffState( void ) @@ -329,9 +322,8 @@ * @brief * The handleROPumpControlToTargetState function handles the "control to * target" state of the RO pump controller state machine. - * @details - * Inputs : none - * Outputs : roPumpState + * @details Inputs: none + * @details Outputs: roPumpState * @return next state *************************************************************************/ static RO_PUMP_STATE_T handleROPumpControlToTargetState( void ) @@ -379,9 +371,8 @@ * @brief * The setROPumpControlSignalPWM function sets the PWM duty cycle for the * RO pump to a given %. - * @details - * Inputs : none - * Outputs : PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: PWM duty cycle zeroed * @param newPWM new duty cycle % to apply to PWM * @return none *************************************************************************/ @@ -393,9 +384,8 @@ /*********************************************************************//** * @brief * The stopROPump function sets the RO pump PWM to zero. - * @details - * Inputs : none - * Outputs : PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: PWM duty cycle zeroed * @return none *************************************************************************/ static void stopROPump( void ) @@ -408,9 +398,8 @@ /*********************************************************************//** * @brief * The getPublishROPumpDataInterval function gets the RO pump data publish interval. - * @details - * Inputs : roPumpDataPublishInterval - * Outputs : none + * @details Inputs: roPumpDataPublishInterval + * @details Outputs: none * @return the current RO pump data publication interval (in ms). *************************************************************************/ static U32 getPublishROPumpDataInterval( void ) @@ -428,9 +417,8 @@ /*********************************************************************//** * @brief * The getTargetROPumpPressure function gets the current target RO pump pressure. - * @details - * Inputs : targetROPumpPressure - * Outputs : none + * @details Inputs: targetROPumpPressure + * @details Outputs: none * @return the current target RO pressure (in PSI). *************************************************************************/ U32 getTargetROPumpPressure( void ) @@ -448,9 +436,8 @@ /*********************************************************************//** * @brief * The getMeasuredROFlowRate function gets the measured RO pump flow rate. - * @details - * Inputs : measuredROFlowRateLPM - * Outputs : none + * @details Inputs: measuredROFlowRateLPM + * @details Outputs: none * @return the current RO pump flow rate (in LPM). *************************************************************************/ F32 getMeasuredROFlowRate( void ) @@ -468,9 +455,8 @@ /*********************************************************************//** * @brief * The publishROPumpData function publishes RO pump data at the set interval. - * @details - * Inputs : target pressure, measured pressure, measured RO pump speed. - * Outputs : RO pump data is published to CAN bus. + * @details Inputs: target pressure, measured pressure, measured RO pump speed. + * @details Outputs: RO pump data is published to CAN bus. * @return none *************************************************************************/ static void publishROPumpData( void ) @@ -481,24 +467,23 @@ U32 presStPt = getTargetROPumpPressure(); F32 measFlow = getMeasuredROFlowRate(); F32 pumpPWMPctDutyCycle = roPumpPWMDutyCyclePctSet * FRACTION_TO_PERCENT_FACTOR; - broadcastROPumpData( presStPt, measFlow, pumpPWMPctDutyCycle ); + //broadcastROPumpData( presStPt, measFlow, pumpPWMPctDutyCycle ); TODO remove roPumpDataPublicationTimerCounter = 0; } } /*********************************************************************//** * @brief - * The execROPumpTest function executes the state machine for the ROPump self test. - * @details - * Inputs : none - * Outputs : none - * @return the current state of the ROPump self test. + * The execROPumpTest function executes the state machine for the ROPump self-test. + * @details Inputs: none + * @details Outputs: none + * @return the current state of the ROPump self-test. *************************************************************************/ SELF_TEST_STATUS_T execROPumpTest( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - // TODO - implement self test(s) + // TODO - implement self-test(s) return result; } @@ -513,9 +498,8 @@ * @brief * The testSetROPumpDataPublishIntervalOverride function overrides the * RO pump data publish interval. - * @details - * Inputs : none - * Outputs : roPumpDataPublishInterval + * @details Inputs: none + * @details Outputs: roPumpDataPublishInterval * @param value override RO pump data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -539,9 +523,8 @@ * @brief * The testResetROPumpDataPublishIntervalOverride function resets the override * of the RO pump data publish interval. - * @details - * Inputs : none - * Outputs : roPumpDataPublishInterval + * @details Inputs: none + * @details Outputs: roPumpDataPublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetROPumpDataPublishIntervalOverride( void ) @@ -562,9 +545,8 @@ * @brief * The testSetTargetROPumpPressureOverride function overrides the target * RO pressure. - * @details - * Inputs : none - * Outputs : targetROPumpPressure + * @details Inputs: none + * @details Outputs: targetROPumpPressure * @param value override target RO pressure (in PSI) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -587,9 +569,8 @@ * @brief * The testResetTargetROPumpPressureOverride function resets the override of the * target RO pressure. - * @details - * Inputs : none - * Outputs : targetROPumpPressure + * @details Inputs: none + * @details Outputs: targetROPumpPressure * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetTargetROPumpPressureOverride( void ) @@ -612,9 +593,8 @@ * @brief * The testSetMeasuredROFlowRateOverride function overrides the measured * RO flow rate. - * @details - * Inputs : none - * Outputs : measuredROFlowRateLPM + * @details Inputs: none + * @details Outputs: measuredROFlowRateLPM * @param value override measured RO pump motor speed (in LPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -636,9 +616,8 @@ * @brief * The testResetMeasuredROFlowRateOverride function resets the override of the * measured RO flow rate. - * @details - * Inputs : none - * Outputs : measuredROFlowRateLPM + * @details Inputs: none + * @details Outputs: measuredROFlowRateLPM * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredROFlowRateOverride( void )