Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 -r5aa897d2ca22435bf7ec90dfdf656facb740276a --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 5aa897d2ca22435bf7ec90dfdf656facb740276a) @@ -415,6 +415,10 @@ // Set the timer for the first debounce read currentValveStates[ valve ].valveOpsStartTime = getMSTimerCount(); +#ifdef ASN_DEMO + currentValveStates[ valve ].hasValveBeenReset = FALSE; +#endif + return nextState; } @@ -477,16 +481,33 @@ // Keep reseting the debouce timer until the encoder count is less than the encoder count is less than the number currentValveStates[ valve ].valveOpsStartTime = getMSTimerCount(); } - else if ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, ZERO_ENC_DEBOUNCE_TIMEOUT_MS ) ) + else if ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, 2000 /*ZERO_ENC_DEBOUNCE_TIMEOUT_MS*/ ) ) { +#ifndef ASN_DEMO // Position C is hard coded as count 8. // Position D is hard coded as an offset form 0. currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] = ROTARY_VALVE_MICROSTEP_FRACTION; currentValveStates[ valve ].positionsABC[ VALVE_POSITION_D_VENOUS ] = POS_D_VENOUS_OFFSET_FROM_ZERO_CNT; nextState = VALVE_STATE_HOMING_NOT_STARTED; +#endif #ifdef ASN_DEMO - nextState = VALVE_STATE_IDLE; + nextState = VALVE_STATE_HOMING_NOT_STARTED; + switch ( valve ) + { + case H1_VALV: + setH1Position( 880 ); + break; + + case H19_VALV: + setH19Position( 880 ); + break; + + default: + // Do nothing as the fault mode is checked in the exec function + break; + } + nextState = VALVE_STATE_HOMING_NOT_STARTED; #endif } @@ -506,6 +527,7 @@ { VALVE_STATE_T nextState = VALVE_STATE_HOMING_NOT_STARTED; +#ifndef ASN_DEMO if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { switch ( currentValveStates[ valve ].valveHomingStatus ) @@ -544,6 +566,7 @@ setValveCmdChangePosition( valve, (U16)currentValveStates[ valve ].proposedEnergizedPos, MOTOR_DIR_FORWARD ); } } +#endif return nextState; }