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(); }