Transmission Coding Help

Hello I needed help with some coding issues I am having with my robot. We have a transmission that moves the power of the chassis into the flywheel. However once the piston is engaged/ disengage I would like to have different types of controls for each of the subsystems.

  1. When the piston is engaged i would like to have a set of buttons to turn on/off the flywheel
  2. When disengaged the buttons for the flywheel is disabled and joysticks are not able to accommodate the tank drive.

these sets of controls cannot work at the same time
I have tried using some if statements and booleans but cannot seem to obtain my goals.

Thank you for any help or sugguestions

I would just create 2 separate chunks of code in a big if statement.


*PSEUDOCODE*
while (true)
{
    if (transmission engaged)
    {
        What is supposed to happen with transmission engaged
    }
    else
    {
        What is supposed to happen with transmission disengaged
    }

    Anything that is the same control for both states of the transmission
}

Edit: If it’s not clear, to find if the transmission is engaged you can just do
if (SensorValue[solenoid])