Why a same call back function being executed repeatedly

Recently, I find my button callback function has been executed repeatedly.
The situation is like this.
I set button call back in drivercontrol function and then swiched disable and enable in manul field controller.
How many times are switched, how many times will the callback fun be excuted when I press the button.
This situation seems to only occur in the most recent firmware update.

That’s normal and expected behavior, and has been that way since the V5 and VEXcode were introduced.
In general, callbacks should be registered once in main. There are exceptions to this, and ways to automatically unregister them, but it can get complicated.

Also, have a read of this, it touches on this subject.

3 Likes