Add support for communicating a flap motor failure.
This commit is contained in:
parent
562ce6f5e2
commit
807c4047dd
3 changed files with 10 additions and 7 deletions
|
@ -113,10 +113,10 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
||||||
net->elevator_trim = node->getDoubleValue( "elevator-trim" );
|
net->elevator_trim = node->getDoubleValue( "elevator-trim" );
|
||||||
net->rudder = node->getDoubleValue( "rudder" );
|
net->rudder = node->getDoubleValue( "rudder" );
|
||||||
net->flaps = node->getDoubleValue( "flaps" );
|
net->flaps = node->getDoubleValue( "flaps" );
|
||||||
node = fgGetNode("/controls", true);
|
|
||||||
net->flaps_power
|
net->flaps_power
|
||||||
= node->getDoubleValue( "/systems/electrical/outputs/flaps",
|
= fgGetDouble( "/systems/electrical/outputs/flaps", 1.0 ) >= 1.0;
|
||||||
1.0 ) >= 1.0;
|
net->flap_motor_ok = node->getBoolValue( "flaps-serviceable" );
|
||||||
|
|
||||||
net->num_engines = FGNetCtrls::FG_MAX_ENGINES;
|
net->num_engines = FGNetCtrls::FG_MAX_ENGINES;
|
||||||
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
||||||
// Controls
|
// Controls
|
||||||
|
@ -229,6 +229,7 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
||||||
htond(net->rudder);
|
htond(net->rudder);
|
||||||
htond(net->flaps);
|
htond(net->flaps);
|
||||||
net->flaps_power = htonl(net->flaps_power);
|
net->flaps_power = htonl(net->flaps_power);
|
||||||
|
net->flap_motor_ok = htonl(net->flap_motor_ok);
|
||||||
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
||||||
net->magnetos[i] = htonl(net->magnetos[i]);
|
net->magnetos[i] = htonl(net->magnetos[i]);
|
||||||
net->starter_power[i] = htonl(net->starter_power[i]);
|
net->starter_power[i] = htonl(net->starter_power[i]);
|
||||||
|
@ -284,6 +285,7 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
htond(net->rudder);
|
htond(net->rudder);
|
||||||
htond(net->flaps);
|
htond(net->flaps);
|
||||||
net->flaps_power = htonl(net->flaps_power);
|
net->flaps_power = htonl(net->flaps_power);
|
||||||
|
net->flap_motor_ok = htonl(net->flap_motor_ok);
|
||||||
net->num_engines = htonl(net->num_engines);
|
net->num_engines = htonl(net->num_engines);
|
||||||
for ( i = 0; i < net->num_engines; ++i ) {
|
for ( i = 0; i < net->num_engines; ++i ) {
|
||||||
net->magnetos[i] = htonl(net->magnetos[i]);
|
net->magnetos[i] = htonl(net->magnetos[i]);
|
||||||
|
@ -333,8 +335,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
node->setDoubleValue( "elevator-trim", net->elevator_trim );
|
node->setDoubleValue( "elevator-trim", net->elevator_trim );
|
||||||
node->setDoubleValue( "rudder", net->rudder );
|
node->setDoubleValue( "rudder", net->rudder );
|
||||||
node->setDoubleValue( "flaps", net->flaps );
|
node->setDoubleValue( "flaps", net->flaps );
|
||||||
|
|
||||||
fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
|
fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
|
||||||
|
node->setBoolValue( "flaps-serviceable", net->flap_motor_ok );
|
||||||
|
|
||||||
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
||||||
// Controls
|
// Controls
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int FG_NET_CTRLS_VERSION = 15;
|
const int FG_NET_CTRLS_VERSION = 16;
|
||||||
|
|
||||||
|
|
||||||
// Define a structure containing the control parameters
|
// Define a structure containing the control parameters
|
||||||
|
@ -56,6 +56,7 @@ public:
|
||||||
|
|
||||||
// Aero control faults
|
// Aero control faults
|
||||||
bool flaps_power; // true = power available
|
bool flaps_power; // true = power available
|
||||||
|
bool flap_motor_ok;
|
||||||
|
|
||||||
// Engine controls
|
// Engine controls
|
||||||
int num_engines; // number of valid engines
|
int num_engines; // number of valid engines
|
||||||
|
|
|
@ -315,8 +315,8 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 )
|
||||||
= weight( ctrls1.elevator_trim, ctrls2.elevator_trim, ratio );
|
= weight( ctrls1.elevator_trim, ctrls2.elevator_trim, ratio );
|
||||||
result.ctrls.rudder = weight( ctrls1.rudder, ctrls2.rudder, ratio );
|
result.ctrls.rudder = weight( ctrls1.rudder, ctrls2.rudder, ratio );
|
||||||
result.ctrls.flaps = weight( ctrls1.flaps, ctrls2.flaps, ratio );
|
result.ctrls.flaps = weight( ctrls1.flaps, ctrls2.flaps, ratio );
|
||||||
result.ctrls.flaps_power
|
result.ctrls.flaps_power = ctrls1.flaps_power;
|
||||||
= weight( ctrls1.flaps_power, ctrls2.flaps_power, ratio );
|
result.ctrls.flap_motor_ok = ctrls1.flap_motor_ok;
|
||||||
|
|
||||||
// Engine controls
|
// Engine controls
|
||||||
for ( i = 0; i < ctrls1.num_engines; ++i ) {
|
for ( i = 0; i < ctrls1.num_engines; ++i ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue