Gene Buckle:
Patches to allow control of more than 1 (up to 10) ejection seats, and control them with more flexibility. A particular ejectection seat can be disarmed or failed, in which case it can't be ejected until it is armed or fixed.
This commit is contained in:
parent
a26b60cdf9
commit
663a707b3d
2 changed files with 107 additions and 11 deletions
|
@ -102,7 +102,6 @@ FGControls::FGControls() :
|
||||||
release_ALL( false ),
|
release_ALL( false ),
|
||||||
vertical_adjust( 0.0 ),
|
vertical_adjust( 0.0 ),
|
||||||
fore_aft_adjust( 0.0 ),
|
fore_aft_adjust( 0.0 ),
|
||||||
eject( false ),
|
|
||||||
off_start_run( 0 ),
|
off_start_run( 0 ),
|
||||||
APU_fire_switch( false ),
|
APU_fire_switch( false ),
|
||||||
autothrottle_arm( false ),
|
autothrottle_arm( false ),
|
||||||
|
@ -166,7 +165,9 @@ void FGControls::reset_all()
|
||||||
landing_lights = false;
|
landing_lights = false;
|
||||||
turn_off_lights = false;
|
turn_off_lights = false;
|
||||||
master_arm = false;
|
master_arm = false;
|
||||||
eject = false;
|
set_ejection_seat( ALL_EJECTION_SEATS, false );
|
||||||
|
set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
|
||||||
|
set_cmd_selector_valve( CMD_SEL_NORM );
|
||||||
APU_fire_switch = false;
|
APU_fire_switch = false;
|
||||||
autothrottle_arm = false;
|
autothrottle_arm = false;
|
||||||
autothrottle_engage = false;
|
autothrottle_engage = false;
|
||||||
|
@ -681,9 +682,30 @@ FGControls::bind ()
|
||||||
&FGControls::set_fore_aft_adjust);
|
&FGControls::set_fore_aft_adjust);
|
||||||
fgSetArchivable("/controls/seat/fore-aft-adjust");
|
fgSetArchivable("/controls/seat/fore-aft-adjust");
|
||||||
|
|
||||||
fgTie("/controls/seat/eject", this,
|
for (index = 0; index < MAX_EJECTION_SEATS; index++) {
|
||||||
&FGControls::get_eject, &FGControls::set_eject);
|
char name[MAX_NAME_LEN];
|
||||||
fgSetArchivable("/controls/seat/eject");
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/seat/eject[%d]/initiate", index);
|
||||||
|
fgTie(name, this, index,
|
||||||
|
&FGControls::get_ejection_seat,
|
||||||
|
&FGControls::set_ejection_seat);
|
||||||
|
fgSetArchivable(name);
|
||||||
|
|
||||||
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/seat/eject[%d]/status", index);
|
||||||
|
|
||||||
|
fgTie(name, this, index,
|
||||||
|
&FGControls::get_eseat_status,
|
||||||
|
&FGControls::set_eseat_status);
|
||||||
|
|
||||||
|
fgSetArchivable(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
fgTie("/controls/seat/cmd_selector_valve", this,
|
||||||
|
&FGControls::get_cmd_selector_valve,
|
||||||
|
&FGControls::set_cmd_selector_valve);
|
||||||
|
fgSetArchivable("/controls/seat/eject/cmd_selector_valve");
|
||||||
|
|
||||||
|
|
||||||
// APU
|
// APU
|
||||||
fgTie("/controls/APU/off-start-run", this,
|
fgTie("/controls/APU/off-start-run", this,
|
||||||
|
@ -942,7 +964,17 @@ void FGControls::unbind ()
|
||||||
#endif
|
#endif
|
||||||
fgUntie("/controls/seat/vertical-adjust");
|
fgUntie("/controls/seat/vertical-adjust");
|
||||||
fgUntie("/controls/seat/fore-aft-adjust");
|
fgUntie("/controls/seat/fore-aft-adjust");
|
||||||
fgUntie("/controls/seat/eject");
|
for (index = 0; index < MAX_EJECTION_SEATS; index++) {
|
||||||
|
char name[MAX_NAME_LEN];
|
||||||
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/seat/eject[%d]/initiate", index);
|
||||||
|
fgUntie(name);
|
||||||
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/seat/eject[%d]/status", index);
|
||||||
|
fgUntie(name);
|
||||||
|
}
|
||||||
|
fgUntie("/controls/seat/cmd_selector_valve");
|
||||||
|
|
||||||
fgUntie("/controls/APU/off-start-run");
|
fgUntie("/controls/APU/off-start-run");
|
||||||
fgUntie("/controls/APU/fire-switch");
|
fgUntie("/controls/APU/fire-switch");
|
||||||
for (index = 0; index < MAX_AUTOPILOTS; index++) {
|
for (index = 0; index < MAX_AUTOPILOTS; index++) {
|
||||||
|
@ -2033,11 +2065,47 @@ FGControls::move_fore_aft_adjust( double amt )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGControls::set_eject( bool val )
|
FGControls::set_ejection_seat( int which_seat, bool val )
|
||||||
{
|
{
|
||||||
eject = val;
|
if ( which_seat == ALL_EJECTION_SEATS ) {
|
||||||
|
for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
|
||||||
|
eject[i] = val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( (which_seat >= 0) && (which_seat <= MAX_EJECTION_SEATS) ) {
|
||||||
|
if ( eseat_status[which_seat] == SEAT_SAFED ||
|
||||||
|
eseat_status[which_seat] == SEAT_FAIL )
|
||||||
|
{
|
||||||
|
// we can never eject if SEAT_SAFED or SEAT_FAIL
|
||||||
|
val = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
eject[which_seat] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGControls::set_eseat_status( int which_seat, int val )
|
||||||
|
{
|
||||||
|
if ( which_seat == ALL_EJECTION_SEATS ) {
|
||||||
|
for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
|
||||||
|
eseat_status[i] = val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
|
||||||
|
eseat_status[which_seat] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGControls::set_cmd_selector_valve( int val )
|
||||||
|
{
|
||||||
|
cmd_selector_valve = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FGControls::set_off_start_run( int pos )
|
FGControls::set_off_start_run( int pos )
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,23 @@ public:
|
||||||
MAX_AUTOPILOTS = 3
|
MAX_AUTOPILOTS = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ALL_EJECTION_SEATS = -1,
|
||||||
|
MAX_EJECTION_SEATS = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SEAT_SAFED = -1,
|
||||||
|
SEAT_ARMED = 0,
|
||||||
|
SEAT_FAIL = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CMD_SEL_NORM = -1,
|
||||||
|
CMD_SEL_AFT = 0,
|
||||||
|
CMD_SEL_SOLO = 1
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// controls/flight/
|
// controls/flight/
|
||||||
double aileron;
|
double aileron;
|
||||||
|
@ -211,7 +228,9 @@ private:
|
||||||
// controls/seat/
|
// controls/seat/
|
||||||
double vertical_adjust;
|
double vertical_adjust;
|
||||||
double fore_aft_adjust;
|
double fore_aft_adjust;
|
||||||
bool eject;
|
bool eject[MAX_EJECTION_SEATS];
|
||||||
|
int eseat_status[MAX_EJECTION_SEATS];
|
||||||
|
int cmd_selector_valve;
|
||||||
|
|
||||||
// controls/APU/
|
// controls/APU/
|
||||||
int off_start_run;
|
int off_start_run;
|
||||||
|
@ -394,7 +413,14 @@ public:
|
||||||
// controls/seat/
|
// controls/seat/
|
||||||
inline double get_vertical_adjust() const { return vertical_adjust; }
|
inline double get_vertical_adjust() const { return vertical_adjust; }
|
||||||
inline double get_fore_aft_adjust() const { return fore_aft_adjust; }
|
inline double get_fore_aft_adjust() const { return fore_aft_adjust; }
|
||||||
inline bool get_eject() const { return eject; }
|
inline bool get_ejection_seat( int which_seat ) const {
|
||||||
|
return eject[which_seat];
|
||||||
|
}
|
||||||
|
inline int get_eseat_status( int which_seat ) const {
|
||||||
|
return eseat_status[which_seat];
|
||||||
|
}
|
||||||
|
inline int get_cmd_selector_valve() const { return cmd_selector_valve; }
|
||||||
|
|
||||||
|
|
||||||
// controls/APU/
|
// controls/APU/
|
||||||
inline int get_off_start_run() const { return off_start_run; }
|
inline int get_off_start_run() const { return off_start_run; }
|
||||||
|
@ -571,7 +597,9 @@ public:
|
||||||
void move_vertical_adjust( double amt );
|
void move_vertical_adjust( double amt );
|
||||||
void set_fore_aft_adjust( double pos );
|
void set_fore_aft_adjust( double pos );
|
||||||
void move_fore_aft_adjust( double amt );
|
void move_fore_aft_adjust( double amt );
|
||||||
void set_eject( bool val );
|
void set_ejection_seat( int which_seat, bool val );
|
||||||
|
void set_eseat_status( int which_seat, int val );
|
||||||
|
void set_cmd_selector_valve( int val );
|
||||||
|
|
||||||
// controls/APU/
|
// controls/APU/
|
||||||
void set_off_start_run( int pos );
|
void set_off_start_run( int pos );
|
||||||
|
|
Loading…
Add table
Reference in a new issue