Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r9910fec894ece6f3a4845e15c3ca56f56e4e4111 -r4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 9910fec894ece6f3a4845e15c3ca56f56e4e4111) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558) @@ -53,7 +53,8 @@ static U16 commandedValvesStates; ///< Initialize commanded valves states bit field. static U08 commandedBCValveStates; ///< Initialize balancing chamber commanded valves states bit field. static U08 commandedSpareValveStates; ///< Initialize commanded spare valves states bit field. -static U16 commandedIOFPValveStates; ///< Initialize commanded IOFP valves states bit field. +static U08 commandedIOValveStates; ///< Initialize commanded IO valves states bit field. +static U08 commandedFPValveStates; ///< Initialize commanded FP valves states bit field. static U32 valveStateMismatchTimerCounter; ///< Initialize valve state mismatch timer. static U32 pendingValveStateChanges[ DD_NUM_OF_VALVES ]; ///< Delayed (pending) valve state changes. static U32 pendingValveStateChangeCountDowns[ DD_NUM_OF_VALVES ]; ///< Delayed (pending) valve state change count down timers (in task intervals). @@ -111,7 +112,8 @@ commandedValvesStates = ALL_VALVES_DEENERGIZED; commandedBCValveStates = ALL_VALVES_DEENERGIZED; commandedSpareValveStates = ALL_VALVES_DEENERGIZED; - commandedIOFPValveStates = ALL_VALVES_DEENERGIZED; + commandedIOValveStates = ALL_VALVES_DEENERGIZED; + commandedFPValveStates = ALL_VALVES_DEENERGIZED; valveStateMismatchTimerCounter = 0; valvesStatesPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; // reset valves states publication timer fpValveStatesPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; // reset valves states publication timer @@ -120,7 +122,8 @@ setFPGADDValveStates( commandedValvesStates ); setFPGABCValveStates( commandedBCValveStates ); setFPGASpareValveStates( commandedSpareValveStates ); - setFPGAIOFPValveStates( commandedIOFPValveStates ); + setFPGAIOValveStates( commandedIOValveStates ); + setFPGAFPValveStates( commandedFPValveStates ); } /*********************************************************************//** @@ -141,13 +144,15 @@ U16 readValvesStates = getFPGADDValveStates(); U08 readValveBCStates = getFPGAValveBCStates(); U08 readValveSpStates = getFPGAValveSpStates(); - U16 readValveIOFPStates = getFPGAIOFPValveStates(); + U08 readValveIOStates = getFPGAIOValveStates(); + U08 readValveFPStates = getFPGAFPValveStates(); // Verify read back FPGA valve states match last commanded valve states if ( ( readValvesStates != commandedValvesStates ) || ( readValveBCStates != commandedBCValveStates ) || ( readValveSpStates != commandedSpareValveStates ) || - ( readValveIOFPStates != commandedIOFPValveStates ) ) + ( readValveIOStates != commandedIOValveStates ) || + ( readValveFPStates != commandedFPValveStates )) { valveStateMismatchTimerCounter++; // increment valve state mismatch counter by 1 if ( valveStateMismatchTimerCounter > MAX_VALVE_STATE_MISMATCH_TIMER_COUNT ) @@ -179,7 +184,8 @@ setFPGADDValveStates( commandedValvesStates ); setFPGABCValveStates( commandedBCValveStates ); setFPGASpareValveStates( commandedSpareValveStates ); - setFPGAIOFPValveStates( commandedIOFPValveStates ); + setFPGAIOValveStates( commandedIOValveStates ); + setFPGAFPValveStates( commandedFPValveStates ); // Publish valve states on interval publishValvesStates(); @@ -202,7 +208,8 @@ commandedValvesStates = ALL_VALVES_DEENERGIZED; commandedBCValveStates = ALL_VALVES_DEENERGIZED; commandedSpareValveStates = ALL_VALVES_DEENERGIZED; - commandedIOFPValveStates = ALL_VALVES_DEENERGIZED; + commandedIOValveStates = ALL_VALVES_DEENERGIZED; + commandedFPValveStates = ALL_VALVES_DEENERGIZED; // flag hydraulics valves that are currently commanded to be energized for ( i = FIRST_HYD_VALVE; i <= LAST_HYD_VALVE; i++ ) @@ -222,11 +229,16 @@ commandedSpareValveStates |= ( getValveState( i ) == ENERGIZED ? 0x01 << ( i - FIRST_SP_VALVE ) : 0 ); } - // flag IOFP valves that are currently commanded to be energized - for ( i = FIRST_IO_VALVE; i <= LAST_FP_VALVE; i++ ) + // flag IO valves that are currently commanded to be energized + for ( i = FIRST_IO_VALVE; i <= LAST_IO_VALVE; i++ ) { - commandedIOFPValveStates |= ( getValveState( i ) == ENERGIZED ? 0x01 << ( i - FIRST_IO_VALVE ) : 0 ); + commandedIOValveStates |= ( getValveState( i ) == ENERGIZED ? 0x01 << ( i - FIRST_IO_VALVE ) : 0 ); } + // flag FP valves that are currently commanded to be energized + for ( i = FIRST_FP_VALVE; i <= LAST_FP_VALVE; i++ ) + { + commandedFPValveStates |= ( getValveState( i ) == ENERGIZED ? 0x01 << ( i - FIRST_FP_VALVE ) : 0 ); + } } /*********************************************************************//** @@ -253,7 +265,8 @@ ( D40_VALV == valveID ) || ( D47_VALV == valveID ) || ( D3_VALV == valveID ) || ( M4_VALV == valveID ) || ( D23_VALV == valveID ) || ( D19_VALV == valveID ) || ( D25_VALV == valveID ) || ( D21_VALV == valveID ) || ( D24_VALV == valveID ) || ( D20_VALV == valveID ) || ( D26_VALV == valveID ) || ( D22_VALV == valveID ) || ( D80_VALV == valveID ) || ( D81_VALV == valveID ) || ( D79_PMP_VALV == valveID ) || - ( P11_VALV == valveID ) || ( P33_VALV == valveID ) || ( P34_VALV == valveID ) || ( P37_VALV == valveID ) || ( P6_VALV == valveID ) ) + ( P11_VALV == valveID ) || ( P33_VALV == valveID ) || ( P34_VALV == valveID ) || ( P37_VALV == valveID ) || ( P6_VALV == valveID ) || + ( M12_VALV == valveID ) || ( P39_VALV == valveID ) ) { result = TRUE; } @@ -479,7 +492,8 @@ FP_VALVES_DATA_T data; U32 i; - data.valvesCmdState = commandedIOFPValveStates; + data.valvesIOState = commandedIOValveStates; + data.valvesFPState = commandedFPValveStates; for ( i = FIRST_IO_VALVE; i <= LAST_FP_VALVE; i++ ) { data.valvesSensedState[ i - FIRST_IO_VALVE ] = (U08)getValveStateName( (DD_VALVES_T)i );