LennartHennigs / SimpleFSM

Arduino/ESP library to simplify setting up and running a state machine.
MIT License
69 stars 16 forks source link

Compile error with Button2::CallbackFunction #4

Closed tkleiner closed 1 year ago

tkleiner commented 1 year ago

Nice little library!

Today I started with the MixedTransitions.ino example and ran into the following compile error.

Cannot initialize a parameter of type 'Button2::CallbackFunction' (aka 'void (*)(Button2 &)') with an lvalue of type 'void (Button2)': type mismatch at 1st parameter ('Button2 &' vs 'Button2')

The problem is in this line: https://github.com/LennartHennigs/SimpleFSM/blob/a75124579350a553cec431d1bc977f060928ce40/examples/MixedTransitions/MixedTransitions.ino#L69

I have looked into the examples from Button2, e.g. SingleButton.ino, and I think this line should be

void button_handler(Button2& btn) {

The same issue is in SimpleTransitionWithButton.ino

Thank you.

LennartHennigs commented 1 year ago

Hey, thanks for reaching out. Updated both examples! Thanks.

Cheers l.