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 ); Index: firmware/App/Controllers/Valves.h =================================================================== diff -u -r729fd5d3a3a2d38f4fd4eff8068925941731bfc0 -r4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558 --- firmware/App/Controllers/Valves.h (.../Valves.h) (revision 729fd5d3a3a2d38f4fd4eff8068925941731bfc0) +++ firmware/App/Controllers/Valves.h (.../Valves.h) (revision 4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558) @@ -55,7 +55,8 @@ /// Valves publish structure typedef struct { - U16 valvesCmdState; ///< Commanded FP valve states (bits). + U08 valvesIOState; ///< Commanded IO valve states (bits). + U08 valvesFPState; ///< Commanded FP valve states (bits). U08 valvesSensedState[ NUM_OF_IOFP_VALVES ]; ///< Sensed FP valve states (enumerations). } FP_VALVES_DATA_T; Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -reb40fb713ed387f87aa4d9ed9b9f42f91881064e -r4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision eb40fb713ed387f87aa4d9ed9b9f42f91881064e) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558) @@ -230,8 +230,10 @@ U16 p12PumpTachCount; ///< Reg 708. P12 pump tachometer counter. U16 dsPumpTachCount; ///< Reg 710. DSP tachometer counter. U16 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. - U16 valveControlReadback; ///< Reg 714. Valve control bits read back. - U16 valvePWMEnableReadback; ///< Reg 716. Valve PWM enable read back. + U08 valveIOControlReadback; ///< Reg 714. Valve IO control bits read back. + U08 valveFPControlReadback; ///< Reg 715. Valve FP control bits read back. + U08 valveIOPWMEnableReadback; ///< Reg 716. Valve IO PWM enable read back. + U08 valveFPPWMEnableReadback; ///< Reg 717. Valve FP PWM enable read back. U16 p12PumpPWMReadback; ///< Reg 718. P12 pump PWM read back. U16 p40PumpPWMReadback; ///< Reg 720. P40 pump PWM read back. U08 p7flowReadCount; ///< Reg 722. P7 Flow sensor read counter. @@ -304,7 +306,8 @@ U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control U08 notused; ///< Reg 79. Not used - U16 valveControl; ///< Reg 80. Valve control register. + U08 valveIOControl; ///< Reg 80. Valve IO control register. + U08 valveFPControl; ///< Reg 81. Valve FP control register. U08 conductivityP9Control; ///< Reg 82. P9 conductivity control register. U08 conductivityP18Control; ///< Reg 83. P18 conductivity control register. U16 conductivityP9Address; ///< Reg 84. P9 conductivity address register. @@ -323,7 +326,8 @@ U08 reserved1; ///< Reg 111. Reserved. U08 flowControlp7; ///< Reg 112. P7 AVS Romer flow sensor control register. U08 flowAddressp7; ///< Reg 113. P7 AVS Romer flow sensor I2C slave address register. - U16 valvePWMEnable; ///< Reg 114. Valve PWM enable register. + U08 valveIOPWMEnable; ///< Reg 114. Valve IO PWM enable register. + U08 valveFPPWMEnable; ///< Reg 115. Valve FP PWM enable register. U08 flowControlp16; ///< Reg 116. P16 AVS Romer flow sensor control register. U08 flowAddressp16; ///< Reg 117. P16 AVS Romer flow sensor I2C slave address register. @@ -2812,44 +2816,74 @@ /*********************************************************************//** * @brief - * The setFPGAIOFPValveStates function sets the RO valve states with an 8-bit + * The setFPGAIOValveStates function sets the IO valve states with an 8-bit * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: * 0 - M4.\n - * 1 - P11.\n - * 2 - P33.\n - * 3 - P34.\n - * 4 - P37.\n - * 5 - P39.\n - * 6 - P43.\n - * 7 - P6.\n - * 15:8 - Not used. \n + * 1 - M12.\n + * 2:7- Not used. \n * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints.valveControl + * @details \b Outputs: fpgaActuatorSetPoints.valveIOControl * @param valveStates bit mask for requested valve states * @return none *************************************************************************/ -void setFPGAIOFPValveStates( U16 valveStates ) +void setFPGAIOValveStates( U08 valveStates ) { - fpgaActuatorSetPoints.valveControl = valveStates; + fpgaActuatorSetPoints.valveIOControl = valveStates; } /*********************************************************************//** * @brief - * The getFPGAValveStates function gets the RO valve commanded states with + * The setFPGAFPValveStates function sets the FP valve states with an 8-bit + * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 + * meaning "de-energized". The bit positions for these bit states are as follows: + * 0 - P11.\n + * 1 - P33.\n + * 2 - P34.\n + * 3 - P37.\n + * 4 - P39.\n + * 5 - P6.\n + * 6:7- Not used. \n + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.valveFPControl + * @param valveStates bit mask for requested valve states + * @return none + *************************************************************************/ +void setFPGAFPValveStates( U08 valveStates ) +{ + fpgaActuatorSetPoints.valveFPControl = valveStates; +} + +/*********************************************************************//** + * @brief + * The getFPGAIOValveStates function gets the IO valve commanded states with * an 8-bit mask representing the set of states with a 1 meaning "energized" * and a 0 meaning "de-energized". * @details \b Inputs: none - * @details \b Outputs: fpgaSensorReadings.valveControlReadback + * @details \b Outputs: fpgaSensorReadings.valveIOControlReadback * @return none *************************************************************************/ -U16 getFPGAIOFPValveStates( void ) +U08 getFPGAIOValveStates( void ) { - return fpgaSensorReadings.valveControlReadback; + return fpgaSensorReadings.valveIOControlReadback; } /*********************************************************************//** * @brief + * The getFPGAFPValveStates function gets the FP valve commanded states with + * an 8-bit mask representing the set of states with a 1 meaning "energized" + * and a 0 meaning "de-energized". + * @details \b Inputs: none + * @details \b Outputs: fpgaSensorReadings.valveFPControlReadback + * @return none + *************************************************************************/ +U08 getFPGAFPValveStates( void ) +{ + return fpgaSensorReadings.valveFPControlReadback; +} + +/*********************************************************************//** + * @brief * The setFPGAP12PumpEnable function enables or disables the P12 pump. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.p12PumpControl Index: firmware/App/Services/FpgaDD.h =================================================================== diff -u -r5147570b8c12a721fe05ec9aa5dd38baa6c3a931 -r4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558 --- firmware/App/Services/FpgaDD.h (.../FpgaDD.h) (revision 5147570b8c12a721fe05ec9aa5dd38baa6c3a931) +++ firmware/App/Services/FpgaDD.h (.../FpgaDD.h) (revision 4d6c6df8f990037cb66fbd0efdc4cc5a0ec31558) @@ -233,8 +233,10 @@ //*************** IOFP ******************* -void setFPGAIOFPValveStates( U16 valveStates ); -U16 getFPGAIOFPValveStates( void ); +void setFPGAIOValveStates( U08 valveStates ); +void setFPGAFPValveStates( U08 valveStates ); +U08 getFPGAIOValveStates( void ); +U08 getFPGAFPValveStates( void ); void setFPGAP12PumpEnable( BOOL enable ); void setFPGAP12PumpPWM( U16 pwm );