Rotation Sensor callback stops buttons from working

Hi,
I am using the rotation sensor for first time. I am using C++ JAR Template to code. I created a callback method and set it in main.cpp in pre-auton as RotationSensor.changed(rotation_sensor_callback);

As soon as I introduced this line, some of my other button callbacks set in user_control, such as Controller.ButtonA.pressed(sweeper_toggle);,
stopped working.

Strangely, not all buttons are affected. Only the ones that use pistons / global variables to toggle pistons are affected. I have 2 buttons that toggle pistons (one for the clamp, one for the sweeper) and if I comment 1 out, the other works.

If I remove my callback to RotationSensor, all the button press are working as expected.

I am wondering if the brain is having trouble keeping track of more than a certain number of callbacks, or if the issue is related to using 3 pistons for 1 air tank?

how many solenoids are you using for the 3 pistons. that’s what matters not the tank.

Thanks for the quick response, we are using 3 solenoids for 3 pistons

It sounds like you may be using the event handlers incorrectly, perhaps post all your code so I can take a look at it.

also using

RotationSensor.changed(rotation_sensor_callback);

may not be exactly what you want to do, the changed events need to be used with caution.

Thanks, we have solved the problem. We had it running in a while loop so when it detected the change, it wasn’t able to run the full response code and therefore stopped the piston buttons because part of our response code uses the pistons.