Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -rb03a3ed91ebe15cfb419e34018f8fe600e744b4b --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision b03a3ed91ebe15cfb419e34018f8fe600e744b4b) @@ -36,7 +36,7 @@ // ********** private definitiions *********** -#define TARGET_BLOOD_PRIME_VOLUME_ML 300.0 ///< Target blood prime volume to prime the blood side circuit (in mL). +#define TUBING_BLOOD_PRIME_VOLUME_ML 80.0 ///< Target blood prime volume to prime the blood side circuit (in mL). #define MAX_BLOOD_PRIME_VOLUME_ERROR_ML 60.0 ///< Maximum error in total additional blood prime volume (20% of total). #define MIN_RAMP_TIME_SEC 60 ///< Minimum ramp time for blood prime (in seconds). @@ -58,6 +58,7 @@ static F32 bloodPrimeRampFlowRate_mL_min; ///< Current blood pump ramp flow rate. static F32 bloodPrimeRampStep_mL; ///< Blood pump volume step size for ramping. +static F32 bloodPrimeTargetVolume_mL = 300.0; ///< Calculated target blood prime volume (based on selected dialyzer and fixed tubing volume). static U32 bloodPrimeRampControlTimerCtr; ///< Timer counter for determining interval for controlling BP ramp. static U32 bloodPrimePublishTimerCtr; ///< Timer counter for determining interval for blood prime status to be published. @@ -94,6 +95,7 @@ expectedBloodPrimeVolume_mL = 0.0; resetBloodPrimeFlags(); + bloodPrimeTargetVolume_mL = (F32)TUBING_BLOOD_PRIME_VOLUME_ML + (F32)getDialyzerBloodVolume(); bloodPrimeRampFlowRate_mL_min = (F32)BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN; // Calculate BP ramp step size if ( setBPRate <= BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN ) @@ -103,7 +105,7 @@ else { F32 rampRateSpan = (F32)( setBPRate - BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN ); - F32 estRampSeconds = ( ( TARGET_BLOOD_PRIME_VOLUME_ML / (F32)setBPRate + TARGET_BLOOD_PRIME_VOLUME_ML / (F32)BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN ) / 2.0 ) * (F32)SEC_PER_MIN; + F32 estRampSeconds = ( ( bloodPrimeTargetVolume_mL / (F32)setBPRate + bloodPrimeTargetVolume_mL / (F32)BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN ) / 2.0 ) * (F32)SEC_PER_MIN; if ( estRampSeconds < (F32)MIN_RAMP_TIME_SEC ) { @@ -225,7 +227,7 @@ expectedBloodPrimeVolume_mL += ( (F32)getTargetBloodFlowRate() * BLOOD_PRIME_FLOW_INTEGRATOR ); // Has blood prime completed? - if ( getBloodPrimeVolume() >= TARGET_BLOOD_PRIME_VOLUME_ML ) + if ( getBloodPrimeVolume() >= bloodPrimeTargetVolume_mL ) { initBloodPrime(); // Reset blood prime so that we start anew next time we transition to this sub-mode setBloodIsPrimed( TRUE ); // Signal treatment mode that blood prime is completed @@ -287,7 +289,7 @@ BLOOD_PRIME_DATA_PAYLOAD_T data; bloodPrimePublishTimerCtr = 0; - data.targetBloodPrimeVolumeMl = TARGET_BLOOD_PRIME_VOLUME_ML; + data.targetBloodPrimeVolumeMl = bloodPrimeTargetVolume_mL; data.deliveredBloodPrimeVolumeMl = getBloodPrimeVolume(); data.unused = 0.0; // TODO - remove later when UI no longer looking for this field. broadcastData( MSG_ID_HD_BLOOD_PRIME_PROGRESS, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( BLOOD_PRIME_DATA_PAYLOAD_T ) );