I’m working on code that allows me to select which Auton to run by using the up and down arrows, Im wondering if there is a way to remove the .pressed callback on some of the buttons once the Auton Begins, I could check if the auton is running or usercontrol is running at the start of each function auton selection change when its called, but this seems like a clunky system.
Controller1.ButtonUp.pressed(AutonUp);
Im wondering if theres something that bassicly does the reverse of that line ^
Don’t use the button press callback pattern. It is messy, confusing, and should be removed from the VEXCode API (even RMS has removed it from their platform, which is designed to be compatible with VEXCode).
Just use the (badly named) pressing method to detect a button press, and do the logic yourself.
put it inside a while loop?, would it be worth putting a delay at the end of each iteration or would that make it less likely for it to detect the pressing
I think, adding a delay of something like 10 msec is always a good idea and will not affect speed of key press detection that much.
I believe, the data update rate between joystick controller and V5 brain is limited by VEXNet 2.0 protocol at every 25 msec and in the worst case could be delayed by as much as 50 msec.
I agree, it would great if the pressed() could be marked as deprecated and its functionality replaced by a method with a more descriptive name like SetButtonPressedCallbackFunction() to avoid confusion going forward @tfriez
Even I never used the pressed callback because its not elastic enough for my likings. There are times where I find simplicity to provide the clearest solution. But if theres a stress on teaching events I believe it would be a good consideration to have a listener event. Something like: