Change rate correction logic to be more explicit

This commit is contained in:
Ronnie Moir 2021-02-24 14:40:56 +00:00
parent f6d3cd6413
commit 73d6a3687e
2 changed files with 16 additions and 4 deletions

View File

@ -49,10 +49,16 @@ public class ModWindDown : ModTimeRamp
public ModWindDown()
{
InitialRate.BindValueChanged(val =>
FinalRate.Value = Math.Min(FinalRate.Value, val.NewValue - FinalRate.Precision));
{
if (val.NewValue <= FinalRate.Value)
FinalRate.Value = val.NewValue - FinalRate.Precision;
});
FinalRate.BindValueChanged(val =>
InitialRate.Value = Math.Max(InitialRate.Value, val.NewValue + InitialRate.Precision));
{
if (val.NewValue >= InitialRate.Value)
InitialRate.Value = val.NewValue + FinalRate.Precision;
});
}
}
}

View File

@ -49,10 +49,16 @@ public class ModWindUp : ModTimeRamp
public ModWindUp()
{
InitialRate.BindValueChanged(val =>
FinalRate.Value = Math.Max(FinalRate.Value, val.NewValue + FinalRate.Precision));
{
if (val.NewValue >= FinalRate.Value)
FinalRate.Value = val.NewValue + FinalRate.Precision;
});
FinalRate.BindValueChanged(val =>
InitialRate.Value = Math.Min(InitialRate.Value, val.NewValue - InitialRate.Precision));
{
if (val.NewValue <= InitialRate.Value)
InitialRate.Value = val.NewValue - FinalRate.Precision;
});
}
}
}