Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r9c785a779da348df1c066ae0da2d0f53de7ea936 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 9c785a779da348df1c066ae0da2d0f53de7ea936) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -16,6 +16,7 @@ ***************************************************************************/ #include "etpwm.h" +#include "math.h" // For fabs #include "Fans.h" #include "FPGA.h" @@ -248,11 +249,6 @@ state = FANS_EXEC_STATE_RUN_STATE; } -#ifndef _VECTORCAST_ // To skip the wait for POST and start running. - // TODO REMOVE - state = FANS_EXEC_STATE_RUN_STATE; - // TODO REMOVE -#endif return state; } @@ -435,10 +431,13 @@ for ( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) { rpm = getMeasuredFanRPM( fan ); - isFanRPMOutOfRange |= ( ( rpm < fansMinAllowedRPM ) || ( rpm > fansMaxAllowedRPM ) ? TRUE : FALSE ); + isFanRPMOutOfRange |= ( ( fabs( rpm - fansMinAllowedRPM ) < NEARLY_ZERO ) || ( fabs( rpm - fansMaxAllowedRPM ) < NEARLY_ZERO ) ? TRUE : FALSE ); } - if ( FALSE == hasAlarmBeenRaised ) + // Check if the alarm has not been raise yet, raise it then + // Before checking for the alarm, the POST must be completed. The fans POST is after the temperatures POST that should get their + // calibration to be able to apply them and calculate the temperatures that are used to alarm the fans. + if ( ( FALSE == hasAlarmBeenRaised ) && ( TRUE == isPOSTComplete ) ) { isAlarmTriggered = isPersistentAlarmTriggered( ALARM_ID_HD_FAN_RPM_OUT_OF_RANGE, isFanRPMOutOfRange ); Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -469,42 +469,45 @@ F32 artPres = getFilteredArterialPressure(); #ifndef DISABLE_ARTERIAL_PRESSURE_CHECK - // Check arterial pressure is in range - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, - ( artPres > ARTERIAL_PRESSURE_MAX_MMHG || artPres < ARTERIAL_PRESSURE_MIN_MMHG ) ) ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ARTERIAL_PRESSURE_CHECK ) != SW_CONFIG_ENABLE_VALUE ) { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, artPres ); - } - - // Check arterial pressure during treatment mode - if ( ( MODE_TREA == getCurrentOperationMode() ) && ( getTreatmentState() <= TREATMENT_DIALYSIS_STATE ) ) - { - F32 artLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); - F32 artHighLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); - - // If BP is ramping up, extend range to outer limits as pressure may not yet have reached expected range. - if ( isBloodPumpRampComplete() != TRUE ) + // Check arterial pressure is in range + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, + ( artPres > ARTERIAL_PRESSURE_MAX_MMHG || artPres < ARTERIAL_PRESSURE_MIN_MMHG ) ) ) { - artLowLimit = (F32)getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); - artHighLimit = (F32)getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, artPres ); } - // Check arterial pressure is within user set alarm limits - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_LOW, artPres < artLowLimit ) ) + // Check arterial pressure during treatment mode + if ( ( MODE_TREA == getCurrentOperationMode() ) && ( getTreatmentState() <= TREATMENT_DIALYSIS_STATE ) ) { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_ARTERIAL_PRESSURE_LOW, artPres, artLowLimit ); - } + F32 artLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); + F32 artHighLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_HIGH, artPres > artHighLimit ) ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_ARTERIAL_PRESSURE_HIGH, artPres, artHighLimit ); + // If BP is ramping up, extend range to outer limits as pressure may not yet have reached expected range. + if ( isBloodPumpRampComplete() != TRUE ) + { + artLowLimit = (F32)getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); + artHighLimit = (F32)getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); + } + + // Check arterial pressure is within user set alarm limits + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_LOW, artPres < artLowLimit ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_ARTERIAL_PRESSURE_LOW, artPres, artLowLimit ); + } + + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_HIGH, artPres > artHighLimit ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_ARTERIAL_PRESSURE_HIGH, artPres, artHighLimit ); + } } + else + { // Reset persistence if alarm is out of scope + isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_LOW, FALSE ); + isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_HIGH, FALSE ); + } } - else - { // Reset persistence if alarm is out of scope - isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_LOW, FALSE ); - isPersistentAlarmTriggered( ALARM_ID_ARTERIAL_PRESSURE_HIGH, FALSE ); - } #endif } @@ -521,49 +524,52 @@ F32 venPres = getFilteredVenousPressure(); #ifndef DISABLE_VENOUS_PRESSURE_CHECK - // Check venous pressure is in range - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres > VENOUS_PRESSURE_MAX_MMHG ) || - TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres < VENOUS_PRESSURE_MIN_MMHG ) ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_VENOUS_PRESSURE_CHECK ) != SW_CONFIG_ENABLE_VALUE ) { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres ); - } - - // Check venous pressure during treatment mode - if ( ( MODE_TREA == getCurrentOperationMode() ) && ( getTreatmentState() <= TREATMENT_DIALYSIS_STATE ) ) - { - F32 venLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); - F32 venHighLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_HIGH_LIMIT ); - - // If BP is ramping up, extend range to outer limits as pressure may not yet have reached expected range. - if ( isBloodPumpRampComplete() != TRUE ) + // Check venous pressure is in range + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres > VENOUS_PRESSURE_MAX_MMHG ) || + TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres < VENOUS_PRESSURE_MIN_MMHG ) ) { - venLowLimit = (F32)getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); - venHighLimit = (F32)getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRESSURE_HIGH_LIMIT ); + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_VENOUS_PRESSURE_OUT_OF_RANGE, venPres ); } - // Cannot monitor for low venous pressure while venting air trap - if ( getValveAirTrapStatus() != STATE_OPEN ) + // Check venous pressure during treatment mode + if ( ( MODE_TREA == getCurrentOperationMode() ) && ( getTreatmentState() <= TREATMENT_DIALYSIS_STATE ) ) { - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_LOW, venPres < venLowLimit ) ) + F32 venLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); + F32 venHighLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_HIGH_LIMIT ); + + // If BP is ramping up, extend range to outer limits as pressure may not yet have reached expected range. + if ( isBloodPumpRampComplete() != TRUE ) { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_VENOUS_PRESSURE_LOW, venPres, venLowLimit ); + venLowLimit = (F32)getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); + venHighLimit = (F32)getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRESSURE_HIGH_LIMIT ); } + + // Cannot monitor for low venous pressure while venting air trap + if ( getValveAirTrapStatus() != STATE_OPEN ) + { + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_LOW, venPres < venLowLimit ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_VENOUS_PRESSURE_LOW, venPres, venLowLimit ); + } + } + else + { // clear persistence if air trap valve is open + isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_LOW, FALSE ); + } + + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_HIGH, venPres > venHighLimit ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_VENOUS_PRESSURE_HIGH, venPres, venHighLimit ); + } } else - { // clear persistence if air trap valve is open + { // Reset persistence if alarm is out of scope isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_LOW, FALSE ); + isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_HIGH, FALSE ); } - - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_HIGH, venPres > venHighLimit ) ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_VENOUS_PRESSURE_HIGH, venPres, venHighLimit ); - } } - else - { // Reset persistence if alarm is out of scope - isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_LOW, FALSE ); - isPersistentAlarmTriggered( ALARM_ID_VENOUS_PRESSURE_HIGH, FALSE ); - } #endif } Index: firmware/App/Controllers/Temperatures.c =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -357,11 +357,11 @@ // Apply the calibration record the temperature values prior to updating the structures temperaturesStatus[ sensor ].temperatureValue.data = - pow(sensor, 4) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].fourthOrderCoeff + - pow(sensor, 3) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].thirdOrderCoeff + - pow(sensor, 3) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].secondOrderCoeff + - sensor * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].gain + - temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].offset; + pow(temperature, 4) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].fourthOrderCoeff + + pow(temperature, 3) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].thirdOrderCoeff + + pow(temperature, 3) * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].secondOrderCoeff + + temperature * temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].gain + + temperaturesCalRecord.hdTemperatureSensors[ (CAL_DATA_HD_TEMEPERATURE_SENSORS_T)sensor ].offset; } } Index: firmware/App/HDCommon.h =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -58,8 +58,8 @@ #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks - #define DISABLE_ARTERIAL_PRESSURE_CHECK 1 // Do not error on arterial pressure out of range - #define DISABLE_VENOUS_PRESSURE_CHECK 1 // Do not error on venous pressure out of range + #define DISABLE_ARTERIAL_PRESSURE_CHECK 1 // Do not error on arterial pressure out of range // TODO sw config implemented + #define DISABLE_VENOUS_PRESSURE_CHECK 1 // Do not error on venous pressure out of range // TODO sw config implemented // #define USE_PBO_AS_PBA 1 // PBo readings used for PBA, PBo replaced with fixed pressure (100 mmHg) // #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks @@ -88,7 +88,6 @@ #define SKIP_RESERVOIR_ALARMS 1 // Skip reservoir management alarms // #define IGNORE_BLOOD_LEAK_SELF_TEST 1 // Ignore blood leak self test // TODO New config implemented // #define IGNORE_BLOOD_LEAK_ALARM 1 // Ignore blood leak alarm // TODO New config implemented -// #define DISABLE_SERVICE_RECORD 1 // Skip Pre-Treatment and get to treatment as soon as possible #define SKIP_UI_INTERACTION 1 // Skip UI interaction. // TODO New config implemented Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r40f46e196349e3dd730048a354df8bbb2e40407d -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 40f46e196349e3dd730048a354df8bbb2e40407d) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -77,11 +77,12 @@ { case CONSUMABLE_SELF_TESTS_INSTALL_STATE: #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + consumableInstallConfirmed = TRUE; +#endif + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) { consumableInstallConfirmed = TRUE; } -#endif // TODO: Check for DG straw door status to be open once DG door driver implemented if ( TRUE == consumableInstallConfirmed ) { @@ -91,6 +92,10 @@ { currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_FILL_CMD_STATE; } + else + { + currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_COMPLETE_STATE; + } #else currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_COMPLETE_STATE; #endif Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -27,6 +27,7 @@ #include "CPLD.h" #include "DialInFlow.h" #include "DialOutFlow.h" +#include "Fans.h" #include "FPGA.h" #include "Integrity.h" #include "ModeInitPOST.h" @@ -38,6 +39,7 @@ #include "SyringePump.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" +#include "Temperatures.h" #include "Valves.h" #include "WatchdogMgmt.h" @@ -243,6 +245,19 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_TEMPERATURES: + testStatus = execTemperaturesSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + + // NOTE: fans self test must be called after temperatures since the + // temperatures must get their calibration first before the fans start monitoring + // for RPM out of range + case POST_STATE_FANS: + testStatus = execFansSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + case POST_STATE_STUCK_BUTTON: testStatus = execStuckButtonTest(); postState = handlePOSTStatus( testStatus ); Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r40f46e196349e3dd730048a354df8bbb2e40407d -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 40f46e196349e3dd730048a354df8bbb2e40407d) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -367,7 +367,7 @@ if ( STATE_CLOSED == getFPGADoorState() ) { #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) == SW_CONFIG_ENABLE_VALUE ) { patientDisconnectionConfirmed = TRUE; } @@ -413,7 +413,7 @@ HD_POST_TREATMENT_STATE_T state = HD_POST_TREATMENT_DISPOSABLE_REMOVAL_STATE; #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) == SW_CONFIG_ENABLE_VALUE ) { disposableRemovalConfirmed = TRUE; } Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r48e5e7c2c365b44c9831f3af0b4f321862ea12ae -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 48e5e7c2c365b44c9831f3af0b4f321862ea12ae) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -56,9 +56,6 @@ #define PRE_TREATMENT_FILL_RESERVOIR_TWO_VOLUME_ML FILL_RESERVOIR_TO_VOLUME_ML #endif -#define PRIMARY_HEATER_TARGET_TEMP_OFFSET 2.0 //TODO remove ///< Primary heater target temperature offset from trimmer heater temperature. - - /// States of the pre-treatment reservoir management state machine. typedef enum PreTreatmentReservoirMgmt_States { @@ -358,7 +355,7 @@ REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NO_PATIENT_CONNECTION_CONFIRM; #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) == SW_CONFIG_ENABLE_VALUE ) { patientConnectionConfirm = TRUE; } @@ -774,7 +771,7 @@ execPreTreatmentRecirc(); #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) == SW_CONFIG_ENABLE_VALUE ) { continueToTreatmentRequested = TRUE; } @@ -1049,7 +1046,15 @@ if ( FALSE == reservoirFlushedStatus[ DG_RESERVOIR_1 ] ) { #ifdef SKIP_PRIMING - reservoirFilledStatus[ DG_RESERVOIR_1 ] = TRUE; + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRIMING ) ) + { + reservoirFilledStatus[ DG_RESERVOIR_1 ] = TRUE; + } + else + { + reservoirFlushedStatus[ DG_RESERVOIR_1 ] = TRUE; + cmdSetDGActiveReservoir( DG_RESERVOIR_1 ); + } #else reservoirFlushedStatus[ DG_RESERVOIR_1 ] = TRUE; cmdSetDGActiveReservoir( DG_RESERVOIR_1 ); Index: firmware/App/Modes/Prime.c =================================================================== diff -u -r40f46e196349e3dd730048a354df8bbb2e40407d -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision 40f46e196349e3dd730048a354df8bbb2e40407d) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -424,7 +424,7 @@ primeStartTime = getMSTimerCount(); #ifdef SKIP_UI_INTERACTION - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) != SW_CONFIG_ENABLE_VALUE ) + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) { primeStartRequested = TRUE; } Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -379,11 +379,15 @@ { case DRY_SELF_TESTS_START_STATE: #ifdef SKIP_DRY_SELF_TESTS - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DRY_SELF_TESTS ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DRY_SELF_TESTS ) == SW_CONFIG_ENABLE_VALUE ) { // TODO: Remove once dry self-test is ready to use currentDrySelfTestsState = DRY_SELF_TESTS_SYRINGE_PUMP_PRIME_STATE; } + else + { + currentDrySelfTestsState = DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; + } #else { currentDrySelfTestsState = DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r24e3289cc7a1ed28ec73a1ecb78c8ce7901a3abc -rf013ac5e5de456c4fa4367884cda6515f2a51642 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 24e3289cc7a1ed28ec73a1ecb78c8ce7901a3abc) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision f013ac5e5de456c4fa4367884cda6515f2a51642) @@ -73,7 +73,7 @@ static const F32 RESERVOIR_DILUTION_RATIO = MAX_RESERVOIR_DILUTION / ( 1.0 - MAX_RESERVOIR_DILUTION ); ///< Reservoir dilution ratio. -// TOD remove +// TODO remove // FALSE for reservoir 1 and TRUE for reservoir 2 static BOOL test = TRUE; // TODO remove @@ -597,8 +597,6 @@ // Signal dialysis sub-mode to switch reservoirs signalReservoirsSwitched(); - - test = FALSE; } // TODO test code @@ -609,9 +607,16 @@ reservoirSwitchStartTimeMS = getMSTimerCount(); // TODO test code - //state = TREATMENT_RESERVOIR_MGMT_WAIT_FOR_SWITCH_SETTLE_STATE; // For reservoir test, it should go back to start state - state = TREATMENT_RESERVOIR_MGMT_START_STATE; + if ( FALSE == test ) + { + state = TREATMENT_RESERVOIR_MGMT_START_STATE; + } + else + { + state = TREATMENT_RESERVOIR_MGMT_WAIT_FOR_SWITCH_SETTLE_STATE; + test = FALSE; + } // TODO test code }