]> git.mxchange.org Git - flightgear.git/commitdiff
native_ctrls:
authorcurt <curt>
Fri, 2 Apr 2004 16:19:59 +0000 (16:19 +0000)
committercurt <curt>
Fri, 2 Apr 2004 16:19:59 +0000 (16:19 +0000)
- We need to be able to support a per engine master bat/alt switch.
- Forgot to write the gear level state into the network structure.

native_fdm:
- renamed EGT->egt for consistancy.
- added manifold pressure to the structure.

src/Network/native_ctrls.cxx
src/Network/native_fdm.cxx
src/Network/net_ctrls.hxx
src/Network/net_fdm.hxx

index ace029444b4b5f3ce154fb3a07e06f99cf9193e0..10e78028b10ce106df847803fcd21b8f27bc3ca4 100644 (file)
@@ -125,6 +125,16 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         node = fgGetNode("/controls/engines/engine", i );
         starter = fgGetNode("/systems/electrical/outputs/starter", i );
         fuelpump = fgGetNode("/systems/electrical/outputs/fuel-pump", i );
+
+        tempnode = node->getChild("master-bat");
+        if ( tempnode != NULL ) {
+            net->master_bat[i] = tempnode->getBoolValue();
+        }
+        tempnode = node->getChild("master-alt");
+        if ( tempnode != NULL ) {
+            net->master_alt[i] = tempnode->getBoolValue();
+        }
+
         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 );
@@ -178,15 +188,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
     net->brake_right = node->getChild("brake-right")->getDoubleValue();
     net->brake_parking = node->getChild("brake-parking")->getDoubleValue();
 
-    node = fgGetNode("/controls/switches", true);
-    tempnode = node->getChild("master-bat");
-    if ( tempnode != NULL ) {
-        net->master_bat = tempnode->getBoolValue();
-    }
-    tempnode = node->getChild("master-alt");
-    if ( tempnode != NULL ) {
-        net->master_alt = tempnode->getBoolValue();
-    }
+    net->gear_handle = fgGetBool( "controls/gear/gear-down" );
+
     tempnode = node->getChild("master-avionics");
     if ( tempnode != NULL ) {
         net->master_avionics = tempnode->getBoolValue();
@@ -232,6 +235,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         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 ) {
+            net->master_bat[i] = htonl(net->master_bat[i]);
+            net->master_alt[i] = htonl(net->master_alt[i]);
             net->magnetos[i] = htonl(net->magnetos[i]);
             net->starter_power[i] = htonl(net->starter_power[i]);
             htond(net->throttle[i]);
@@ -254,8 +259,6 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
         htond(net->brake_right);
         htond(net->brake_parking);
         net->gear_handle = htonl(net->gear_handle);
-        net->master_bat = htonl(net->master_bat);
-        net->master_alt = htonl(net->master_alt);
         net->master_avionics = htonl(net->master_avionics);
         htond(net->wind_speed_kt);
         htond(net->wind_dir_deg);
@@ -290,6 +293,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         net->flap_motor_ok = htonl(net->flap_motor_ok);
         net->num_engines = htonl(net->num_engines);
         for ( i = 0; i < net->num_engines; ++i ) {
+            net->master_bat[i] = htonl(net->master_bat[i]);
+            net->master_alt[i] = htonl(net->master_alt[i]);
             net->magnetos[i] = htonl(net->magnetos[i]);
             net->starter_power[i] = htonl(net->starter_power[i]);
             htond(net->throttle[i]);
@@ -311,8 +316,6 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
         htond(net->brake_right);
         htond(net->brake_parking);
         net->gear_handle = htonl(net->gear_handle);
-        net->master_bat = htonl(net->master_bat);
-        net->master_alt = htonl(net->master_alt);
         net->master_avionics = htonl(net->master_avionics);
         htond(net->wind_speed_kt);
         htond(net->wind_dir_deg);
index c80c41056be9111f1f740e55b6e95fe5dd1d6f0a..939c93dda248435272b916c2c9820d87f7601809 100644 (file)
@@ -171,8 +171,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         }
         net->rpm[i] = node->getDoubleValue( "rpm" );
         net->fuel_flow[i] = node->getDoubleValue( "fuel-flow-gph" );
-        net->EGT[i] = node->getDoubleValue( "egt-degf" );
+        net->egt[i] = node->getDoubleValue( "egt-degf" );
         // cout << "egt = " << aero->EGT << endl;
+        net->mp_osi[i] = node->getDoubleValue( "mp-osi" );
         net->oil_temp[i] = node->getDoubleValue( "oil-temperature-degf" );
         net->oil_px[i] = node->getDoubleValue( "oil-pressure-psi" );
     }
