Skip to content

Commit

Permalink
Update BetterController settings
Browse files Browse the repository at this point in the history
And make it easier to correctly set the SETTINGS_VERSION to force
bumping the defaults.
  • Loading branch information
lamont-granquist committed Jul 29, 2023
1 parent 26f5256 commit 7119129
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MechJeb2/AttitudeControllers/BetterController.cs
Expand Up @@ -71,6 +71,8 @@ internal class BetterController : BaseAttitudeController
[Persistent(pass = (int)(Pass.TYPE | Pass.GLOBAL))]
private int _version = -1;

private const int SETTINGS_VERSION = 5;

private void Defaults()
{
PosKp.val = 1.98;
Expand All @@ -89,7 +91,7 @@ private void Defaults()
maxStoppingTime.val = 2;
minFlipTime.val = 120;
rollControlRange.val = 5;
_version = 5;
_version = SETTINGS_VERSION;
}

private readonly PIDLoop[] _pid = { new PIDLoop(), new PIDLoop(), new PIDLoop() };
Expand Down Expand Up @@ -117,7 +119,7 @@ public BetterController(MechJebModuleAttitudeController controller) : base(contr

public override void OnModuleEnabled()
{
if (_version < 2)
if (_version < SETTINGS_VERSION)
Defaults();
Reset();
}
Expand Down

0 comments on commit 7119129

Please sign in to comment.