Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r6174d100ec62372d3821e6f7c4a2698a7996c306 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 6174d100ec62372d3821e6f7c4a2698a7996c306) @@ -67,7 +67,7 @@ #define DIP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< motor controller current should not exceed this when pump should be stopped #define DIP_MIN_CURR_WHEN_RUNNING_MA 150.0 ///< motor controller current should always exceed this when pump should be running -#define DIP_MAX_CURR_WHEN_RUNNING_MA 1000.0 ///< motor controller current should not exceed this when pump should be running +#define DIP_MAX_CURR_WHEN_RUNNING_MA 2000.0 ///< motor controller current should not exceed this when pump should be running #define DIP_MAX_CURR_ERROR_DURATION_MS 2000 ///< motor controller current errors persisting beyond this duration will trigger an alarm #define DIP_SPEED_ADC_TO_RPM_FACTOR 1.280938 ///< conversion factor from ADC counts to RPM for dialIn pump motor @@ -190,9 +190,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 ) @@ -215,9 +214,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 @@ -282,9 +280,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 ) @@ -302,9 +299,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 ) @@ -327,9 +323,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 ) @@ -349,9 +344,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 ) @@ -389,9 +383,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 ) @@ -424,9 +417,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 ) @@ -453,9 +445,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 ) @@ -498,9 +489,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 ) @@ -541,9 +531,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 ) @@ -573,9 +562,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 *************************************************************************/ @@ -587,9 +575,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 ) @@ -603,9 +590,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 ) @@ -617,9 +603,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 *************************************************************************/ @@ -647,9 +632,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 ) @@ -668,9 +652,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 ) @@ -689,9 +672,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 ) @@ -710,9 +692,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 ) @@ -731,9 +712,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 ) @@ -752,9 +732,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 ) @@ -773,9 +752,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 ) @@ -794,10 +772,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 ) @@ -821,9 +798,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 ) @@ -837,9 +813,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 ) @@ -864,9 +839,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 : dipMotorDirectionFromHallSensors, dialInPumpSpeedRPM + * @details Inputs: dipLastMotorHallSensorCount, dipMotorSpeedCalcTimerCtr, current count from FPGA + * @details Outputs: dipMotorDirectionFromHallSensors, dialInPumpSpeedRPM * @return none *************************************************************************/ static void updateDialInPumpSpeedAndDirectionFromHallSensors( void ) @@ -903,9 +877,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 ) @@ -929,9 +902,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 ) @@ -959,9 +931,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 ) @@ -1043,9 +1014,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 ) @@ -1082,9 +1052,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 ) @@ -1135,9 +1104,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 ) @@ -1182,9 +1150,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 @@ -1217,9 +1184,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 @@ -1234,9 +1200,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 *************************************************************************/ @@ -1260,9 +1225,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 ) @@ -1283,9 +1247,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 @@ -1322,9 +1285,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 ) @@ -1347,9 +1309,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 *************************************************************************/ @@ -1371,9 +1332,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 ) @@ -1394,9 +1354,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 *************************************************************************/ @@ -1418,9 +1377,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 ) @@ -1441,9 +1399,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 *************************************************************************/ @@ -1465,9 +1422,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 ) @@ -1488,9 +1444,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 *************************************************************************/ @@ -1512,9 +1467,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 ) @@ -1535,9 +1489,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 *************************************************************************/ @@ -1559,9 +1512,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 )