Index: firmware/App/Modes/StateTxBloodPrime.c =================================================================== diff -u -reef41b7363d82763095a1317f1757f360f0d9ec1 -ra6d020a7797cf7fb721867eb33c8b7957da8decb --- firmware/App/Modes/StateTxBloodPrime.c (.../StateTxBloodPrime.c) (revision eef41b7363d82763095a1317f1757f360f0d9ec1) +++ firmware/App/Modes/StateTxBloodPrime.c (.../StateTxBloodPrime.c) (revision a6d020a7797cf7fb721867eb33c8b7957da8decb) @@ -70,6 +70,8 @@ static void resetBloodPrimeFlags( void ); static F32 getBloodPrimeVolume( void ); static BLOOD_PRIME_STATE_T handleBloodPrimeRampState( void ); +static BLOOD_PRIME_STATE_T handleBloodPrimeRunState( void ); +static BLOOD_PRIME_STATE_T handleBloodPrimePausedState( void ); static void publishBloodPrimeData( void ); /*********************************************************************//** @@ -194,6 +196,14 @@ bloodPrimeState = handleBloodPrimeRampState(); break; + case BLOOD_PRIME_RUN_STATE: + bloodPrimeState = handleBloodPrimeRunState(); + break; + + case BLOOD_PRIME_PAUSED_STATE: + bloodPrimeState = handleBloodPrimePausedState(); + break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_BLOOD_PRIME_INVALID_STATE, bloodPrimeState ); break; @@ -233,6 +243,7 @@ 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 signalBloodPrimeToDialysis(); // Signal treatment mode that it's time to start dialysis + result = BLOOD_PRIME_RUN_STATE; } else { @@ -252,6 +263,38 @@ /*********************************************************************//** * @brief + * The handleBloodPrimeRunState function handles the blood prime run + * state operations. + * @details \b Inputs: flags + * @details \b Outputs: flags handled + * @return next blood prime state + *************************************************************************/ +static BLOOD_PRIME_STATE_T handleBloodPrimeRunState( void ) +{ + BLOOD_PRIME_STATE_T result = BLOOD_PRIME_RUN_STATE; + + cumulativeBloodPrimeVolume_mL.data += ( getMeasuredBloodFlowRate() * BLOOD_PRIME_FLOW_INTEGRATOR ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleBloodPrimePausedState function handles the blood prime paused + * state operations. + * @details \b Inputs: flags + * @details \b Outputs: flags handled + * @return none + *************************************************************************/ +static BLOOD_PRIME_STATE_T handleBloodPrimePausedState( void ) +{ + BLOOD_PRIME_STATE_T result = BLOOD_PRIME_PAUSED_STATE; + + return result; +} + +/*********************************************************************//** + * @brief * The getCurrentBloodPrimeState function returns the current state of the * blood prime state. * @details \b Inputs: bloodPrimeState