]> git.mxchange.org Git - flightgear.git/blobdiff - src/Autopilot/xmlauto.cxx
ignore resets for now because every z/Z key press would trigger a call to NOAA. We...
[flightgear.git] / src / Autopilot / xmlauto.cxx
index 88c0f99849d6bdf98dc1d500c71723c8970c9341..d682f2b790a24ddcdc40274d2d2d51708c587f2f 100644 (file)
@@ -212,6 +212,15 @@ void FGPIDController::update( double dt ) {
     }
 
     if (enable_prop != NULL && enable_prop->getStringValue() == enable_value) {
+        if ( !enabled ) {
+            // first time being enabled, seed u_n with current
+            // property tree value
+            u_n = output_list[0]->getDoubleValue();
+            // and clip
+            if ( u_n < u_min ) { u_n = u_min; }
+            if ( u_n > u_max ) { u_n = u_max; }
+            u_n_1 = u_n;
+        }
         enabled = true;
     } else {
         enabled = false;