1
0
Fork 0

Clean up a couple bugs in the multiengine handling of the net_fdm.hxx

external interface.
This commit is contained in:
curt 2004-04-02 01:54:38 +00:00
parent 95e8b63988
commit 92010f9f94
3 changed files with 23 additions and 10 deletions

View file

@ -1801,6 +1801,7 @@ bool FGATC610x::do_switches() {
mag1 = magnetos;
if ( mag1 == mag2 && mag2 == mag3 ) {
fgSetInt( "/controls/engines/engine[0]/magnetos", magnetos );
fgSetInt( "/controls/engines/engine[1]/magnetos", magnetos );
}
static bool start1, start2, start3;
start3 = start2;
@ -1808,12 +1809,15 @@ bool FGATC610x::do_switches() {
start1 = starter;
if ( start1 == start2 && start2 == start3 ) {
fgSetBool( "/controls/engines/engine[0]/starter", starter );
fgSetBool( "/controls/engines/engine[1]/starter", starter );
}
}
// other toggle switches
fgSetBool( "/controls/engines/engine[0]/fuel-pump",
switch_matrix[board][0][2] );
fgSetBool( "/controls/engines/engine[1]/fuel-pump",
switch_matrix[board][0][2] );
fgSetBool( "/controls/switches/flashing-beacon",
switch_matrix[board][1][2] );
fgSetBool( "/controls/switches/landing-light", switch_matrix[board][2][2] );

View file

@ -103,6 +103,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
{
int i;
SGPropertyNode *node;
SGPropertyNode *starter;
SGPropertyNode *fuelpump;
SGPropertyNode *tempnode;
// fill in values
@ -121,7 +123,9 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
// Controls
node = fgGetNode("/controls/engines/engine", i );
net->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
starter = fgGetNode("/systems/electrical/outputs/starter", i );
fuelpump = fgGetNode("/systems/electrical/outputs/fuel-pump", i );
net->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
net->mixture[i] = node->getDoubleValue( "mixture", 0.0 );
net->prop_advance[i] = node->getDoubleValue( "propeller-pitch", 0.0 );
net->magnetos[i] = node->getIntValue( "magnetos", 0 );
@ -132,13 +136,18 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
// cout << "Starter -> " << node->getIntValue( "starter", false )
// << endl;
}
net->fuel_pump_power[i]
= node->getDoubleValue( "/systems/electrical/outputs/fuel-pump",
1.0 ) >= 1.0;
net->starter_power[i]
= node->getDoubleValue( "/systems/electrical/outputs/starter",
1.0 ) >= 1.0;
if ( fuelpump != NULL ) {
net->fuel_pump_power[i] = ( fuelpump->getDoubleValue() >= 1.0 );
} else {
net->fuel_pump_power[i] = 0.0;
}
if ( starter != NULL ) {
net->starter_power[i] = ( starter->getDoubleValue() >= 1.0 );
} else {
net->starter_power[i] = 0.0;
}
// Faults
SGPropertyNode *faults = node->getChild( "faults", 0, true );

View file

@ -163,11 +163,11 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
for ( i = 0; i < net->num_engines; ++i ) {
SGPropertyNode *node = fgGetNode("engines/engine", i, true);
if ( node->getBoolValue( "running" ) ) {
net->eng_state[0] = 2;
net->eng_state[i] = 2;
} else if ( node->getBoolValue( "cranking" ) ) {
net->eng_state[0] = 1;
net->eng_state[i] = 1;
} else {
net->eng_state[0] = 0;
net->eng_state[i] = 0;
}
net->rpm[i] = node->getDoubleValue( "rpm" );
net->fuel_flow[i] = node->getDoubleValue( "fuel-flow-gph" );