Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r9bcbb18bf62b4675ff235728d601142b1336150d -r1a685471524555a374854c0c9ec8e208e71fe2df --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 9bcbb18bf62b4675ff235728d601142b1336150d) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 1a685471524555a374854c0c9ec8e208e71fe2df) @@ -8,7 +8,7 @@ * @file BloodFlow.c * * @author (last) Sean Nash -* @date (last) 08-Sep-2020 +* @date (last) 13-Oct-2020 * * @author (original) Sean Nash * @date (original) 07-Nov-2019 @@ -211,9 +211,8 @@ /*********************************************************************//** * @brief * The initBloodFlow function initializes the BloodFlow module. - * @details - * Inputs : none - * Outputs : BloodFlow module initialized. + * @details Inputs: none + * @details Outputs: BloodFlow module initialized. * @return none *************************************************************************/ void initBloodFlow( void ) @@ -241,9 +240,8 @@ * @brief * The setBloodPumpTargetFlowRate function sets a new target flow rate and * pump direction. - * @details - * Inputs : isBloodPumpOn, bloodPumpDirectionSet - * Outputs : targetBloodFlowRate, bloodPumpdirection, bloodPumpPWMDutyCyclePct + * @details Inputs: isBloodPumpOn, bloodPumpDirectionSet + * @details Outputs: targetBloodFlowRate, bloodPumpdirection, bloodPumpPWMDutyCyclePct * @param flowRate new target blood flow rate * @param dir new blood flow direction * @param mode new control mode @@ -308,9 +306,8 @@ /*********************************************************************//** * @brief * The signalBloodPumpHardStop function stops the blood pump immediately. - * @details - * Inputs : none - * Outputs : Blood pump stopped, set point reset, state changed to off + * @details Inputs: none + * @details Outputs: Blood pump stopped, set point reset, state changed to off * @return none *************************************************************************/ void signalBloodPumpHardStop( void ) @@ -328,9 +325,8 @@ * The signalBloodPumpRotorHallSensor function handles the blood pump rotor * hall sensor detection. Calculates rotor speed (in RPM). Stops pump if * there is a pending request to home the pump. - * @details - * Inputs : bpRotorRevStartTime, bpStopAtHomePosition - * Outputs : bpRotorRevStartTime, bloodPumpRotorSpeedRPM + * @details Inputs: bpRotorRevStartTime, bpStopAtHomePosition + * @details Outputs: bpRotorRevStartTime, bloodPumpRotorSpeedRPM * @return none *************************************************************************/ void signalBloodPumpRotorHallSensor( void ) @@ -356,9 +352,8 @@ /*********************************************************************//** * @brief * The homeBloodPump function initiates a blood pump home operation. - * @details - * Inputs : bloodPumpState - * Outputs : bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) + * @details Inputs: bloodPumpState + * @details Outputs: bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) * @return none *************************************************************************/ BOOL homeBloodPump( void ) @@ -417,9 +412,8 @@ /*********************************************************************//** * @brief * The execBloodFlowMonitor function executes the blood flow monitor. - * @details - * Inputs : none - * Outputs : measuredBloodFlowRate, adcBloodPumpMCSpeedRPM, adcBloodPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: measuredBloodFlowRate, adcBloodPumpMCSpeedRPM, adcBloodPumpMCCurrentmA * @return none *************************************************************************/ void execBloodFlowMonitor( void ) @@ -461,9 +455,8 @@ /*********************************************************************//** * @brief * The execBloodFlowController function executes the blood flow controller. - * @details - * Inputs : bloodPumpState - * Outputs : bloodPumpState + * @details Inputs: bloodPumpState + * @details Outputs: bloodPumpState * @return none *************************************************************************/ void execBloodFlowController( void ) @@ -496,9 +489,8 @@ * @brief * The handleBloodPumpOffState function handles the blood pump off state * of the blood pump controller state machine. - * @details - * Inputs : targetBloodFlowRate, bloodPumpDirection - * Outputs : bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet, isBloodPumpOn + * @details Inputs: targetBloodFlowRate, bloodPumpDirection + * @details Outputs: bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet, isBloodPumpOn * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpOffState( void ) @@ -525,9 +517,8 @@ * @brief * The handleBloodPumpRampingUpState function handles the ramp up state * of the blood pump controller state machine. - * @details - * Inputs : bloodPumpPWMDutyCyclePctSet - * Outputs : bloodPumpPWMDutyCyclePctSet + * @details Inputs: bloodPumpPWMDutyCyclePctSet + * @details Outputs: bloodPumpPWMDutyCyclePctSet * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpRampingUpState( void ) @@ -570,9 +561,8 @@ * @brief * The handleBloodPumpRampingDownState function handles the ramp down state * of the blood pump controller state machine. - * @details - * Inputs : bloodPumpPWMDutyCyclePctSet - * Outputs : bloodPumpPWMDutyCyclePctSet + * @details Inputs: bloodPumpPWMDutyCyclePctSet + * @details Outputs: bloodPumpPWMDutyCyclePctSet * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpRampingDownState( void ) @@ -613,9 +603,8 @@ * @brief * The handleBloodPumpControlToTargetState function handles the "control to * target" state of the blood pump controller state machine. - * @details - * Inputs : none - * Outputs : bloodPumpState + * @details Inputs: none + * @details Outputs: bloodPumpState * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpControlToTargetState( void ) @@ -645,9 +634,8 @@ * @brief * The setBloodPumpControlSignalPWM function sets the PWM duty cycle for * the blood pump to a given %. - * @details - * Inputs : none - * Outputs : blood pump stop signal activated, PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: blood pump stop signal activated, PWM duty cycle zeroed * @param newPWM new duty cycle % to apply to PWM * @return none *************************************************************************/ @@ -659,9 +647,8 @@ /*********************************************************************//** * @brief * The stopBloodPump function sets the blood pump stop signal. - * @details - * Inputs : none - * Outputs : blood pump stop signal activated, PWM duty cycle zeroed + * @details Inputs: none + * @details Outputs: blood pump stop signal activated, PWM duty cycle zeroed * @return none *************************************************************************/ static void stopBloodPump( void ) @@ -675,9 +662,8 @@ /*********************************************************************//** * @brief * The releaseBloodPumpStop function clears the blood pump stop signal. - * @details - * Inputs : none - * Outputs : blood pump stop signal + * @details Inputs: none + * @details Outputs: blood pump stop signal * @return none *************************************************************************/ static void releaseBloodPumpStop( void ) @@ -689,9 +675,8 @@ * @brief * The setBloodPumpDirection function sets the set blood pump direction to * the given direction. - * @details - * Inputs : bloodPumpState - * Outputs : bloodPumpState + * @details Inputs: bloodPumpState + * @details Outputs: bloodPumpState * @param dir blood pump direction to set * @return none *************************************************************************/ @@ -719,9 +704,8 @@ * @brief * The getPublishBloodFlowDataInterval function gets the blood flow data * publication interval. - * @details - * Inputs : bloodFlowDataPublishInterval - * Outputs : none + * @details Inputs: bloodFlowDataPublishInterval + * @details Outputs: none * @return the current blood flow data publication interval (in task intervals). *************************************************************************/ U32 getPublishBloodFlowDataInterval( void ) @@ -740,9 +724,8 @@ * @brief * The getTargetBloodFlowRate function gets the current target blood flow * rate. - * @details - * Inputs : targetBloodFlowRate - * Outputs : none + * @details Inputs: targetBloodFlowRate + * @details Outputs: none * @return the current target blood flow rate (in mL/min). *************************************************************************/ S32 getTargetBloodFlowRate( void ) @@ -761,9 +744,8 @@ * @brief * The getMeasuredBloodFlowRate function gets the measured blood flow * rate. - * @details - * Inputs : measuredBloodFlowRate - * Outputs : none + * @details Inputs: measuredBloodFlowRate + * @details Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodFlowRate( void ) @@ -802,9 +784,8 @@ * @brief * The getMeasuredBloodPumpRotorSpeed function gets the measured blood flow * rate. - * @details - * Inputs : bloodPumpRotorSpeedRPM - * Outputs : none + * @details Inputs: bloodPumpRotorSpeedRPM + * @details Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodPumpRotorSpeed( void ) @@ -823,9 +804,8 @@ * @brief * The getMeasuredBloodPumpSpeed function gets the measured blood flow * rate. - * @details - * Inputs : bloodPumpSpeedRPM - * Outputs : none + * @details Inputs: bloodPumpSpeedRPM + * @details Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodPumpSpeed( void ) @@ -844,9 +824,8 @@ * @brief * The getMeasuredBloodPumpMCSpeed function gets the measured blood pump * speed. - * @details - * Inputs : adcBloodPumpMCSpeedRPM - * Outputs : none + * @details Inputs: adcBloodPumpMCSpeedRPM + * @details Outputs: none * @return the current blood pump speed (in RPM). *************************************************************************/ F32 getMeasuredBloodPumpMCSpeed( void ) @@ -865,9 +844,8 @@ * @brief * The getMeasuredBloodPumpMCCurrent function gets the measured blood pump * current. - * @details - * Inputs : adcBloodPumpMCCurrentmA - * Outputs : none + * @details Inputs: adcBloodPumpMCCurrentmA + * @details Outputs: none * @return the current blood pump current (in mA). *************************************************************************/ F32 getMeasuredBloodPumpMCCurrent( void ) @@ -886,10 +864,9 @@ * @brief * The publishBloodFlowData function publishes blood 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 : Blood flow data is published to CAN bus. + * @details Outputs: Blood flow data is published to CAN bus. * @return none *************************************************************************/ static void publishBloodFlowData( void ) @@ -916,9 +893,8 @@ * @brief * The resetBloodFlowMovingAverage function re-initializes the blood 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 resetBloodFlowMovingAverage( void ) @@ -932,9 +908,8 @@ /*********************************************************************//** * @brief * The filterBloodFlowReadings 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 * @param flow newest blood flow sample * @return none *************************************************************************/ @@ -960,9 +935,8 @@ * The updateBloodPumpSpeedAndDirectionFromHallSensors function calculates * the blood pump motor speed and direction from hall sensor counter on * a 1 second interval. - * @details - * Inputs : bpLastMotorHallSensorCount, bpMotorSpeedCalcTimerCtr, current count from FPGA - * Outputs : bloodPumpSpeedRPM + * @details Inputs: bpLastMotorHallSensorCount, bpMotorSpeedCalcTimerCtr, current count from FPGA + * @details Outputs: bpMotorDirectionFromHallSensors, bloodPumpSpeedRPM * @return none *************************************************************************/ static void updateBloodPumpSpeedAndDirectionFromHallSensors( void ) @@ -998,9 +972,8 @@ * The checkBloodPumpRotor function checks the rotor for the blood * 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 : bpStopAtHomePosition, bpHomeStartTime, bpRotorRevStartTime - * Outputs : pump may be stopped if homing, bloodPumpRotorSpeedRPM may be set to zero. + * @details Inputs: bpStopAtHomePosition, bpHomeStartTime, bpRotorRevStartTime + * @details Outputs: pump may be stopped if homing, bloodPumpRotorSpeedRPM may be set to zero. * @return none *************************************************************************/ static void checkBloodPumpRotor( void ) @@ -1039,9 +1012,8 @@ * @brief * The checkBloodPumpDirection function checks the set direction vs. * the direction implied by the sign of the measured MC speed. - * @details - * Inputs : - * Outputs : + * @details Inputs: + * @details Outputs: * @return none *************************************************************************/ static void checkBloodPumpDirection( void ) @@ -1092,9 +1064,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 : targetBloodFlowRate, bloodPumpSpeedRPM, bloodPumpRotorSpeedRPM - * Outputs : alarm(s) may be triggered + * @details Inputs: targetBloodFlowRate, bloodPumpSpeedRPM, bloodPumpRotorSpeedRPM + * @details Outputs: alarm(s) may be triggered * @return none *************************************************************************/ static void checkBloodPumpSpeeds( void ) @@ -1176,9 +1147,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 : measuredBloodFlowRate, bloodPumpSpeedRPM, errorBloodFlowVsMotorSpeedPersistTimerCtr - * Outputs : alarm may be triggered + * @details Inputs: measuredBloodFlowRate, bloodPumpSpeedRPM, errorBloodFlowVsMotorSpeedPersistTimerCtr + * @details Outputs: alarm may be triggered * @return none *************************************************************************/ static void checkBloodPumpFlowAgainstSpeed( void ) @@ -1215,9 +1185,8 @@ * @brief * The checkBloodPumpMCCurrent function checks the measured MC current vs. * the set state of the blood pump (stopped or running). - * @details - * Inputs : - * Outputs : + * @details Inputs: + * @details Outputs: * @return none *************************************************************************/ static void checkBloodPumpMCCurrent( void ) @@ -1292,9 +1261,8 @@ * @brief * The execBloodFlowTest function executes the state machine for the * BloodFlow self-test. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @return the current state of the BloodFlow self-test. *************************************************************************/ SELF_TEST_STATUS_T execBloodFlowTest( void ) @@ -1339,9 +1307,8 @@ * @brief * The setBloodFlowCalibration function sets the blood flow calibration * factors and has them stored in non-volatile memory. - * @details - * Inputs : none - * Outputs : bloodFlowCalGain, bloodFlowCalOffset + * @details Inputs: none + * @details Outputs: bloodFlowCalGain, bloodFlowCalOffset * @param gain gain calibration factor for blood flow sensor * @param offset offset calibration factor for blood flow sensor * @return TRUE if calibration factors successfully set/stored, FALSE if not @@ -1374,9 +1341,8 @@ * @brief * The getBloodFlowCalibration function retrieves the current blood flow * calibration factors. - * @details - * Inputs : bloodFlowCalGain, bloodFlowCalOffset - * Outputs : none + * @details Inputs: bloodFlowCalGain, bloodFlowCalOffset + * @details Outputs: none * @param gain value to populate with gain calibration factor for blood flow sensor * @param offset value to populate with offset calibration factor for blood flow sensor * @return none @@ -1391,9 +1357,8 @@ * @brief * The testSetBloodFlowDataPublishIntervalOverride function overrides the * blood flow data publish interval. - * @details - * Inputs : none - * Outputs : bloodFlowDataPublishInterval + * @details Inputs: none + * @details Outputs: bloodFlowDataPublishInterval * @param value override blood flow data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1417,9 +1382,8 @@ * @brief * The testResetBloodFlowDataPublishIntervalOverride function resets the override * of the blood flow data publish interval. - * @details - * Inputs : none - * Outputs : bloodFlowDataPublishInterval + * @details Inputs: none + * @details Outputs: bloodFlowDataPublishInterval * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetBloodFlowDataPublishIntervalOverride( void ) @@ -1440,9 +1404,8 @@ * @brief * The testSetTargetBloodFlowRateOverride function overrides the target * blood flow rate. - * @details - * Inputs : none - * Outputs : targetBloodFlowRate + * @details Inputs: none + * @details Outputs: targetBloodFlowRate * @param value override target blood 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 @@ -1479,9 +1442,8 @@ * @brief * The testResetTargetBloodFlowRateOverride function resets the override of the * target blood flow rate. - * @details - * Inputs : none - * Outputs : targetBloodFlowRate + * @details Inputs: none + * @details Outputs: targetBloodFlowRate * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetTargetBloodFlowRateOverride( void ) @@ -1504,9 +1466,8 @@ * @brief * The testResetMeasuredBloodFlowRateOverride function overrides the measured * blood flow rate. - * @details - * Inputs : none - * Outputs : measuredBloodFlowRate + * @details Inputs: none + * @details Outputs: measuredBloodFlowRate * @param value override measured blood flow rate (in mL/min) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1528,9 +1489,8 @@ * @brief * The testResetOffButtonStateOverride function resets the override of the * measured blood flow rate. - * @details - * Inputs : none - * Outputs : measuredBloodFlowRate + * @details Inputs: none + * @details Outputs: measuredBloodFlowRate * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredBloodFlowRateOverride( void ) @@ -1551,9 +1511,8 @@ * @brief * The testSetMeasuredBloodPumpRotorSpeedOverride function overrides the measured * blood pump rotor speed. - * @details - * Inputs : none - * Outputs : bloodPumpRotorSpeedRPM + * @details Inputs: none + * @details Outputs: bloodPumpRotorSpeedRPM * @param value override measured blood pump rotor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1575,9 +1534,8 @@ * @brief * The testResetMeasuredBloodPumpRotorSpeedOverride function resets the override of the * measured blood pump rotor speed. - * @details - * Inputs : none - * Outputs : bloodPumpRotorSpeedRPM + * @details Inputs: none + * @details Outputs: bloodPumpRotorSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredBloodPumpRotorSpeedOverride( void ) @@ -1598,9 +1556,8 @@ * @brief * The testSetMeasuredBloodPumpSpeedOverride function overrides the measured * blood pump motor speed. - * @details - * Inputs : none - * Outputs : bloodPumpSpeedRPM + * @details Inputs: none + * @details Outputs: bloodPumpSpeedRPM * @param value override measured blood pump motor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1622,9 +1579,8 @@ * @brief * The testResetMeasuredBloodPumpSpeedOverride function resets the override of the * measured blood pump motor speed. - * @details - * Inputs : none - * Outputs : bloodPumpSpeedRPM + * @details Inputs: none + * @details Outputs: bloodPumpSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredBloodPumpSpeedOverride( void ) @@ -1645,9 +1601,8 @@ * @brief * The testSetMeasuredBloodPumpMCSpeedOverride function overrides the measured * blood pump motor speed. - * @details - * Inputs : none - * Outputs : adcBloodPumpMCSpeedRPM + * @details Inputs: none + * @details Outputs: adcBloodPumpMCSpeedRPM * @param value override measured blood pump speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1669,9 +1624,8 @@ * @brief * The testResetMeasuredBloodPumpMCSpeedOverride function resets the override of the * measured blood pump motor speed. - * @details - * Inputs : none - * Outputs : adcBloodPumpMCSpeedRPM + * @details Inputs: none + * @details Outputs: adcBloodPumpMCSpeedRPM * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredBloodPumpMCSpeedOverride( void ) @@ -1692,9 +1646,8 @@ * @brief * The testSetMeasuredBloodPumpMCCurrentOverride function overrides the measured * blood pump motor current. - * @details - * Inputs : none - * Outputs : adcBloodPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: adcBloodPumpMCCurrentmA * @param value override measured blood pump current (in mA) * @return TRUE if override successful, FALSE if not *************************************************************************/ @@ -1716,9 +1669,8 @@ * @brief * The testResetMeasuredBloodPumpMCCurrentOverride function resets the override of the * measured blood pump motor current. - * @details - * Inputs : none - * Outputs : adcBloodPumpMCCurrentmA + * @details Inputs: none + * @details Outputs: adcBloodPumpMCCurrentmA * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredBloodPumpMCCurrentOverride( void )