Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r9bcbb18bf62b4675ff235728d601142b1336150d -r1a685471524555a374854c0c9ec8e208e71fe2df --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 9bcbb18bf62b4675ff235728d601142b1336150d) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 1a685471524555a374854c0c9ec8e208e71fe2df) @@ -8,7 +8,7 @@ * @file DialInFlow.c * * @author (last) Sean Nash -* @date (last) 08-Sep-2020 +* @date (last) 13-Oct-2020 * * @author (original) Sean * @date (original) 16-Dec-2019 @@ -203,9 +203,8 @@ /*********************************************************************//** * @brief * The initDialInFlow function initializes the DialInFlow module. - * @details - * Inputs : none - * Outputs : DialInFlow module initialized. + * @details Inputs: none + * @details Outputs: DialInFlow module initialized. * @return none *************************************************************************/ void initDialInFlow( void ) @@ -233,9 +232,8 @@ * @brief * The setDialInPumpTargetFlowRate function sets a new target flow rate and * pump direction. - * @details - * Inputs : isDialInPumpOn, dialInPumpDirectionSet - * Outputs : targetDialInFlowRate, dialInPumpdirection, dialInPumpPWMDutyCyclePct + * @details Inputs: isDialInPumpOn, dialInPumpDirectionSet + * @details Outputs: targetDialInFlowRate, dialInPumpdirection, dialInPumpPWMDutyCyclePct * @param flowRate new target dialIn flow rate * @param dir new dialIn flow direction * @param mode new control mode @@ -300,9 +298,8 @@ /*********************************************************************//** * @brief * The signalDialInPumpHardStop function stops the dialIn pump immediately. - * @details - * Inputs : none - * Outputs : DialIn pump stopped, set point reset, state changed to off + * @details Inputs: none + * @details Outputs: DialIn pump stopped, set point reset, state changed to off * @return none *************************************************************************/ void signalDialInPumpHardStop( void ) @@ -320,9 +317,8 @@ * The signalDialInPumpRotorHallSensor function handles the dialysate inlet pump rotor * hall sensor detection. Calculates rotor speed (in RPM). Stops pump if * there is a pending request to home the pump. - * @details - * Inputs : dipRotorRevStartTime, dipStopAtHomePosition - * Outputs : dipRotorRevStartTime, dialInPumpRotorSpeedRPM + * @details Inputs: dipRotorRevStartTime, dipStopAtHomePosition + * @details Outputs: dipRotorRevStartTime, dialInPumpRotorSpeedRPM * @return none *************************************************************************/ void signalDialInPumpRotorHallSensor( void ) @@ -345,9 +341,8 @@ /*********************************************************************//** * @brief * The homeDialInPump function initiates a dialysate inlet pump home operation. - * @details - * Inputs : dialInPumpState - * Outputs : dipStopAtHomePosition, dipHomeStartTime, dialysate inlet pump started (slow) + * @details Inputs: dialInPumpState + * @details Outputs: dipStopAtHomePosition, dipHomeStartTime, dialysate inlet pump started (slow) * @return none *************************************************************************/ BOOL homeDialInPump( void ) @@ -380,9 +375,8 @@ /*********************************************************************//** * @brief * The execDialInFlowMonitor function executes the dialIn flow monitor. - * @details - * Inputs : none - * Outputs : measuredDialInFlowRate, adcDialInPumpMCSpeedRPM, adcDialInPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: measuredDialInFlowRate, adcDialInPumpMCSpeedRPM, adcDialInPumpMCCurrentmA * @return none *************************************************************************/ void execDialInFlowMonitor( void ) @@ -424,9 +418,8 @@ /*********************************************************************//** * @brief * The execDialInFlowController function executes the dialIn flow controller. - * @details - * Inputs : dialInPumpState - * Outputs : dialInPumpState + * @details Inputs: dialInPumpState + * @details Outputs: dialInPumpState * @return none *************************************************************************/ void execDialInFlowController( void ) @@ -459,9 +452,8 @@ * @brief * The handleDialInPumpOffState function handles the dialIn pump off state * of the dialIn pump controller state machine. - * @details - * Inputs : targetDialInFlowRate, dialInPumpDirection - * Outputs : dialInPumpPWMDutyCyclePctSet, dialInPumpDirectionSet, isDialInPumpOn + * @details Inputs: targetDialInFlowRate, dialInPumpDirection + * @details Outputs: dialInPumpPWMDutyCyclePctSet, dialInPumpDirectionSet, isDialInPumpOn * @return next state *************************************************************************/ static DIAL_IN_PUMP_STATE_T handleDialInPumpOffState( void ) @@ -488,9 +480,8 @@ * @brief * The handleDialInPumpRampingUpState function handles the ramp up state * of the dialIn pump controller state machine. - * @details - * Inputs : dialInPumpPWMDutyCyclePctSet - * Outputs : dialInPumpPWMDutyCyclePctSet + * @details Inputs: dialInPumpPWMDutyCyclePctSet + * @details Outputs: dialInPumpPWMDutyCyclePctSet * @return next state *************************************************************************/ static DIAL_IN_PUMP_STATE_T handleDialInPumpRampingUpState( void ) @@ -533,9 +524,8 @@ * @brief * The handleDialInPumpRampingDownState function handles the ramp down state * of the dialIn pump controller state machine. - * @details - * Inputs : dialInPumpPWMDutyCyclePctSet - * Outputs : dialInPumpPWMDutyCyclePctSet + * @details Inputs: dialInPumpPWMDutyCyclePctSet + * @details Outputs: dialInPumpPWMDutyCyclePctSet * @return next state *************************************************************************/ static DIAL_IN_PUMP_STATE_T handleDialInPumpRampingDownState( void ) @@ -576,9 +566,8 @@ * @brief * The handleDialInPumpControlToTargetState function handles the "control to * target" state of the dialIn pump controller state machine. - * @details - * Inputs : none - * Outputs : dialInPumpState + * @details Inputs: none + * @details Outputs: dialInPumpState * @return next state *************************************************************************/ static DIAL_IN_PUMP_STATE_T handleDialInPumpControlToTargetState( void ) @@ -608,9 +597,8 @@ * @brief * The setDialInPumpControlSignalPWM function sets the PWM duty cycle for * the dialysate inlet pump to a given %. - * @details - * Inputs : none - * Outputs : dialIn pump stop signal activated, PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: dialIn pump stop signal activated, PWM duty cycle zeroed * @param newPWM new duty cycle % to apply to PWM * @return none *************************************************************************/ @@ -622,9 +610,8 @@ /*********************************************************************//** * @brief * The stopDialInPump function sets the dialIn pump stop signal. - * @details - * Inputs : none - * Outputs : dialIn pump stop signal activated, PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: dialIn pump stop signal activated, PWM duty cycle zeroed * @return none *************************************************************************/ static void stopDialInPump( void ) @@ -638,9 +625,8 @@ /*********************************************************************//** * @brief * The releaseDialInPumpStop function clears the dialIn pump stop signal. - * @details - * Inputs : none - * Outputs : dialIn pump stop signal + * @details Inputs: none + * @details Outputs: dialIn pump stop signal * @return none *************************************************************************/ static void releaseDialInPumpStop( void ) @@ -652,9 +638,8 @@ * @brief * The setDialInPumpDirection function sets the set dialIn pump direction to * the given direction. - * @details - * Inputs : dialInPumpState - * Outputs : dialInPumpState + * @details Inputs: dialInPumpState + * @details Outputs: dialInPumpState * @param dir dialIn pump direction to set * @return none *************************************************************************/ @@ -682,9 +667,8 @@ * @brief * The getPublishDialInFlowDataInterval function gets the dialIn flow data * publication interval. - * @details - * Inputs : dialInFlowDataPublishInterval - * Outputs : none + * @details Inputs: dialInFlowDataPublishInterval + * @details Outputs: none * @return the current dialIn flow data publication interval (in task intervals). *************************************************************************/ U32 getPublishDialInFlowDataInterval( void ) @@ -703,9 +687,8 @@ * @brief * The getTargetDialInFlowRate function gets the current target dialIn flow * rate. - * @details - * Inputs : targetDialInFlowRate - * Outputs : none + * @details Inputs: targetDialInFlowRate + * @details Outputs: none * @return the current target dialIn flow rate (in mL/min). *************************************************************************/ S32 getTargetDialInFlowRate( void ) @@ -724,9 +707,8 @@ * @brief * The getMeasuredDialInFlowRate function gets the measured dialIn flow * rate. - * @details - * Inputs : measuredDialInFlowRate - * Outputs : none + * @details Inputs: measuredDialInFlowRate + * @details Outputs: none * @return the current dialIn flow rate (in mL/min). *************************************************************************/ F32 getMeasuredDialInFlowRate( void ) @@ -765,9 +747,8 @@ * @brief * The getMeasuredDialInPumpRotorSpeed function gets the measured dialIn flow * rate. - * @details - * Inputs : dialInPumpRotorSpeedRPM - * Outputs : none + * @details Inputs: dialInPumpRotorSpeedRPM + * @details Outputs: none * @return the current dialIn flow rate (in mL/min). *************************************************************************/ F32 getMeasuredDialInPumpRotorSpeed( void ) @@ -786,9 +767,8 @@ * @brief * The getMeasuredDialInPumpSpeed function gets the measured dialIn flow * rate. - * @details - * Inputs : dialInPumpSpeedRPM - * Outputs : none + * @details Inputs: dialInPumpSpeedRPM + * @details Outputs: none * @return the current dialIn flow rate (in mL/min). *************************************************************************/ F32 getMeasuredDialInPumpSpeed( void ) @@ -807,9 +787,8 @@ * @brief * The getMeasuredDialInPumpMCSpeed function gets the measured dialIn pump * speed. - * @details - * Inputs : adcDialInPumpMCSpeedRPM - * Outputs : none + * @details Inputs: adcDialInPumpMCSpeedRPM + * @details Outputs: none * @return the current dialIn pump speed (in RPM). *************************************************************************/ F32 getMeasuredDialInPumpMCSpeed( void ) @@ -828,9 +807,8 @@ * @brief * The getMeasuredDialInPumpMCCurrent function gets the measured dialIn pump * current. - * @details - * Inputs : adcDialInPumpMCCurrentmA - * Outputs : none + * @details Inputs: adcDialInPumpMCCurrentmA + * @details Outputs: none * @return the current dialIn pump current (in mA). *************************************************************************/ F32 getMeasuredDialInPumpMCCurrent( void ) @@ -849,10 +827,9 @@ * @brief * The publishDialInFlowData function publishes dialIn flow data at the set * interval. - * @details - * Inputs : target flow rate, measured flow rate, measured MC speed, + * @details Inputs: target flow rate, measured flow rate, measured MC speed, * measured MC current - * Outputs : DialIn flow data is published to CAN bus. + * @details Outputs: DialIn flow data is published to CAN bus. * @return none *************************************************************************/ static void publishDialInFlowData( void ) @@ -879,9 +856,8 @@ * @brief * The resetDialInFlowMovingAverage function resets the properties of the * dialIn flow moving average sample buffer. - * @details - * Inputs : none - * Outputs : flowReadingsTotal, flowReadingsIdx, flowReadingsCount all set to zero. + * @details Inputs: none + * @details Outputs: flowReadingsTotal, flowReadingsIdx, flowReadingsCount all set to zero. * @return none *************************************************************************/ static void resetDialInFlowMovingAverage( void ) @@ -895,9 +871,8 @@ /*********************************************************************//** * @brief * The filterDialInFlowReadings function adds a new flow sample to the filter. - * @details - * Inputs : none - * Outputs : flowReadings[], flowReadingsIdx, flowReadingsCount, flowReadingsTotal + * @details Inputs: none + * @details Outputs: flowReadings[], flowReadingsIdx, flowReadingsCount, flowReadingsTotal * @return none *************************************************************************/ static void filterDialInFlowReadings( F32 flow ) @@ -922,9 +897,8 @@ * The updateDialInPumpSpeedAndDirectionFromHallSensors function calculates * the dialysate inlet pump motor speed and direction from hall sensor counter on * a 1 second interval. - * @details - * Inputs : dipLastMotorHallSensorCount, dipMotorSpeedCalcTimerCtr, current count from FPGA - * Outputs : dialInPumpSpeedRPM + * @details Inputs: dipLastMotorHallSensorCount, dipMotorSpeedCalcTimerCtr, current count from FPGA + * @details Outputs: dipMotorDirectionFromHallSensors, dialInPumpSpeedRPM * @return none *************************************************************************/ static void updateDialInPumpSpeedAndDirectionFromHallSensors( void ) @@ -959,9 +933,8 @@ * The checkDialInPumpRotor function checks the rotor for the dialysate inlet * pump. If homing, this function will stop when hall sensor detected. If pump * is off or running very slowly, rotor speed will be set to zero. - * @details - * Inputs : dipStopAtHomePosition, dipHomeStartTime, dipRotorRevStartTime - * Outputs : pump may be stopped if homing, dialInPumpRotorSpeedRPM may be set to zero. + * @details Inputs: dipStopAtHomePosition, dipHomeStartTime, dipRotorRevStartTime + * @details Outputs: pump may be stopped if homing, dialInPumpRotorSpeedRPM may be set to zero. * @return none *************************************************************************/ static void checkDialInPumpRotor( void ) @@ -985,9 +958,8 @@ * @brief * The checkDialInPumpDirection function checks the set direction vs. * the direction implied by the sign of the measured MC speed. - * @details - * Inputs : adcDialInPumpMCSpeedRPM, dialInPumpDirectionSet, dialInPumpState - * Outputs : none + * @details Inputs: adcDialInPumpMCSpeedRPM, dialInPumpDirectionSet, dialInPumpState + * @details Outputs: none * @return none *************************************************************************/ static void checkDialInPumpDirection( void ) @@ -1038,9 +1010,8 @@ * 2. while pump is controlling, measured motor speed should be within allowed range of commanded speed. * 3. measured motor speed should be within allowed range of measured rotor speed. * All 3 checks have a persistence time that must be met before an alarm is triggered. - * @details - * Inputs : targetDialInFlowRate, dialInPumpSpeedRPM, dialInPumpRotorSpeedRPM - * Outputs : alarm(s) may be triggered + * @details Inputs: targetDialInFlowRate, dialInPumpSpeedRPM, dialInPumpRotorSpeedRPM + * @details Outputs: alarm(s) may be triggered * @return none *************************************************************************/ static void checkDialInPumpSpeeds( void ) @@ -1122,9 +1093,8 @@ * against the implied flow of the measured pump speed when in treatment mode * and controlling to target flow. If a sufficient difference persists, a * flow vs. motor speed check error is triggered. - * @details - * Inputs : measuredDialInFlowRate, dialInPumpSpeedRPM, errorDialInFlowVsMotorSpeedPersistTimerCtr - * Outputs : alarm may be triggered + * @details Inputs: measuredDialInFlowRate, dialInPumpSpeedRPM, errorDialInFlowVsMotorSpeedPersistTimerCtr + * @details Outputs: alarm may be triggered * @return none *************************************************************************/ static void checkDialInPumpFlowAgainstSpeed( void ) @@ -1161,9 +1131,8 @@ * @brief * The checkDialInPumpMCCurrent function checks the measured MC current vs. * the set state of the dialIn pump (stopped or running). - * @details - * Inputs : dialInPumpState, dipCurrErrorDurationCtr, adcDialInPumpMCCurrentmA - * Outputs : none + * @details Inputs: dialInPumpState, dipCurrErrorDurationCtr, adcDialInPumpMCCurrentmA + * @details Outputs: none * @return none *************************************************************************/ static void checkDialInPumpMCCurrent( void ) @@ -1238,9 +1207,8 @@ * @brief * The execDialInFlowTest function executes the state machine for the * DialInFlow self-test. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @return the current state of the DialInFlow self-test. *************************************************************************/ SELF_TEST_STATUS_T execDialInFlowTest( void ) @@ -1285,9 +1253,8 @@ * @brief * The setDialInFlowCalibration function sets the dialysate flow calibration * factors and has them stored in non-volatile memory. - * @details - * Inputs : none - * Outputs : dialInFlowCalGain, dialInFlowCalOffset + * @details Inputs: none + * @details Outputs: dialInFlowCalGain, dialInFlowCalOffset * @param gain gain calibration factor for dialysate flow sensor * @param offset offset calibration factor for dialysate flow sensor * @return TRUE if calibration factors successfully set/stored, FALSE if not @@ -1320,9 +1287,8 @@ * @brief * The getDialInFlowCalibration function retrieves the current dialysate flow * calibration factors. - * @details - * Inputs : dialInFlowCalGain, dialInFlowCalOffset - * Outputs : none + * @details Inputs: dialInFlowCalGain, dialInFlowCalOffset + * @details Outputs: none * @param gain value to populate with gain calibration factor for dialysate flow sensor * @param offset value to populate with offset calibration factor for dialysate flow sensor * @return none @@ -1337,9 +1303,8 @@ * @brief * The testSetDialInFlowDataPublishIntervalOverride function overrides the * dialIn flow data publish interval. - * @details - * Inputs : none - * Outputs : dialInFlowDataPublishInterval + * @details Inputs: none + * @details Outputs: dialInFlowDataPublishInterval * @param value override dialIn flow data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1363,9 +1328,8 @@ * @brief * The testResetDialInFlowDataPublishIntervalOverride function resets the override * of the dialIn flow data publish interval. - * @details - * Inputs : none - * Outputs : dialInFlowDataPublishInterval + * @details Inputs: none + * @details Outputs: dialInFlowDataPublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetDialInFlowDataPublishIntervalOverride( void ) @@ -1386,9 +1350,8 @@ * @brief * The testSetTargetDialInFlowRateOverride function overrides the target * dialysate inlet flow rate.n - * @details - * Inputs : none - * Outputs : targetDialInFlowRate + * @details Inputs: none + * @details Outputs: targetDialInFlowRate * @param value override target dialysate inlet flow rate (in mL/min) * @param ctrlMode override pump control mode to this mode (0 = closed loop, 1 = open loop) * @return TRUE if override successful, FALSE if not @@ -1425,9 +1388,8 @@ * @brief * The testResetTargetDialInFlowRateOverride function resets the override of the * target dialysate inlet flow rate. - * @details - * Inputs : none - * Outputs : targetDialInFlowRate + * @details Inputs: none + * @details Outputs: targetDialInFlowRate * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetTargetDialInFlowRateOverride( void ) @@ -1450,9 +1412,8 @@ * @brief * The testResetMeasuredDialInFlowRateOverride function overrides the measured * dialIn flow rate. - * @details - * Inputs : none - * Outputs : measuredDialInFlowRate + * @details Inputs: none + * @details Outputs: measuredDialInFlowRate * @param value override measured dialIn flow rate (in mL/min) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1474,9 +1435,8 @@ * @brief * The testResetMeasuredDialInFlowRateOverride function resets the override of the * measured dialIn flow rate. - * @details - * Inputs : none - * Outputs : measuredDialInFlowRate + * @details Inputs: none + * @details Outputs: measuredDialInFlowRate * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialInFlowRateOverride( void ) @@ -1497,9 +1457,8 @@ * @brief * The testSetMeasuredDialInPumpRotorSpeedOverride function overrides the measured * dialIn pump rotor speed. - * @details - * Inputs : none - * Outputs : dialInPumpRotorSpeedRPM + * @details Inputs: none + * @details Outputs: dialInPumpRotorSpeedRPM * @param value override measured dialIn pump rotor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1521,9 +1480,8 @@ * @brief * The testResetMeasuredDialInPumpRotorSpeedOverride function resets the override of the * measured dialIn pump rotor speed. - * @details - * Inputs : none - * Outputs : dialInPumpRotorSpeedRPM + * @details Inputs: none + * @details Outputs: dialInPumpRotorSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialInPumpRotorSpeedOverride( void ) @@ -1544,9 +1502,8 @@ * @brief * The testSetMeasuredDialInPumpSpeedOverride function overrides the measured * dialIn pump motor speed. - * @details - * Inputs : none - * Outputs : dialInPumpSpeedRPM + * @details Inputs: none + * @details Outputs: dialInPumpSpeedRPM * @param value override measured dialIn pump motor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1568,9 +1525,8 @@ * @brief * The testResetMeasuredDialInPumpSpeedOverride function resets the override of the * measured dialIn pump motor speed. - * @details - * Inputs : none - * Outputs : dialInPumpSpeedRPM + * @details Inputs: none + * @details Outputs: dialInPumpSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialInPumpSpeedOverride( void ) @@ -1591,9 +1547,8 @@ * @brief * The testSetMeasuredDialInPumpMCSpeedOverride function overrides the measured * dialIn pump motor speed. - * @details - * Inputs : none - * Outputs : adcDialInPumpMCSpeedRPM + * @details Inputs: none + * @details Outputs: adcDialInPumpMCSpeedRPM * @param value override measured dialIn pump speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1615,9 +1570,8 @@ * @brief * The testResetMeasuredDialInPumpMCSpeedOverride function resets the override of the * measured dialIn pump motor speed. - * @details - * Inputs : none - * Outputs : adcDialInPumpMCSpeedRPM + * @details Inputs: none + * @details Outputs: adcDialInPumpMCSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialInPumpMCSpeedOverride( void ) @@ -1638,9 +1592,8 @@ * @brief * The testSetMeasuredDialInPumpMCCurrentOverride function overrides the measured * dialIn pump motor current. - * @details - * Inputs : none - * Outputs : adcDialInPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: adcDialInPumpMCCurrentmA * @param value override measured dialIn pump current (in mA) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1662,9 +1615,8 @@ * @brief * The testResetMeasuredDialInPumpMCCurrentOverride function resets the override of the * measured dialIn pump motor current. - * @details - * Inputs : none - * Outputs : adcDialInPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: adcDialInPumpMCCurrentmA * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialInPumpMCCurrentOverride( void )