Open djaus2 opened 2 weeks ago
I understand the problem. I think that I assume in the code the values. I will try to see how it is generated and modify the code accordingly
Further more, its taking that order number and trying to cast it to one of the enum ordinals and generally failing.
For example using GroveGPIOPinX as a controller method parameter , if pp16 is used as the input to a block, it is been passed as 0 being first in the list then the controller tries to cast it thus (GroveGPIOPinX )0
which fails as 0 is not an ordinal in GroveGPIOPinX .
I have blogged extensively about all of this here https://davidjones.sportronics.com.au/tags/enums/
Following on from issue: #174 Given an enum type as parameter to a Controller can the enum literals show rather than the ordinal? which is closed.,
When the ordinals are used to set a value and a specific enum value is chosen then you get its order from zero in the list, not any assigned value. For eaxample:
When either is used as a parameter for a controller, you get values 0 ...5 for both. Not 16 to 21 for the second enum type.
Whilst this is not a breaking issue, it might be confusing for those not knowing this. Knowing it, is easy to work around, provided all values as sequential by one. You just add the expected first value to the value given for the selected enum. That is for GroveGPIOPinX just add 16 within teh controller.