Index: firmware/App/Modes/Prime.c =================================================================== diff -u -rcc4f8440e8ad7fa8f2ced2467d922be7422c344c -r51245314484476140164c8dd3dc1a6dc1b7c2384 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision cc4f8440e8ad7fa8f2ced2467d922be7422c344c) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision 51245314484476140164c8dd3dc1a6dc1b7c2384) @@ -7,8 +7,8 @@ * * @file Prime.c * -* @author (last) Dara Navaei -* @date (last) 22-Feb-2022 +* @author (last) Darren Cox +* @date (last) 10-Mar-2022 * * @author (original) Quang Nguyen * @date (original) 08-Dec-2020 @@ -36,20 +36,20 @@ // ********** private definitions ********** -#define MAX_PRIME_TIME ( 10 * SEC_PER_MIN ) ///< Maximum prime time (in seconds). +#define MAX_PRIME_TIME ( 15 * SEC_PER_MIN ) ///< Maximum prime time (in seconds). #define PRIME_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the prime data is published on the CAN bus. -#define BLOOD_PUMP_FAST_FLOW_RATE_PURGE_AIR_ML_MIN 300 ///< Blood pump fast flow rate to fill fluid. +#define BLOOD_PUMP_FAST_FLOW_RATE_PURGE_AIR_ML_MIN 150 ///< Blood pump fast flow rate to fill fluid. #define BLOOD_PUMP_SLOW_FLOW_RATE_PURGE_AIR_ML_MIN 150 ///< Blood pump slow flow rate after fluid reach lower level of air trap sensor. #define BLOOD_PUMP_SALINE_FLOW_RATE_PURGE_AIR_ML_MIN 200 ///< Blood pump very slow flow rate during prime saline dialyzer state -#define BLOOD_PUMP_FLOW_RATE_CIRC_BLOOD_CIRCUIT_ML_MIN 300 ///< Blood pump flow rate during prime recirculate blood circuit state. +#define BLOOD_PUMP_FLOW_RATE_CIRC_BLOOD_CIRCUIT_ML_MIN 150 ///< Blood pump flow rate during prime recirculate blood circuit state. #define BLOOD_PUMP_FLOW_RATE_SALINE_DIALYZER_ML_MIN 300 ///< Blood pump flow rate during prime the saline dialyzer dialysate state. #define DIALYSATE_PUMP_PRIME_FLOW_RATE_ML_MIN 300 ///< Dialysate pump flow rate during priming fluid path. #define DIALYSATE_DIALYZER_TUBE_VOLUME_ML 115 ///< This total tube volume is used to calculate the Dpi & Dpo time out in the dialysate dialyzer state. #define DIALYSATE_DIALYZER_BYPASS_TUBE_VOLUME_ML 75 ///< This volume is used to calculate the DPi pump time out in the dialyzer bypass state. #define DIALYZER_DVI_PATH_VOLUME_ML 17 ///< Path volume from the dialyzer to the VDI valve in mL. -#define DIALYZER_VOLUME_SCALE_FACTOR 0.5 ///< Half of the dialyzer total volume. +#define DIALYZER_VOLUME_SCALE_FACTOR 0.5F ///< Half of the dialyzer total volume. #define NO_AIR_DETECTED_COUNT ( 20 * MS_PER_SECOND ) ///< No air detected time period count. #define PURGE_AIR_TIME_OUT_COUNT ( 60 * MS_PER_SECOND ) ///< Time period count for purge air time out. @@ -141,7 +141,13 @@ *************************************************************************/ void initPrime( void ) { - transitionToPrime(); + currentPrimeState = HD_PRIME_START_STATE; + currentReservoirMgmtState = PRIME_RESERVOIR_MGMT_START_STATE; + + primeStartTime = 0; + primePauseStartTime = 0; + primeStatusBroadcastTimerCounter = 0; + } /*********************************************************************//** @@ -154,17 +160,25 @@ *************************************************************************/ void transitionToPrime( void ) { - currentPrimeState = HD_PRIME_START_STATE; - currentReservoirMgmtState = PRIME_RESERVOIR_MGMT_START_STATE; - primeStartTime = getMSTimerCount(); - primePauseStartTime = 0; - primeStatusBroadcastTimerCounter = 0; setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); + // Pumps should be off + signalBloodPumpHardStop(); + signalDialInPumpHardStop(); + signalDialOutPumpHardStop(); + stopSyringePump(); + + // Set valves to default positions + setValveAirTrap( STATE_CLOSED ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + resetPrimeFlags(); } @@ -181,11 +195,13 @@ switch ( currentPrimeState ) { case HD_PRIME_START_STATE: +#ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRIMING ) ) { currentPrimeState = HD_PRIME_RESERVOIR_ONE_FILL_COMPLETE_STATE; } else +#endif { currentPrimeState = HD_PRIME_WAIT_FOR_USER_START_STATE; } @@ -426,10 +442,12 @@ // Keep updating start time until the user requested priming primeStartTime = getMSTimerCount(); +#ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) { primeStartRequested = TRUE; } +#endif if ( TRUE == primeStartRequested ) { @@ -581,11 +599,15 @@ steadyVolumeSamplingStartTime = getMSTimerCount(); primeDialysateDialyzerStartTime = getMSTimerCount(); +#ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRIMING ) ) { + signalDialOutPumpHardStop(); + signalDialInPumpHardStop(); state = HD_PRIME_WET_SELF_TESTS_STATE; } else +#endif { state = HD_PRIME_DIALYSATE_DIALYZER_STATE; } @@ -832,12 +854,9 @@ signalResumeSelfTests(); } - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_WET_SELF_TEST ) != SW_CONFIG_ENABLE_VALUE ) - { - execWetSelfTests(); - } + execWetSelfTests(); - if ( ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_WET_SELF_TEST ) ) || ( TRUE == isWetSelfTestsPassed() ) ) + if ( TRUE == isWetSelfTestsPassed() ) { state = HD_PRIME_COMPLETE; }