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

Fix procedural avionics getting stuck in an infinite update loop #922

Merged
merged 1 commit into from
Dec 3, 2018
Merged

Fix procedural avionics getting stuck in an infinite update loop #922

merged 1 commit into from
Dec 3, 2018

Conversation

siimav
Copy link
Contributor

@siimav siimav commented Dec 2, 2018

Fix proc avionics getting stuck in an update loop because of a weird issue with float field control

@pap1723
Copy link
Contributor

pap1723 commented Dec 3, 2018

@siimav Did this fix the error you were having?

@siimav
Copy link
Contributor Author

siimav commented Dec 3, 2018

Yes, previously it was causing a severe loss of framerate and the proc avionics UI became unresponsive. Only way to recover from that situation was to repeatedly tap the slider controls and hope that the clicks are finally registered. I have already seen the same issue reported in RO discord a couple of times.

Here's also a more detailed explanation of this issue that I wrote on discord:

Basically the slider control works in predefined increments. For example if you set the slider interval at 2 and the actual value is 100, it may automatically snap the value to either 99 or 101. To make things complicated, it doesn't appear to be doing that when you first manually set the values on the slider. It only starts happening if you close the right click menu and reopen it again. And after that if you try changing it in code, it always reverts back from the actual value to what the slider increments support.
Now the next issue is that the proc avionics code checks whether the current tonnage value is within the minimum and maximum bounds and tries to set it back to within the allowed range. It does use a 0.002f times error margin for this check but if the slider increments are too small, it could still get outside the allowed range. In my case, 0.002 * 100 is 0.2 tons and the slider always reverted the value to 98.7 or something like that. So because the range check is unable to bring the minimum within bounds, it keeps running in an endless loop.
Actually that issue should currently only happen on higher tier booster avionics because the maximum allowed tonnage (or the volume of the part itself) must be quite large to run into this issue.

@pap1723 pap1723 merged commit 51ab809 into KSP-RO:Developmental Dec 3, 2018
@siimav siimav deleted the ProcAvionicsFix branch December 4, 2018 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants