Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r051326e2671e8d5b3e99eaa109ea549e94a929f3 -r73c034866d138a0b07f27b76530676dd4fa45eeb --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 051326e2671e8d5b3e99eaa109ea549e94a929f3) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 73c034866d138a0b07f27b76530676dd4fa45eeb) @@ -55,8 +55,8 @@ #define BP_MAX_ROTOR_SPEED_RPM 100.0F ///< Maximum rotor speed allowed for blood pump. -#define BP_MAX_FLOW_RATE 1320.0F ///< Maximum measured BP flow rate allowed. -#define BP_MIN_FLOW_RATE -1320.0F ///< Minimum measured BP flow rate allowed. +#define BP_MAX_FLOW_RATE 1320.0F ///< Maximum measured BP flow rate alarm threshold. +#define BP_MIN_FLOW_RATE -1320.0F ///< Minimum measured BP flow rate alarm threshold. #define BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0F ///< Maximum motor speed (RPM) while motor is commanded off. #define BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0F ///< Maximum difference in speed between motor and rotor (in rotor RPM). #define BP_MAX_MOTOR_SPEED_ERROR_RPM 300.0F ///< Maximum difference in speed between measured and commanded RPM. @@ -161,8 +161,8 @@ /*********************************************************************//** * @brief * The initBloodFlow function initializes the BloodFlow unit. - * @details Inputs: none - * @details Outputs: Blood flow unit initialized + * @details \b Inputs: none + * @details \b Outputs: Blood flow unit initialized * @return none *************************************************************************/ void initBloodFlow( void ) @@ -234,8 +234,9 @@ * @brief * The setBloodPumpTargetFlowRate function sets a new target flow rate and * pump direction. - * @details Inputs: isBloodPumpOn, bloodPumpDirectionSet - * @details Outputs: targetBloodFlowRate, bloodPumpdirection, bloodPumpPWMDutyCyclePct + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if requested flow rate is too high. + * @details \b Inputs: isBloodPumpOn, bloodPumpDirectionSet + * @details \b Outputs: targetBloodFlowRate, bloodPumpdirection, bloodPumpPWMDutyCyclePct * @param flowRate new target blood flow rate * @param dir new blood flow direction * @param mode new control mode @@ -305,8 +306,8 @@ * @brief * The setBloodPumpTargetRPM function sets a new target pump speed and pump * direction. Pump is set to open loop control. - * @details Inputs: none - * @details Outputs: none + * @details \b Inputs: none + * @details \b Outputs: none * @param rpm new target blood pump speed (in RPM) * @param dir new blood flow direction * @return TRUE if new flow rate & direction are set, FALSE if not @@ -325,8 +326,8 @@ * The calcBloodFlow function calculates an estimated blood flow rate from * blood pump speed, arterial pressure and tubing wear (measured from count * of rotor revolutions since cartridge install). - * @details Inputs: bloodPumpRotorCounter, arterial pressure - * @details Outputs: none + * @details \b Inputs: bloodPumpRotorCounter, arterial pressure + * @details \b Outputs: none * @return calculated blood flow rate (mL/min) *************************************************************************/ static F32 calcBloodFlow( void ) @@ -346,8 +347,8 @@ /*********************************************************************//** * @brief * The signalBloodPumpHardStop function stops the blood pump immediately. - * @details Inputs: none - * @details Outputs: Blood pump stopped, set point reset, state changed to off + * @details \b Inputs: none + * @details \b Outputs: Blood pump stopped, set point reset, state changed to off * @return none *************************************************************************/ void signalBloodPumpHardStop( void ) @@ -365,8 +366,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 - * @details Outputs: bpRotorRevStartTime, bloodPumpRotorSpeedRPM, bloodPumpRotorCounter + * @details \b Inputs: bpRotorRevStartTime, bpStopAtHomePosition + * @details \b Outputs: bpRotorRevStartTime, bloodPumpRotorSpeedRPM, bloodPumpRotorCounter * @return none *************************************************************************/ void signalBloodPumpRotorHallSensor( void ) @@ -403,8 +404,8 @@ /*********************************************************************//** * @brief * The homeBloodPump function initiates a blood pump home operation. - * @details Inputs: bloodPumpState - * @details Outputs: bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) + * @details \b Inputs: bloodPumpState + * @details \b Outputs: bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) * @return none *************************************************************************/ BOOL homeBloodPump( void ) @@ -425,8 +426,8 @@ * @brief * The getBloodPumpRotorCount function returns the current count for the * blood pump rotor revolution counter. - * @details Inputs: bloodPumpRotorCounter - * @details Outputs: none + * @details \b Inputs: bloodPumpRotorCounter + * @details \b Outputs: none * @return bloodPumpRotorCounter *************************************************************************/ static U32 getBloodPumpRotorCount( void ) @@ -445,8 +446,8 @@ * @brief * The isBloodPumpRunning function returns whether the blood pump is currently * running or not. - * @details Inputs: isBloodPumpOn - * @details Outputs: none + * @details \b Inputs: isBloodPumpOn + * @details \b Outputs: none * @return isBloodPumpOn *************************************************************************/ BOOL isBloodPumpRunning( void ) @@ -458,8 +459,8 @@ * @brief * The isBloodPumpRampComplete function returns whether the blood pump has * completed its ramp up and entered control state (closed or open loop). - * @details Inputs: bloodPumpState - * @details Outputs: none + * @details \b Inputs: bloodPumpState + * @details \b Outputs: none * @return TRUE if pump is in control state, FALSE if not *************************************************************************/ BOOL isBloodPumpRampComplete( void ) @@ -474,8 +475,8 @@ * The resetBloodPumpRotorCount function resets the blood pump rotor counter * that is a proxy for cartridge wear. Call this function after a new cartridge * has been installed. - * @details Inputs: none - * @details Outputs: bloodPumpRotorCounter + * @details \b Inputs: none + * @details \b Outputs: bloodPumpRotorCounter * @return none *************************************************************************/ void resetBloodPumpRotorCount( void ) @@ -491,8 +492,8 @@ /*********************************************************************//** * @brief * The execBloodFlowMonitor function executes the blood flow monitor. - * @details Inputs: none - * @details Outputs: measuredBloodFlowRate, adcBloodPumpMCSpeedRPM, + * @details \b Inputs: none + * @details \b Outputs: measuredBloodFlowRate, adcBloodPumpMCSpeedRPM, * adcBloodPumpMCCurrentmA * @return none *************************************************************************/ @@ -533,8 +534,8 @@ /*********************************************************************//** * @brief * The execBloodFlowController function executes the blood flow controller. - * @details Inputs: bloodPumpState - * @details Outputs: bloodPumpState + * @details \b Inputs: bloodPumpState + * @details \b Outputs: bloodPumpState * @return none *************************************************************************/ void execBloodFlowController( void ) @@ -571,8 +572,8 @@ * @brief * The handleBloodPumpOffState function handles the blood pump off state * of the blood pump controller state machine. - * @details Inputs: targetBloodFlowRate, bloodPumpDirection - * @details Outputs: bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet, isBloodPumpOn + * @details \b Inputs: targetBloodFlowRate, bloodPumpDirection + * @details \b Outputs: bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet, isBloodPumpOn * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpOffState( void ) @@ -602,8 +603,8 @@ * @brief * The handleBloodPumpRampingUpState function handles the ramp up state * of the blood pump controller state machine. - * @details Inputs: bloodPumpRampToSpeedRPM, bloodPumpSetSpeedRPM - * @details Outputs: bloodPumpSetSpeedRPM + * @details \b Inputs: bloodPumpRampToSpeedRPM, bloodPumpSetSpeedRPM + * @details \b Outputs: bloodPumpSetSpeedRPM * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpRampingUpState( void ) @@ -643,8 +644,8 @@ * @brief * The handleBloodPumpRampingDownState function handles the ramp down state * of the blood pump controller state machine. - * @details Inputs: bloodPumpRampToSpeedRPM, bloodPumpSetSpeedRPM - * @details Outputs: bloodPumpSetSpeedRPM + * @details \b Inputs: bloodPumpRampToSpeedRPM, bloodPumpSetSpeedRPM + * @details \b Outputs: bloodPumpSetSpeedRPM * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpRampingDownState( void ) @@ -682,8 +683,8 @@ * @brief * The handleBloodPumpControlToTargetState function handles the "control to * target" state of the blood pump controller state machine. - * @details Inputs: bloodPumpControlMode - * @details Outputs: bloodPumpState + * @details \b Inputs: bloodPumpControlMode + * @details \b Outputs: bloodPumpState * @return next state *************************************************************************/ static BLOOD_PUMP_STATE_T handleBloodPumpControlToTargetState( void ) @@ -713,8 +714,8 @@ /*********************************************************************//** * @brief * The getTargetBloodFlowRate function gets the target blood flow rate. - * @details Inputs: targetBloodFlowRate - * @details Outputs: none + * @details \b Inputs: targetBloodFlowRate + * @details \b Outputs: none * @return the current target blood flow rate (in mL/min). *************************************************************************/ S32 getTargetBloodFlowRate( void ) @@ -726,8 +727,8 @@ * @brief * The getMeasuredBloodFlowRate function gets the measured blood flow * rate. - * @details Inputs: measuredBloodFlowRate - * @details Outputs: none + * @details \b Inputs: measuredBloodFlowRate + * @details \b Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodFlowRate( void ) @@ -746,8 +747,8 @@ * @brief * The getMeasuredBloodPumpRotorSpeed function gets the measured blood flow * rate. - * @details Inputs: bloodPumpRotorSpeedRPM - * @details Outputs: none + * @details \b Inputs: bloodPumpRotorSpeedRPM + * @details \b Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodPumpRotorSpeed( void ) @@ -766,8 +767,8 @@ * @brief * The getMeasuredBloodPumpSpeed function gets the measured blood flow * rate. - * @details Inputs: bloodPumpSpeedRPM - * @details Outputs: none + * @details \b Inputs: bloodPumpSpeedRPM + * @details \b Outputs: none * @return the current blood flow rate (in mL/min). *************************************************************************/ F32 getMeasuredBloodPumpSpeed( void ) @@ -786,9 +787,10 @@ * @brief * The publishBloodFlowData function publishes blood flow data at the set * interval. - * @details Inputs: target flow rate, measured flow rate, measured MC speed, + * @details \b Message \b Sent: MSG_ID_TD_BLOOD_PUMP_DATA at set interval. + * @details \b Inputs: target flow rate, measured flow rate, measured MC speed, * measured MC current - * @details Outputs: Blood flow data is published to CAN bus. + * @details \b Outputs: Blood flow data is published to CAN bus. * @return none *************************************************************************/ static void publishBloodFlowData( void ) @@ -825,8 +827,8 @@ * @brief * The resetBloodPumpRPMMovingAverage function re-initializes the pump speed * moving average sample buffer. - * @details Inputs: none - * @details Outputs: rpmReadingsTotal, rpmReadingsIdx, rpmReadingsCount all set to zero. + * @details \b Inputs: none + * @details \b Outputs: rpmReadingsTotal, rpmReadingsIdx, rpmReadingsCount all set to zero. * @return none *************************************************************************/ static void resetBloodPumpRPMMovingAverage( void ) @@ -841,8 +843,8 @@ * @brief * The filterBloodPumpRPMReadings function adds a new pump speed sample to * the filter. - * @details Inputs: none - * @details Outputs: rpmReadings[], rpmReadingsIdx, rpmReadingsCount, rpmReadingsTotal + * @details \b Inputs: none + * @details \b Outputs: rpmReadings[], rpmReadingsIdx, rpmReadingsCount, rpmReadingsTotal * @param rpm newest blood pump speed (in RPM) sample to add to filter * @return none *************************************************************************/ @@ -864,9 +866,11 @@ * 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, + * @details \b Alarm: ALARM_ID_HD_BLOOD_PUMP_ROTOR_SPEED_TOO_HIGH if rotor speed + * is too high. + * @details \b Inputs: bpStopAtHomePosition, bpHomeStartTime, bpRotorRevStartTime, * bpRotorSpeedTooFastPulseCount - * @details Outputs: pump may be stopped if homing, bloodPumpRotorSpeedRPM may be + * @details \b Outputs: pump may be stopped if homing, bloodPumpRotorSpeedRPM may be * set to zero if too long since last pulse. * @return none *************************************************************************/ @@ -898,8 +902,9 @@ * @brief * The checkBloodPumpDirection function checks the set direction vs. * the direction implied by the sign of the measured MC speed. - * @details Inputs: - * @details Outputs: + * @details \b Alarm: + * @details \b Inputs: + * @details \b Outputs: * @return none *************************************************************************/ static void checkBloodPumpDirection( void ) @@ -920,7 +925,7 @@ // if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMP_DIRECTION_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) //#endif // { -// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_BLOOD_PUMP ) +// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_BLOOD_PUMP ) // } // } // lastBloodPumpDirectionCount = dirErrorCnt; @@ -961,8 +966,9 @@ * 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: bloodPumpState, targetBloodFlowRate, bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet - * @details Outputs: errorBloodRotorSpeedPersistTimerCtr, alarm(s) may be triggered + * @details \b Alarm: + * @details \b Inputs: bloodPumpState, targetBloodFlowRate, bloodPumpPWMDutyCyclePctSet, bloodPumpDirectionSet + * @details \b Outputs: errorBloodRotorSpeedPersistTimerCtr, alarm(s) may be triggered * @return none *************************************************************************/ static void checkBloodPumpSpeeds( void ) @@ -1036,8 +1042,8 @@ * @brief * The execBloodFlowTest function executes the state machine for the * BloodFlow self-test. - * @details Inputs: bloodPumpCalRecord - * @details Outputs: none + * @details \b Inputs: bloodPumpCalRecord + * @details \b Outputs: none * @return the current state of the BloodFlow self-test. *************************************************************************/ SELF_TEST_STATUS_T execBloodFlowTest( void ) @@ -1069,8 +1075,8 @@ * @brief * The testBloodFlowDataPublishIntervalOverride function overrides the * blood flow data publish interval. - * @details Inputs: none - * @details Outputs: bloodFlowDataPublishInterval + * @details \b Inputs: none + * @details \b Outputs: bloodFlowDataPublishInterval * @param message Override message from Dialin which includes the interval * (in ms) to override the blood pump data broadcast interval to. * @return TRUE if override successful, FALSE if not @@ -1086,8 +1092,8 @@ * @brief * The testSetTargetBloodFlowRateOverride function commands the blood pump to * run at a given flow rate (mL/min) and in a given control mode. - * @details Inputs: none - * @details Outputs: Blood pump commanded to given rate w/ given control mode. + * @details \b Inputs: none + * @details \b Outputs: Blood pump commanded to given rate w/ given control mode. * @param message set message from Dialin which includes the flow rate (mL/min) * and control mode to command the blood pump to. * @return TRUE if set command successful, FALSE if not @@ -1131,8 +1137,8 @@ * @brief * The testSetBloodPumpSpeedOverride function sets the blood pump to run * open loop at a given speed (in RPM). - * @details Inputs: none - * @details Outputs: Blood pump commanded to given rate w/ given control mode. + * @details \b Inputs: none + * @details \b Outputs: Blood pump commanded to given rate w/ given control mode. * @param message set message from Dialin which includes the pump speed (RPM) * to command the blood pump to. * @return TRUE if override successful, FALSE if not @@ -1170,8 +1176,8 @@ * @brief * The testMeasuredBloodFlowRateOverride function overrides the measured * blood flow rate. - * @details Inputs: none - * @details Outputs: measuredBloodFlowRate + * @details \b Inputs: none + * @details \b Outputs: measuredBloodFlowRate * @param message Override message from Dialin which includes the flow rate * (in mL/min) to override the measured flow rate to. * @return TRUE if override successful, FALSE if not @@ -1187,8 +1193,8 @@ * @brief * The testMeasuredBloodPumpRotorSpeedOverride function overrides the measured * blood pump rotor speed. - * @details Inputs: none - * @details Outputs: bloodPumpRotorSpeedRPM + * @details \b Inputs: none + * @details \b Outputs: bloodPumpRotorSpeedRPM * @param message Override message from Dialin which includes the pump rotor * speed (in RPM) to override the measured rotor speed to. * @return TRUE if override successful, FALSE if not @@ -1204,8 +1210,8 @@ * @brief * The testMeasuredBloodPumpSpeedOverride function overrides the measured * blood pump motor speed. - * @details Inputs: none - * @details Outputs: bloodPumpSpeedRPM + * @details \b Inputs: none + * @details \b Outputs: bloodPumpSpeedRPM * @param message Override message from Dialin which includes the pump motor * speed (in RPM) to override the measured pump speed to. * @return TRUE if override successful, FALSE if not @@ -1221,8 +1227,8 @@ * @brief * The testBloodPumpRotorCountOverride function overrides the blood pump * rotor counter value. - * @details Inputs: none - * @details Outputs: bloodPumpRotorCounter + * @details \b Inputs: none + * @details \b Outputs: bloodPumpRotorCounter * @param message Override message from Dialin which includes the count * to override the blood pump rotor count to. * @return TRUE if override successful, FALSE if not