missionpinball / mpf-docs

missionpinball.org website content & all MPF docs
https://missionpinball.org/
MIT License
30 stars 112 forks source link

Defaults to empty #485

Open worldpeace-germany opened 1 year ago

worldpeace-germany commented 1 year ago

Hello,

In the documentation there are some occurrences where it says a certain parameter defaults to empty. For example

https://missionpinball.org/config/coils/#default_recycle

I understand (I believe) what the recycle parameter does and I understand there are hardware specific implementations. But empty? Either (if supported by the hardware) it does a recycle or it does not. So the default should be true or false and if true, then of course we need to look into the hardware specifics what exactly true means for the hardware being used.

Am I on the wrong track here? If not, what is the default, true or false?

Thanks!

toomanybrians commented 1 year ago

Great question!

I just confirmed via the config spec and yes, these config options really do default to empty (or "None")

You can verify this (or any config yaml setting) by looking at the config spec file in the MPF repo at /mpf/config_spec.yaml. Here's the entry for the default_recycle:

https://github.com/missionpinball/mpf/blob/dev/mpf/config_spec.yaml#L301

default_recycle: single|bool|None

The spec tells us that key needs a single value, of boolean type, and the default is "None".

"None" has a bit of a special meaning because it will not be true or false by default. So this means it really None (or not set) by default, and then how the hardware platform handles a none (whether it uses a recycle or not) is truly up to the hardware platform.

Maybe we can add a bit of explanation text to make this more clear?

toomanybrians commented 1 year ago

Oh, I should add that while a value of "None" is obviously not a boolean and not True or False, the platform interface is what needs the True or False, not the config file. So when the platform interface loads the config, if it sees the default_recycle: None, then it will have code that will either set it to True or False (or something else like that), so that's why it's up to the platform to decide what to do there and why each one could be different.

worldpeace-germany commented 1 year ago

Okay, got it. None means that the hardware platform decides what the default is. I search the documentation now for the hardware platform specifics and I found two things:

https://missionpinball.org/hardware/multimorphic/drivers/ P-ROC: A none in the config file is for P-ROC a true, that is clearly stated and further explained, all good here.

https://missionpinball.org/hardware/opp/drivers/ OPP/Cobra: I understand from here some details, but would not know how the hardware platform acts if none is given. Does someone know?

Additional issue with the OPP link, it states:

_If you add recycle: True to your coil you can set recycle_factor in the platformsettings

In the example below that key is not being used. First I thought it is a typo and it should be recycle_default, but the parameter recycle exists as well.

https://missionpinball.org/config/coil_overwrites/#recycle

Where the explanation in that link is a bit Slim. It refers to https://missionpinball.org/config/coils/ where then there is no recycle parameter explained.

Once I understood the situation I am willing to improve the text, no big deal.

cobra18t commented 1 year ago

Here is my config for a working coil with recycle in OPP...

c_slingshot_left:
    number: 0-0-9
    default_pulse_ms: 22
    default_pulse_power: 0.65
    default_recycle: True
    platform_settings:
        recycle_factor: 4
worldpeace-germany commented 1 year ago

yes of course that works fine. How would the coil behave if you omit the default_recycle parameter? Would it behave the same or would the recycle be off?