Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r229341f9eb23fec730cdf9b1f8f3960de2daf384 -re323c2ae230dede86877e33c4e8706555cde0bd5 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 229341f9eb23fec730cdf9b1f8f3960de2daf384) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision e323c2ae230dede86877e33c4e8706555cde0bd5) @@ -67,6 +67,7 @@ static BOOL checkValveStateName( DD_VALVES_T valveID, VALVE_STATE_NAMES_T valveStateName ); static U32 convertValveStateNameToValveState( VALVE_STATE_NAMES_T valveStateName ); static U32 getValveState( U32 valveID ); +static BOOL getBypassState(); /*********************************************************************//** * @brief @@ -442,6 +443,29 @@ /*********************************************************************//** * @brief + * The getBypassState function determines if the DD subsystem is in bypass + * state by checking if valve D34 is open/energized and valves D35 and D40 + * are closed/deenergized. + * @details \b Inputs: none + * @details \b Outputs: bypass state + * @return whether if the DD subsystem is in the bypass state + *************************************************************************/ +BOOL getBypassState( void ) +{ + BOOL result = FALSE; + + if ( ( ENERGIZED == getValveState( D34_VALV ) ) && + ( DEENERGIZED == getValveState( D35_VALV ) ) && + ( DEENERGIZED == getValveState( D40_VALV ) ) ) + { + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The publishValvesStates function publishes DD valves states at the set interval. * @details \b Inputs: valvesStatesPublicationTimerCounter * @details \b Outputs: valvesStatesPublicationTimerCounter @@ -465,6 +489,8 @@ data.valvesSensedState[ i ] = (U08)getValveStateName( (DD_VALVES_T)i ); } + data.bypassState = getBypassState(); + broadcastData( MSG_ID_DD_VALVES_STATES_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( DD_VALVES_DATA_T ) ); valvesStatesPublicationTimerCounter = 0;