public void Main(string argument, UpdateType updateType) { if ((updateType & UpdateType.Update1) == 0) { ProcessCommand(argument); return; } gyroController.Tick(); activeModule?.Tick(); if (textPanel != null) { textPanel.WritePublicText(GetTextPanelHeader()); if (activeModule != null) { textPanel.WritePublicText(activeModule?.GetPrintString(), true); } } }
public void Main(string argument, UpdateType updateSource) { // execute user interaction if ((updateSource & UpdateType.Trigger) != 0 || (updateSource & UpdateType.Terminal) != 0) { if (argument.Contains("enable")) { disabled_ = false; } else if (argument.Contains("disable")) { gyroController_.ResetGyro(); disabled_ = true; } } // check landing landingInProgress_ = false; foreach (var gear in gears_) { if (gear.LockMode == LandingGearMode.Locked || gear.LockMode == LandingGearMode.ReadyToLock) { landingInProgress_ = true; break; } } // run normal iteration if ((updateSource & UpdateType.Update10) != 0) { // check natural gravity if (cockpit_.GetNaturalGravity().Length() == 0.0) { naturalGravity_ = false; gyroController_.SetGyroOverride(false); return; } else { naturalGravity_ = true; } if (landingInProgress_ == false && disabled_ == false) { // update all orientation parameters UpdateOrientationParameters(); // update gyroController gyroController_.Tick(); if (cockpit_.MoveIndicator.Length() > 0.0 || cockpit_.RotationIndicator.Length() > 0.0) { desiredPitch_ = -(pitch_ - 90); desiredRoll_ = (roll_ - 90); gyroController_.SetGyroOverride(false); } else { gyroController_.SetGyroOverride(true); desiredPitch_ = Math.Atan((worldSpeedForward_ - setSpeed_) / gyroResponsiveness_) / HalfPi * maxPitch_; desiredRoll_ = Math.Atan(worldSpeedRight_ / gyroResponsiveness_) / HalfPi * maxRoll_; } if (gyroController_.GyroOverride) { ExecuteManeuver(); } } } // generate lcd output and print them on messages_.Flush(); statistics_.tick(this); }