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

Multiple eject device handling #1763

Merged

Conversation

avanwinkle
Copy link
Collaborator

This PR adds some stability improvements to physical ball locks and multi balls.

Graceful Lost Ball Handling

This PR extends the ball count handler for ejecting physical balls to double-check the ball counts after an eject attempt, in case more balls were ejected than expected. If this occurs, the changes in this PR will post that the device has lost balls, and will update the device count to reflect the new physical count.

For situations where multiple balls were intended to be ejected and some eject together, this PR also gracefully cancels the eject queue for the lost balls.

This change does not apply to ball devices tagged as trough, because troughs can jam and "lose" many balls simultaneously and those balls should not be removed from the trough count yet. This change also does not apply to manual eject devices (which really shouldn't have multiple balls anyway) because there is no way to objectively measure how many eject attempts were made relative to how many balls were ejected.

Improved Ball Count Handling

This PR changes the logic for counting physical balls in a ball device, tracking the expected new number of balls instead of the known physical ball count. This change allows the ball device to identify when the ball counts mismatch (e.g. a ball slipped out or multiple balls entered simultaneously) and avoids race conditions. There is no change in the happy path behavior, just a reduced chance of error.

eject it

Copy link

sonarcloud bot commented Feb 22, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@avanwinkle avanwinkle merged commit 65cbdf3 into missionpinball:dev Feb 23, 2024
14 checks passed
@avanwinkle avanwinkle deleted the multiple-eject-device-handling branch February 23, 2024 00:31
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.

1 participant