Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r9c785a779da348df1c066ae0da2d0f53de7ea936 -r514463982373eb976e4b48a27d0f85f56e014920 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 9c785a779da348df1c066ae0da2d0f53de7ea936) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 514463982373eb976e4b48a27d0f85f56e014920) @@ -56,12 +56,6 @@ #define BLOOD_LEAK_MIN_WAIT_TIME_2_GET_CAL_MS ( 2 * MS_PER_SECOND ) ///< Blood leak minimum wait time to get calibration in milliseconds. -// TODO remove after zeroing was fixed -#define BLOOD_LEAK_ZERO_SENSOR_SEQ_LENGTH 5 ///< Blood leak zero sensor sequence length. -#define BLOOD_LEAK_ZERO_Z_CHAR_ASCII 90 ///< Blood leak zero sensor 'Z' command in ascii. -#define BLOOD_LEAK_ZERO_FIFO_STOP_INDEX 2 ///< Blood leak zero sensor stop writing to FIFO command. -// TODO remove after zeroing was fixed - /// Defined states for the blood leak detector state machine. typedef enum BloodLeakStates { @@ -106,15 +100,6 @@ BLOOD_LEAK_UART_COMM_ACTIVE_HIGH, BLOOD_LEAK_UART_COMM_ACTIVE_LOW }; -// TODO remove after zeroing was fixed -/// Blood leak zero sensor sequence array. -static const U08 BLOOD_LEAK_ZERO_SNSR_SEQUENCE[ BLOOD_LEAK_ZERO_SENSOR_SEQ_LENGTH ] = { BLOOD_LEAK_ZERO_Z_CHAR_ASCII, - BLOOD_LEAK_CARRIAGE_RETURN_ASCII, - BLOOD_LEAK_STOP_WRITE_FIFO_COMMAND, - BLOOD_LEAK_UART_COMM_ACTIVE_HIGH, - BLOOD_LEAK_UART_COMM_ACTIVE_LOW }; -// TODO remove after zeroing was fixed - // ********** private function prototypes ********** static BLOOD_LEAK_STATES_T handleBloodLeakStartupState( void ); @@ -327,6 +312,10 @@ U16 bloodLeakSetPoint = getFPGABloodLeakDetectSetPoint(); +#ifdef BOARD_WITH_NO_HARDWARE + bloodLeakCalRecord.setPoint = 30; +#endif + if ( bloodLeakSetPoint != bloodLeakCalRecord.setPoint ) { if ( bloodLeakCurrentSetPointWriteTry < BLOOD_LEAK_MAX_SET_POINT_WRITE_TRIALS ) @@ -413,7 +402,7 @@ state = BLOOD_LEAK_ZERO_STATE; bloodLeakZeroRequested = FALSE; - setFPGABloodLeakZero(); // TODO check if this is needed + setFPGABloodLeakZero(); bloodLeakZeroStartTime = getMSTimerCount(); } @@ -432,41 +421,23 @@ { BLOOD_LEAK_STATES_T state = BLOOD_LEAK_ZERO_STATE; - /*if ( bloodLeakUARTCmdIndex < BLOOD_LEAK_ZERO_SENSOR_SEQ_LENGTH ) + if ( TRUE == FPGABloodLeakZeroDetected() ) { - U08 command = BLOOD_LEAK_ZERO_SNSR_SEQUENCE[ bloodLeakUARTCmdIndex ]; - - if ( bloodLeakUARTCmdIndex <= BLOOD_LEAK_ZERO_FIFO_STOP_INDEX ) - { - setFPGABloodLeakUARTTransmit( (U08)command ); - } - else - { - setFPGABloodLeakUARTControl( (U08)command ); - } - - bloodLeakUARTCmdIndex++; + state = BLOOD_LEAK_SELF_TEST_STATE; + bloodLeakSelfTestStatus = SELF_TEST_STATUS_IN_PROGRESS; + clearFPGABloodLeakZero(); + setFPGABloodLeakSelfTest(); + bloodLeakSelfTestStartTime = getMSTimerCount(); } - else*/ + else { - if ( TRUE == FPGABloodLeakZeroDetected() ) + if ( TRUE == didTimeout( bloodLeakZeroStartTime, BLOOD_LEAK_TIMEOUT_MS ) ) { - state = BLOOD_LEAK_SELF_TEST_STATE; - bloodLeakSelfTestStatus = SELF_TEST_STATUS_IN_PROGRESS; - clearFPGABloodLeakZero(); - setFPGABloodLeakSelfTest(); - bloodLeakSelfTestStartTime = getMSTimerCount(); +#ifndef IGNORE_BLOOD_LEAK_ALARM + activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); +#endif } - else - { - if ( TRUE == didTimeout( bloodLeakZeroStartTime, BLOOD_LEAK_TIMEOUT_MS ) ) - { - #ifndef IGNORE_BLOOD_LEAK_ALARM - activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); - #endif - } } - } return state; } @@ -564,7 +535,7 @@ state = BLOOD_LEAK_ZERO_STATE; bloodLeakZeroRequested = FALSE; - setFPGABloodLeakZero(); // TODO is this needed + setFPGABloodLeakZero(); bloodLeakZeroStartTime = getMSTimerCount(); } Index: firmware/App/HDCommon.h =================================================================== diff -u -r1511be2b12834a910983093cf4c3a465ee4cda2e -r514463982373eb976e4b48a27d0f85f56e014920 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 1511be2b12834a910983093cf4c3a465ee4cda2e) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 514463982373eb976e4b48a27d0f85f56e014920) @@ -85,7 +85,7 @@ #define DISABLE_ILLEGAL_AIR_TRAP_ALARM 1 // Disable illegal state for air trap alarm #define SKIP_RESERVOIR_ALARMS 1 // Skip reservoir management alarms #define IGNORE_BLOOD_LEAK_SELF_TEST 1 // Ignore blood leak self test - #define IGNORE_BLOOD_LEAK_ALARM 1 // Ignore blood leak alarm +// #define IGNORE_BLOOD_LEAK_ALARM 1 // Ignore blood leak alarm // Skip Pre-Treatment and get to treatment as soon as possible #define SKIP_UI_INTERACTION 1 // Skip UI interaction. Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r9c785a779da348df1c066ae0da2d0f53de7ea936 -r514463982373eb976e4b48a27d0f85f56e014920 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 9c785a779da348df1c066ae0da2d0f53de7ea936) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 514463982373eb976e4b48a27d0f85f56e014920) @@ -71,8 +71,12 @@ static F32 previousUFFlowMLP = 0.0; ///< Previous ultrafiltration flow rate in mL/min. static DG_MIXING_RATIOS_T ratios; ///< Mixing ratios and fill prep time in milliseconds structure. -static const F32 RESERVOIR_DILUTION_RATIO = MAX_RESERVOIR_DILUTION / ( 1.0 - MAX_RESERVOIR_DILUTION ); +static const F32 RESERVOIR_DILUTION_RATIO = MAX_RESERVOIR_DILUTION / ( 1.0 - MAX_RESERVOIR_DILUTION ); ///< Reservoir dilution ratio. +// TODO remove +static BOOL test = FALSE; +// TODO remove + // ********** private function prototypes ********** // Reservoir management functions @@ -124,6 +128,10 @@ ratios.acidMixingRatio = 0.0; ratios.bicarbMixingRatio = 0.0; ratios.timeFillPrepMS = 0; + + // TODO remove + test = FALSE; + // TODO remove } /*********************************************************************//** @@ -575,7 +583,7 @@ TREATMENT_RESERVOIR_MGMT_STATE_T state = TREATMENT_RESERVOIR_MGMT_WAIT_FOR_FILL_SETTLE_STATE; // Wait for the reservoir to settle and then send the commands to switch the active reservoir - if ( ( TRUE == didTimeout( reservoirSwitchStartTimeMS, RESERVOIR_SETTLE_TIME_MS ) ) && ( volSpentML >= (F32)FILL_RESERVOIR_TO_VOLUME_ML ) ) + if ( ( TRUE == didTimeout( reservoirSwitchStartTimeMS, RESERVOIR_SETTLE_TIME_MS ) ) && ( volSpentML >= (F32)FILL_RESERVOIR_TO_VOLUME_ML ) /*&& ( FALSE == test )*/ ) // DEBUG_DENALI { DG_RESERVOIR_ID_T inactiveRes = getDGInactiveReservoir(); @@ -595,6 +603,9 @@ reservoirSwitchStartTimeMS = getMSTimerCount(); state = TREATMENT_RESERVOIR_MGMT_WAIT_FOR_SWITCH_SETTLE_STATE; + + // This is to make sure the active reservoir stays as 2 + test = TRUE; } return state; Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r9c785a779da348df1c066ae0da2d0f53de7ea936 -r514463982373eb976e4b48a27d0f85f56e014920 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 9c785a779da348df1c066ae0da2d0f53de7ea936) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 514463982373eb976e4b48a27d0f85f56e014920) @@ -110,9 +110,12 @@ #endif #endif #endif - // Monitor blood leak detector - //execBloodLeak(); // Todo remove when board with hardware is disabled +#ifdef BOARD_WITH_NO_HARDWARE + // Monitor blood leak detector for testing on a fixture only + execBloodLeak(); +#endif + // 2nd pass for FPGA execFPGAOut(); }