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

skip coils without hardware drivers when generating coil info for service menu #1876

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

bosh
Copy link
Contributor

@bosh bosh commented Feb 9, 2025

#1874 resolution - skip coils without hw_drivers (such as dual wound coils) for service controller use cases

@avanwinkle
Copy link
Collaborator

Interesting! I honestly had no idea that dual wound coils existed in MPF, but glad to know!

Service mode definitely shouldn't crash on them, and should know what they are. Something like

for coil in self.machine.coils.values():
  if coil is DualWoundCoil:
    continue
  ...

So that takes care of the dual wound coils. As for other coils, that assert statement is pretty old and I'm not wild about crashing the game unnecessarily, so maybe replacing the assert with an if statement and logging a warning that the coil has no hardware driver and won't be included. That's a nicer approach that won't break the game but still informs the user of the issue. Putting that line after the DualWoundCoil check will acknowledge that dual wound coils are expected and don't need a warning.

Thanks for working on this!

@bosh bosh force-pushed the dual_wound_coil_test_fix branch 2 times, most recently from 51c227f to 10b78c1 Compare February 13, 2025 23:57
@bosh bosh marked this pull request as draft February 14, 2025 00:00
@bosh bosh changed the base branch from 0.80.x to dev February 14, 2025 00:00
@bosh bosh force-pushed the dual_wound_coil_test_fix branch 3 times, most recently from 607bd36 to e19359d Compare February 14, 2025 00:24
@bosh bosh force-pushed the dual_wound_coil_test_fix branch from e19359d to d1dfa74 Compare February 14, 2025 05:19
@bosh bosh marked this pull request as ready for review February 14, 2025 05:19
@bosh
Copy link
Contributor Author

bosh commented Feb 14, 2025

This is ready to go, if tests are green. I added to the service test config file -- the new device declaration would have caused testServiceCli and testServiceMode to crash without the fix, but with the fix there's nothing new to see or assert on.

I went with the class check, but TBH I slightly prefer the has_attr("hw_driver") variant I had written previously. Upside of not using the class check is one less import, and the place I cribbed from suggested there might be other objects in machine.coils that also don't have a hw_driver. (Driver.py:53)

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