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

Cumulative drop_target reset delays for multi-coil banks #1621

Merged

Conversation

avanwinkle
Copy link
Collaborator

This PR continues to refine the DropTarget behavior for target banks with individual reset coils.

The Setup
The existing MPF behavior is smart enough to wait after resetting a drop target before checking the switch value and updating the target state, using the ignore_switch_ms property. MPF is also smart enough to stagger a series of drop target resets in order to smooth out PSU usage, using the reset_coil_max_wait_ms property.

The Problem
When using staggered drop target resets for power optimization, MPF does not factor into account the additional time it takes to reset all of the drop targets. As a result, the ignore_window_ms may expire while the coils are still resetting, leading to unexpected events and behavior. Additionally, the firing of a reset coil may momentarily disturb the opto sensor on a neighboring target, causing false switch detections.

The Solution
This PR tracks how much additional time is being requested by the PSU to sequentially pulse all of the drop target coils, and adds that time to the ignore_switch_ms property. This ensures that all of the coils have fired and switches have settled before MPF reads the state for updating the bank (or attempting a retry).

Why add and not max?
If the total delayed time is still less than the ignore_switch_ms, or vice versa, why not just use the larger value? My assumption is that the ignore_switch_ms time is provided by the designer based on the settling time of the switches after all coils are done firing. Adding the values ensures that the coils are done and the settling is complete.

This PR also adds reconcile=True to the init_phase_4 reset callback to prevent the playfield from being marked active during startup.

@sonarcloud
Copy link

sonarcloud bot commented Dec 11, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Dec 11, 2021

Awesome. Thanks for digging into this!

@avanwinkle avanwinkle merged commit 9ff139c into missionpinball:dev Dec 11, 2021
@avanwinkle avanwinkle deleted the drop-target-cumulative-wait branch December 11, 2021 23:27
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.

2 participants