Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r036a75d76ab01912646a480b935d97187a231a19 -r794a0f21a465227d432a91d7b7fd7d513cfe3ecb --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 036a75d76ab01912646a480b935d97187a231a19) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 794a0f21a465227d432a91d7b7fd7d513cfe3ecb) @@ -135,9 +135,7 @@ static U32 bpControlTimerCounter; ///< Determines when to perform control on blood flow. -static U32 bpRotorRevStartTime; ///< Blood pump rotor rotation start time (in ms). static OVERRIDE_U32_T bloodPumpRotorCounter; ///< Running counter for blood pump rotor revolutions. -static U32 bpRotorSpeedTooFastPulseCount; ///< Counter for rotor pulses indicating RPM > 100. static BOOL bpStopAtHomePosition; ///< Stop blood pump at next home position. static U32 bpHomeStartTime; ///< When did blood pump home command begin? (in ms). @@ -185,7 +183,6 @@ bloodPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; bpControlTimerCounter = 0; bloodFlowDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; - bpRotorRevStartTime = 0; bpHomeStartTime = 0; bpStopAtHomePosition = FALSE; @@ -367,46 +364,6 @@ /*********************************************************************//** * @brief - * 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 \b Inputs: bpRotorRevStartTime, bpStopAtHomePosition - * @details \b Outputs: bpRotorRevStartTime, bloodPumpRotorSpeedRPM, bloodPumpRotorCounter - * @return none - *************************************************************************/ -void signalBloodPumpRotorHallSensor( void ) -{ - U32 rotTime = getMSTimerCount(); - U32 deltaTime = calcTimeBetween( bpRotorRevStartTime, rotTime ); - F32 rotSpeed = ( 1.0F / (F32)deltaTime ) * (F32)MS_PER_SECOND * (F32)SEC_PER_MIN; // calculate rotor speed indicating by time between this and previous pulse - - // Increment rotor counter - bloodPumpRotorCounter.data++; - - // Count pulses indicating rotor speed too fast - if ( getMeasuredBloodPumpRotorSpeed() > BP_MAX_ROTOR_SPEED_RPM ) - { - bpRotorSpeedTooFastPulseCount++; - } - else - { - bpRotorSpeedTooFastPulseCount = 0; - } - - // Calculate rotor speed (in RPM) - bloodPumpRotorSpeedRPM.data = rotSpeed; - bpRotorRevStartTime = rotTime; - - // If we are supposed to stop pump at home position, stop pump now. - if ( TRUE == bpStopAtHomePosition ) - { - signalBloodPumpHardStop(); - bpStopAtHomePosition = FALSE; - } -} - -/*********************************************************************//** - * @brief * The homeBloodPump function initiates a blood pump home operation. * @details \b Inputs: bloodPumpState * @details \b Outputs: bpStopAtHomePosition, bpHomeStartTime, blood pump started (slow) @@ -510,6 +467,9 @@ // Update pump feedback from FPGA readPeristalticPumps(); + // Update rotor RPM + bloodPumpRotorSpeedRPM.data = getPeristalticPumpMeasRotorSpeed(); + // adcBloodPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpRPM)) * BP_SPEED_ADC_TO_RPM_FACTOR; // adcBloodPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpmA)) * BP_CURRENT_ADC_TO_MA_FACTOR;