From b82cc40c58b50ef54eadf7a5b3c8a1d8ee935212 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 29 Oct 2004 00:13:32 +0000 Subject: [PATCH] Make separate left/right flap surface positions in the net_fdm.hxx structure for future use. Right now they are tied together. --- src/Network/atc610x.cxx | 33 ++++++++++++++++++++++++++++----- src/Network/native_fdm.cxx | 15 +++++++++++---- src/Network/net_fdm.hxx | 5 +++-- src/Replay/replay.cxx | 3 ++- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/Network/atc610x.cxx b/src/Network/atc610x.cxx index e4822da58..0f164ddf6 100644 --- a/src/Network/atc610x.cxx +++ b/src/Network/atc610x.cxx @@ -1251,21 +1251,31 @@ bool FGATC610x::do_radio_switches() { // ADF buttons +#define CURT_HARDWARE fgSetInt( "/radios/kr-87/inputs/adf-btn", (radio_switch_data[23] & 0x01) ); fgSetInt( "/radios/kr-87/inputs/bfo-btn", (radio_switch_data[23] >> 1 & 0x01) ); -#ifdef CURT_HARDWARE - fgSetInt( "/radios/kr-87/inputs/frq-btn", - !(radio_switch_data[23] >> 2 & 0x01) ); -#else + fgSetInt( "/radios/kr-87/inputs/frq-btn", (radio_switch_data[23] >> 2 & 0x01) ); -#endif + +#ifdef CURT_HARDWARE + fgSetInt( "/radios/kr-87/inputs/flt-et-btn", + !(radio_switch_data[23] >> 3 & 0x01) ); +#else fgSetInt( "/radios/kr-87/inputs/flt-et-btn", (radio_switch_data[23] >> 3 & 0x01) ); +#endif + +#ifdef CURT_HARDWARE + fgSetInt( "/radios/kr-87/inputs/set-rst-btn", + !(radio_switch_data[23] >> 4 & 0x01) ); +#else fgSetInt( "/radios/kr-87/inputs/set-rst-btn", (radio_switch_data[23] >> 4 & 0x01) ); +#endif + fgSetInt( "/radios/kr-87/inputs/power-btn", radio_switch_data[23] >> 5 & 0x01 ); /* cout << "adf = " << !(radio_switch_data[23] & 0x01) @@ -1767,6 +1777,18 @@ bool FGATC610x::do_switches() { update_switch_matrix( board, switch_data, switch_matrix ); // master switches +#define CURT_HARDWARE +#ifdef CURT_HARDWARE + fgSetBool( "/controls/engines/engine[0]/master-bat", + switch_matrix[board][5][1] ); + fgSetBool( "/controls/engines/engine[1]/master-bat", + switch_matrix[board][5][1] ); + + fgSetBool( "/controls/engines/engine[0]/master-alt", + switch_matrix[board][4][1] ); + fgSetBool( "/controls/engines/engine[1]/master-alt", + switch_matrix[board][4][1] ); +#else fgSetBool( "/controls/engines/engine[0]/master-bat", switch_matrix[board][4][1] ); fgSetBool( "/controls/engines/engine[1]/master-bat", @@ -1776,6 +1798,7 @@ bool FGATC610x::do_switches() { switch_matrix[board][5][1] ); fgSetBool( "/controls/engines/engine[1]/master-alt", switch_matrix[board][5][1] ); +#endif fgSetBool( "/controls/switches/master-avionics", switch_matrix[board][0][3] ); diff --git a/src/Network/native_fdm.cxx b/src/Network/native_fdm.cxx index 939c93dda..6b8393136 100644 --- a/src/Network/native_fdm.cxx +++ b/src/Network/native_fdm.cxx @@ -205,7 +205,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { net->elevator = node->getDoubleValue( "elevator-pos-norm" ); net->elevator_trim_tab = node->getDoubleValue( "elevator-trim-tab-pos-norm" ); - net->flaps = node->getDoubleValue( "flap-pos-norm" ); + // FIXME: CLO 10/28/04 - This really should be separated out into 2 values + net->left_flap = node->getDoubleValue( "flap-pos-norm" ); + net->right_flap = node->getDoubleValue( "flap-pos-norm" ); net->left_aileron = node->getDoubleValue( "left-aileron-pos-norm" ); net->right_aileron = node->getDoubleValue( "right-aileron-pos-norm" ); net->rudder = node->getDoubleValue( "rudder-pos-norm" ); @@ -276,7 +278,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) { htonf(net->elevator); htonf(net->elevator_trim_tab); - htonf(net->flaps); + htonf(net->left_flap); + htonf(net->right_flap); htonf(net->left_aileron); htonf(net->right_aileron); htonf(net->rudder); @@ -353,7 +356,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) { htonf(net->elevator); htonf(net->elevator_trim_tab); - htonf(net->flaps); + htonf(net->left_flap); + htonf(net->right_flap); htonf(net->left_aileron); htonf(net->right_aileron); htonf(net->rudder); @@ -457,7 +461,10 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) { node->setDoubleValue("elevator-pos-norm", net->elevator); node->setDoubleValue("elevator-trim-tab-pos-norm", net->elevator_trim_tab); - node->setDoubleValue("flap-pos-norm", net->flaps); + // FIXME: CLO 10/28/04 - This really should be separated out + // into 2 values + node->setDoubleValue("flap-pos-norm", net->left_flap); + node->setDoubleValue("flap-pos-norm", net->right_flap); node->setDoubleValue("left-aileron-pos-norm", net->left_aileron); node->setDoubleValue("right-aileron-pos-norm", net->right_aileron); node->setDoubleValue("rudder-pos-norm", net->rudder); diff --git a/src/Network/net_fdm.hxx b/src/Network/net_fdm.hxx index 160a54ba6..d9419be72 100644 --- a/src/Network/net_fdm.hxx +++ b/src/Network/net_fdm.hxx @@ -18,7 +18,7 @@ #include // time_t -const int FG_NET_FDM_VERSION = 18; +const int FG_NET_FDM_VERSION = 19; // Define a structure containing the top level flight dynamics model @@ -107,7 +107,8 @@ public: // Control surface positions (normalized values) float elevator; float elevator_trim_tab; - float flaps; + float left_flap; + float right_flap; float left_aileron; float right_aileron; float rudder; diff --git a/src/Replay/replay.cxx b/src/Replay/replay.cxx index ac91a71aa..0e4249e42 100644 --- a/src/Replay/replay.cxx +++ b/src/Replay/replay.cxx @@ -299,7 +299,8 @@ static FGReplayData interpolate( double time, FGReplayData f1, FGReplayData f2 ) // Control surface positions (normalized values) result.fdm.elevator = weight( fdm1.elevator, fdm2.elevator, ratio ); - result.fdm.flaps = weight( fdm1.flaps, fdm2.flaps, ratio ); + result.fdm.left_flap = weight( fdm1.left_flap, fdm2.left_flap, ratio ); + result.fdm.right_flap = weight( fdm1.right_flap, fdm2.right_flap, ratio ); result.fdm.left_aileron = weight( fdm1.left_aileron, fdm2.left_aileron, ratio ); result.fdm.right_aileron -- 2.39.5