Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rd6647f4f9a7965625fa77af14142188d528f83bb -rcc83f1a731c6e5d149bd2822dc0ae45463295c5a --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision d6647f4f9a7965625fa77af14142188d528f83bb) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision cc83f1a731c6e5d149bd2822dc0ae45463295c5a) @@ -306,7 +306,13 @@ { resetBloodPumpRPMMovingAverage(); targetBloodFlowRate = dirFlowRate; - bloodPumpDirectionSet = dir; + + // This is for Preserving the current direction while ramping down to a stop. A zero request does not represent a new direction. + if ( flowRate != 0 ) + { + bloodPumpDirectionSet = dir; + } + bloodPumpControlMode = mode; bloodPumpRampToSpeedRPM = BP_RPM_FROM_RATE( flowRate ); @@ -1040,6 +1046,12 @@ F32 frequencyHz = 1.0F / torqueResolutionS; F32 frequencyKHz = frequencyHz / (F32)HZ_PER_KHZ; torquemNm = frequencyKHz * BP_1KHZ_TO_TORQUE_CONVERSION_MNM; + + // This FPGA torque count provides torque magnitude only and applies the measured H4 speed direction to the reported torque. + if( getPeristalticPumpMeasSpeed() < 0.0F ) + { + torquemNm *= -1.0F; + } } return torquemNm;