Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -r16219f68040cc257728be31ce24f7e23e2769f48 -r4022a06181f6f6d58ccfd465159d95f0df1b0393 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 16219f68040cc257728be31ce24f7e23e2769f48) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 4022a06181f6f6d58ccfd465159d95f0df1b0393) @@ -358,10 +358,9 @@ } } - // Raise air trap level once at start of treatment (blood priming) or when air detected at lower level + // Raise air trap level once at start of treatment (blood priming) or when air detected at upper level else if ( ( TRUE == airTrapWasFilledAtStartOfTreatement ) || - ( ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H16_LEVL ) ) && - ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H17_LEVL ) ) ) ) + ( AIR_TRAP_LEVEL_AIR == getLevelSensorState( H16_LEVL ) ) ) { setAirPumpState( AIR_PUMP_STATE_ON, AIR_PUMP_MOTOR_FILL_PWM ); set3WayValveState( H20_VALV, STATE_OPEN ); // open valve H20 to allow air to be pumped out of air trap to atmosphere @@ -394,7 +393,7 @@ set3WayValveState( H20_VALV, STATE_CLOSED ); result = AIR_TRAP_MANUAL_CONTROL_STATE; } - // Transition back to closed state when air trap fill completed + // Transition back to closed state when air trap fill completed TODO - timeout??? else if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16_LEVL ) ) { airTrapWasFilledAtStartOfTreatement = TRUE; @@ -436,14 +435,18 @@ } // Transition back to closed state when air trap lower level operation completed else if ( ( TRUE == didTimeout( airTrapLowerStartTime, airPumpStopTime ) ) || - ( ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16_LEVL ) ) && - ( AIR_TRAP_LEVEL_FLUID == getLevelSensorState( H17_LEVL ) ) ) ) + ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16_LEVL ) ) ) { setAirPumpState( AIR_PUMP_STATE_OFF, AIR_PUMP_MOTOR_OFF ); set3WayValveState( H13_VALV, STATE_CLOSED ); airTrapLowerDelayStartTime = getMSTimerCount(); SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_AIR_TRAP_LOWER, 0, 0 ); + // if lower level operation times out, alarm + if ( TRUE == didTimeout( airTrapLowerStartTime, airPumpStopTime ) ) + { + // TODO - alarm??? + } result = AIR_TRAP_CLOSED_STATE; } Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -rf1d812de6fbaf4943d05bbee2271bcb61138325a -r4022a06181f6f6d58ccfd465159d95f0df1b0393 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision f1d812de6fbaf4943d05bbee2271bcb61138325a) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 4022a06181f6f6d58ccfd465159d95f0df1b0393) @@ -153,13 +153,13 @@ #if 1 static U32 ctr = 0; static U32 sta = 0; - static BOOL start = FALSE; + static BOOL start = TRUE; static BOOL bpStart = FALSE; static BOOL bpStop = FALSE; if ( FALSE == bpStart ) { - setBloodPumpTargetRPM( 1700, MOTOR_DIR_FORWARD ); + setBloodPumpTargetRPM( 1000, MOTOR_DIR_FORWARD ); bpStart = TRUE; } if ( TRUE == bpStop ) @@ -190,8 +190,8 @@ } break; case 1: - // look for low level and stop - if ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H17_LEVL ) ) + // look for air at high level and stop + if ( AIR_TRAP_LEVEL_AIR == getRawLevelSensorState( H16_LEVL ) ) { // stop lowering level set3WayValveState( H13_VALV, STATE_CLOSED ); @@ -201,8 +201,8 @@ } break; case 2: - // stay low for 10 sec - if ( ++ctr > ( 10 * 20 ) ) + // stay low for 5 sec + if ( ++ctr > ( 5 * 20 ) ) { // raise the level set3WayValveState( H20_VALV, STATE_OPEN ); @@ -211,7 +211,7 @@ } break; case 3: - // look for low level and stop + // look for fluid at high level and stop if ( AIR_TRAP_LEVEL_FLUID == getRawLevelSensorState( H16_LEVL ) ) { // stop raising level @@ -222,8 +222,8 @@ } break; case 4: - // stay high for 10 sec - if ( ++ctr > ( 10 * 20 ) ) + // stay high for 5 sec + if ( ++ctr > ( 5 * 20 ) ) { // lower the level set3WayValveState( H13_VALV, STATE_OPEN );