Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to make the SAS more reliable #2067

Merged
merged 4 commits into from
Jan 19, 2019
Merged

Conversation

eggrobin
Copy link
Member

Fix #1868, hopefully.

From traces, it seems that if

active_vessel.OnAutopilotUpdate =
(FlightInputCallback)Delegate.Combine(
new FlightInputCallback(OverrideRSASTarget),
active_vessel.OnAutopilotUpdate);
was called while the SAS was on (which happened, e.g., if the SAS was turned on before launch), it would change the invocation list as expected, i.e.,

active_vessel.OnAutopilotUpdate.GetInvocationList()[0] ==
    (Delegate)(FlightInputCallback)OverrideRSASTarget

would then hold, but invoking active_vessel.OnAutopilotUpdate would somehow not call OverrideRSASTarget, thus keeping the stock SAS behaviour (and resulting in #1868).
I have no explanation for this behaviour.

The invocation did have the expected effect, however, if the delegate combination occurred with the SAS off, e.g., if the SAS was off during liftoff and turned on later on.

Switching to OnPreAutopilotUpdate does not appear to have any unexpected behaviour (and appending to that one is more readable than prepending to the other anyway).

@pleroy pleroy added the LGTM label Jan 19, 2019
@eggrobin eggrobin merged commit 7431759 into mockingbirdnest:master Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants