LCD in Pre_Auton Problem

I’m having trouble using my lcd in pre_auton. I’m using a

while(vrDisabled == 1)

to run it but it is giving me a minor error (‘while’ expression is constant ‘false’. Loop never executed) and chooses not to run it, instead it displays that the robot is disabled and a count for how long it had been disabled. I have tried just changing the while loop to true, but then it never enters autonomous or driver control.

vrDisabled is the wrong thing to be using, the correct code would be;

while(bIfiRobotDisabled) {
  // Run some code

I’m not sure where you found the vrDisabled flag, that would be used with the variable nVexRCReceiveState to manually check the raw data. vrDisabled is more or less a constant (it’s part of an enumerated type), here is the definition from the header file.

typedef enum
  vrNoXmiters           = 0,        // No transmitters connected
  vrXmit1               = 0x01,     //                          1 == Transmitter 1 connected
  vrXmit2               = 0x02,     //                          1 == Transmitter 2 connected
  vrBit2                = 0x04,     // Unused
  vrCompetitionSwitch   = 0x08,     // 0 == No Comp Switch      1 == Competition Switch attached.
  vrResetSlave          = 0x10,     // Unused
  vrGameController      = 0x20,     // 0 == Legacy75MHz,        1 == Game Controller
  vrAutonomousMode      = 0x40,     // 0 == Driver Control,     1 == Autonomous Mode
  vrDisabled            = 0x80,     // 0 == Enabled             1 == Disabled.
} TVexReceiverState;

It has the value 0x80 (which is 128 in decimal) so a statement like

if(vrDisabled == 1)

will never be true as 128 is not equal to 1.

Thank you so much, now I can select our autonomous and see all the debugging data we need. Problems solved.

Thanks @jpearman, That was my team’s programmer asking the question, and you helped him a ton. He’s a first year programmer and he’s is so much more confident programming knowing that he can ask questions here.