]> git.mxchange.org Git - flightgear.git/commitdiff
Merge branch 'next' of gitorious.org:fg/flightgear into next
authorCurtis L. Olson <curt@connie.flightgear.org>
Thu, 24 Mar 2011 19:32:50 +0000 (14:32 -0500)
committerCurtis L. Olson <curt@connie.flightgear.org>
Thu, 24 Mar 2011 19:32:50 +0000 (14:32 -0500)
src/Environment/realwx_ctrl.cxx
src/FDM/JSBSim/JSBSim.cxx
src/FDM/JSBSim/JSBSim.hxx
src/Main/main.cxx
src/Sound/voiceplayer.cxx

index 03db5a87a1b8363106b57b54afd721d6f632f1ff..621fb11c3c829ba76c0c98214937c049aab5837f 100644 (file)
@@ -40,6 +40,7 @@
 #include <simgear/threads/SGQueue.hxx>
 #endif
 
+using simgear::PropertyList;
 
 namespace Environment {
 
index 0eb21888e30cf6c994f3a3a8fcafe5ed32cb45af..e2d98b673d2fd2bf68b9c278eb2601b176ba7743 100644 (file)
@@ -570,6 +570,22 @@ void FGJSBsim::update( double dt )
 
 /******************************************************************************/
 
+void FGJSBsim::suspend()
+{
+  fdmex->Hold();
+  SGSubsystem::suspend();
+}
+
+/******************************************************************************/
+
+void FGJSBsim::resume()
+{
+  fdmex->Resume();
+  SGSubsystem::resume();
+}
+
+/******************************************************************************/
+
 // Convert from the FGInterface struct to the JSBsim generic_ struct
 
 bool FGJSBsim::copy_to_JSBsim()
@@ -1011,7 +1027,9 @@ void FGJSBsim::set_Latitude(double lat)
     _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET  );
     fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET  );
     fgic->SetLatitudeRadIC( lat_geoc );
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 
@@ -1024,7 +1042,9 @@ void FGJSBsim::set_Longitude(double lon)
 
     update_ic();
     fgic->SetLongitudeRadIC( lon );
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 // Sets the altitude above sea level.
@@ -1049,7 +1069,9 @@ void FGJSBsim::set_Altitude(double alt)
           "Terrain elevation: " << FGInterface::get_Runway_altitude() * SG_METER_TO_FEET );
     fgic->SetLatitudeRadIC( lat_geoc );
     fgic->SetAltitudeASLFtIC(alt);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::set_V_calibrated_kts(double vc)
@@ -1061,7 +1083,9 @@ void FGJSBsim::set_V_calibrated_kts(double vc)
 
     update_ic();
     fgic->SetVcalibratedKtsIC(vc);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::set_Mach_number(double mach)
@@ -1073,7 +1097,9 @@ void FGJSBsim::set_Mach_number(double mach)
 
     update_ic();
     fgic->SetMachIC(mach);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::set_Velocities_Local( double north, double east, double down )
@@ -1088,7 +1114,9 @@ void FGJSBsim::set_Velocities_Local( double north, double east, double down )
     fgic->SetVNorthFpsIC(north);
     fgic->SetVEastFpsIC(east);
     fgic->SetVDownFpsIC(down);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
@@ -1103,7 +1131,9 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
     fgic->SetUBodyFpsIC(u);
     fgic->SetVBodyFpsIC(v);
     fgic->SetWBodyFpsIC(w);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 //Euler angles
@@ -1119,7 +1149,9 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi )
     fgic->SetThetaRadIC(theta);
     fgic->SetPhiRadIC(phi);
     fgic->SetPsiRadIC(psi);
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 //Flight Path
@@ -1137,7 +1169,9 @@ void FGJSBsim::set_Climb_Rate( double roc)
     if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) {
       fgic->SetClimbRateFpsIC(roc);
     }
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::set_Gamma_vert_rad( double gamma)
@@ -1148,7 +1182,9 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma)
     if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
       fgic->SetFlightPathAngleRadIC(gamma);
     }
-    needTrim=true;
+
+    if (!fdmex->Holding())
+      needTrim=true;
 }
 
 void FGJSBsim::init_gear(void )
index a01146bcc0447aa5e06b744707553081e9cb7dd7..ca52f9223f3356ce852e463be64895a4c20918bd 100644 (file)
@@ -113,6 +113,12 @@ public:
     /// Unbind properties
     void unbind();
 
+    /// Suspend integration
+    void suspend();
+
+    /// Resume integration
+    void resume();
+
     /// @name Position Parameter Set
     //@{
     /** Set geocentric latitude
index 677d0f36bca67f2871048d0ae0289eddf98f9ee8..33bb062bbe081950e78252babb3120cfcf214111 100644 (file)
@@ -121,6 +121,15 @@ static void fgMainLoop( void ) {
     static SGPropertyNode_ptr frame_signal
         = fgGetNode("/sim/signals/frame", true);
 
+    static SGPropertyNode_ptr _statisticsFlag
+        = fgGetNode("/sim/timing-statistics/enabled", true);
+    static SGPropertyNode_ptr _statisticsInterval
+        = fgGetNode("/sim/timing-statistics/interval-s", true);
+    static SGPropertyNode_ptr _statiticsMinJitter
+        = fgGetNode("/sim/timing-statistics/min-jitter-ms", true);
+    static SGPropertyNode_ptr _statiticsMinTime
+        = fgGetNode("/sim/timing-statistics/min-time-ms", true);
+
     frame_signal->fireValueChanged();
     SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping");
     
@@ -206,6 +215,28 @@ static void fgMainLoop( void ) {
             simgear::sleepForMSec(500);
         }
     }
+
+    // print timing statistics
+    static bool _lastStatisticsFlag = false;
+    if (_lastStatisticsFlag != _statisticsFlag->getBoolValue())
+    {
+        // flag has changed, update subsystem manager
+        _lastStatisticsFlag = _statisticsFlag->getBoolValue();
+        globals->get_subsystem_mgr()->collectDebugTiming(_lastStatisticsFlag);
+    }
+    if (_lastStatisticsFlag)
+    {
+        static double elapsed = 0;
+        elapsed += real_dt;
+        if (elapsed >= _statisticsInterval->getDoubleValue())
+        {
+            // print and reset timing statistics
+            globals->get_subsystem_mgr()->printTimingStatistics(_statiticsMinTime->getDoubleValue(),
+                                                                _statiticsMinJitter->getDoubleValue());
+            elapsed = 0;
+        }
+    }
+
     simgear::AtomicChangeListener::fireChangeListeners();
 
     SG_LOG( SG_ALL, SG_DEBUG, "" );
index 1a839cf3a3dac41ef1692ab27095544a79643aa0..054a771fc37513d397db91bd041c13b86dc34c8b 100644 (file)
 
 using std::string;
 
-#if defined( HAVE_VERSION_H ) && HAVE_VERSION_H
-#  include <Include/version.h>
-#else
-#  include <Include/no_version.h>
-#endif
-
 #include "voiceplayer.hxx"
 
 ///////////////////////////////////////////////////////////////////////////////