LCD Code Chooser Help

I have made a code block to help our robot select 3 different auto programs for our competition coming up in about half a month. For some reason we can’t choose the programs while the autonomous switch is disabled. Instead it just reads that the code is disabled and reads the time it has been disabled.

I am going to paste my code in hopes that someone can help me out. Right now the code is very simple as it is programmed right now for a test robot we have. This was for our programmer to just experiment on. And now he is not with our team anymore.

Any help would be greatly appreciated. Thank you!!!


#pragma config(Motor,  port1,           RightBackDrive, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor,  port2,           RightFrontDrive, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port9,           LeftBackDrive, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port10,          LeftFrontDrive, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VEX EDR                      */
/*                                                                           */
/*---------------------------------------------------------------------------*/

// This code is for the VEX cortex platform
#pragma platform(VEX2)

// Select Download method as "competition"
#pragma competitionControl(Competition)

//Main competition background code...do not modify!
#include "Vex_Competition_Includes.c"

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

#define THRESHHOLD 50

unsigned int rmode = 1;
bool pressed = false;
const unsigned int MODES = 2;

unsigned int mode = 0;

void refScreen()
{
	// UI
	displayLCDCenteredString(1, "BCK   SLCT   NXT");

	// Do not execute mode switch multiple times
	if (!pressed)
	{
		if (nLCDButtons == 0x1)
		{
			mode--;
			pressed = true;
		}
		else if (nLCDButtons == 0x2)
		{
			rmode = mode;
			pressed = true;
		}
		else if (nLCDButtons == 0x4)
		{
			mode++;
			pressed = true;
		}
	}

	// Wrap around mode values
	if (mode > MODES)
	{
		mode = 0;
	}
	else if (mode < 0)
	{
		mode = MODES;
	}

	if (nLCDButtons != 1 && nLCDButtons != 2 && nLCDButtons != 4)
		pressed = false;

	switch (mode)
	{
		case 0:
			// Mode 0 Select
			displayLCDCenteredString(0, "Mode 1");
			break;
		case 1:
			// Mode 1 Select
			displayLCDCenteredString(0, "Mode 2");
			break;
		case 2:
			// Mode 2 Select
			displayLCDCenteredString(0, "Mode 3");
			break;
	}
}

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks
  // running between Autonomous and Driver controlled modes. You will need to
  // manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;
	clearLCDLine(0);
	clearLCDLine(1);
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              Autonomous Task                              */
/*                                                                           */
/*  This task is used to control your robot during the autonomous phase of   */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

task autonomous()
{
	while (true)
	{
		refScreen();

	  switch (rmode)
		{
			case 0:
			        // Mode 0
			motor[LeftBackDrive] = 127;
	  		motor[LeftFrontDrive] = 127;
	  		motor[RightFrontDrive] = 127;
	  		motor[RightBackDrive] = 127;
				break;
			case 1:
				// Mode 1
			motor[LeftBackDrive] = 0;
	  		motor[LeftFrontDrive] = 0;
	  		motor[RightFrontDrive] = 0;
	  		motor[RightBackDrive] = 0;
				break;
			case 2:
				// Mode 2
			motor[LeftBackDrive] = -128;
	  		motor[LeftFrontDrive] = -128;
	  		motor[RightFrontDrive] = -128;
	  		motor[RightBackDrive] = -128;
				break;
		}
	}
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              User Control Task                            */
/*                                                                           */
/*  This task is used to control your robot during the user control phase of */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

task usercontrol()
{
  // User control code here, inside the loop

  while (true)
  {
    // This is the main execution loop for the user control program.
    // Each time through the loop your program should update motor + servo
    // values based on feedback from the joysticks.

    // ........................................................................
    // Insert user code here. This is where you use the joystick values to
    // update your motors, etc.
    // ........................................................................

    // Remove this function call once you have "real" code.
		refScreen();
  	if (vexRT[Ch1] > THRESHHOLD)
  	{
  		motor[LeftBackDrive] = -128;
  		motor[LeftFrontDrive] = -128;
  		motor[RightFrontDrive] = 127;
  		motor[RightBackDrive] = 127;
  	}
  	else if (vexRT[Ch1] < -THRESHHOLD)
  	{
  		motor[LeftBackDrive] = 127;
  		motor[LeftFrontDrive] = 127;
  		motor[RightFrontDrive] = -128;
  		motor[RightBackDrive] = -128;
  	}
  	else if (vexRT[Ch2] > THRESHHOLD)
  	{
  		motor[LeftBackDrive] = -128;
  		motor[LeftFrontDrive] = -128;
  		motor[RightFrontDrive] = -128;
  		motor[RightBackDrive] = -128;
  	}
  	else if (vexRT[Ch2] < -THRESHHOLD)
  	{
  		motor[LeftBackDrive] = 127;
  		motor[LeftFrontDrive] = 127;
  		motor[RightFrontDrive] = 127;
  		motor[RightBackDrive] = 127;
  	}
  	else
  	{
  		motor[LeftBackDrive] = 0;
  		motor[LeftFrontDrive] = 0;
  		motor[RightFrontDrive] = 0;
  		motor[RightBackDrive] = 0;
  	}
  }
}


The code that refers to your LCD, refScreen(), is only called within your autonomous and driver control tasks. Those are not run while the switch is disabled. pre_auton(), however, is run when the robot turns on regardless of the disable switch.