@@ -249,7 +250,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
             net->eng_state[i] = htonl(net->eng_state[i]);
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
-            htonf(net->EGT[i]);
+            htonf(net->egt[i]);
+            htonf(net->mp_osi[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -326,7 +328,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
             net->eng_state[i] = htonl(net->eng_state[i]);
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
-            htonf(net->EGT[i]);
+            htonf(net->egt[i]);
+            htonf(net->mp_osi[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -420,7 +423,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
 
            node->setDoubleValue( "rpm", net->rpm[i] );
            node->setDoubleValue( "fuel-flow-gph", net->fuel_flow[i] );
-           node->setDoubleValue( "egt-degf", net->EGT[i] );
+           node->setDoubleValue( "egt-degf", net->egt[i] );
+           node->setDoubleValue( "mp-osi", net->mp_osi[i] );
            node->setDoubleValue( "oil-temperature-degf", net->oil_temp[i] );
            node->setDoubleValue( "oil-pressure-psi", net->oil_px[i] );         
        }
index 26b3bc62a63885578d24cda467ee4fa7e794a536..31f21cb51a845da70f603cd74d2a5f6cf7cf19c4 100644 (file)
@@ -16,7 +16,7 @@
 # error This library requires C++
 #endif                                   
 
-const int FG_NET_CTRLS_VERSION = 19;
+const int FG_NET_CTRLS_VERSION = 20;
 
 
 // Define a structure containing the control parameters
@@ -46,6 +46,8 @@ public:
 
     // Engine controls
     int num_engines;                    // number of valid engines
+    bool master_bat[FG_MAX_ENGINES];
+    bool master_alt[FG_MAX_ENGINES];
     int magnetos[FG_MAX_ENGINES];
     bool starter_power[FG_MAX_ENGINES];  // true = starter power
     double throttle[FG_MAX_ENGINES];     //  0 ... 1
@@ -57,7 +59,7 @@ public:
     bool engine_ok[FG_MAX_ENGINES];
     bool mag_left_ok[FG_MAX_ENGINES];
     bool mag_right_ok[FG_MAX_ENGINES];
-    bool spark_plugs_ok[FG_MAX_ENGINES]; // false = fouled plugs
+    bool spark_plugs_ok[FG_MAX_ENGINES];  // false = fouled plugs
     int oil_press_status[FG_MAX_ENGINES]; // 0 = normal, 1 = low, 2 = full fail
     bool fuel_pump_ok[FG_MAX_ENGINES];
 
@@ -74,8 +76,6 @@ public:
     bool gear_handle; // true=gear handle down; false= gear handle up
 
     // Switches
-    bool master_bat;
-    bool master_alt;
     bool master_avionics;
 
     // wind and turbulance
index d9c0f33dd065e88f183ae6c93a6b61249fcb8546..160a54ba6313c9027b1cbb4bf404253c25a823f8 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <time.h> // time_t
 
-const int FG_NET_FDM_VERSION = 17;
+const int FG_NET_FDM_VERSION = 18;
 
 
 // Define a structure containing the top level flight dynamics model
@@ -79,13 +79,14 @@ public:
     // Pressure
     
     // Engine status
-    int num_engines;           // Number of valid engines
-    int eng_state[FG_MAX_ENGINES]; // Engine state (off, cranking, running)
-    float rpm[FG_MAX_ENGINES]; // Engine RPM rev/min
+    int num_engines;                // Number of valid engines
+    int eng_state[FG_MAX_ENGINES];   // Engine state (off, cranking, running)
+    float rpm[FG_MAX_ENGINES];      // Engine RPM rev/min
     float fuel_flow[FG_MAX_ENGINES]; // Fuel flow gallons/hr
-    float EGT[FG_MAX_ENGINES]; // Exhuast gas temp deg F
-    float oil_temp[FG_MAX_ENGINES]; // Oil temp deg F
-    float oil_px[FG_MAX_ENGINES]; // Oil pressure psi
+    float egt[FG_MAX_ENGINES];      // Exhuast gas temp deg F
+    float mp_osi[FG_MAX_ENGINES];    // Manifold pressure
+    float oil_temp[FG_MAX_ENGINES];  // Oil temp deg F
+    float oil_px[FG_MAX_ENGINES];    // Oil pressure psi
 
     // Consumables
     int num_tanks;             // Max number of fuel tanks