Ejemplo n.º 1
0
void menuTracker()  {
  if(nLCDButtons == leftButton)  {
    waitForRelease();
    count--;
  }
  else if(nLCDButtons == rightButton)  {
    waitForRelease();
    count++;
  }
}
Ejemplo n.º 2
0
int FRModel::makeBriefReport(int dayBegin, int monthBegin, int yearBegin, int dayEnd, int monthEnd, int yearEnd, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_Report(BRIEF_REPORT_BY_DATE, dayBegin, monthBegin, yearBegin, dayEnd, monthEnd, yearEnd);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = makeBriefReport(dayBegin, monthBegin, yearBegin, dayEnd, monthEnd, yearEnd, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка снятия краткого отчета по датам."), result));
    }

    return result;
}
Ejemplo n.º 3
0
int FRModel::setSerialNumber(const QString &number, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_SetSerialNumber(codec->fromUnicode(number));
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setSerialNumber(number, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка установки серийного номера."), result));
    }

    return result;
}
Ejemplo n.º 4
0
int FRModel::setDateTime(int day, int month, int year, int hour, int minute, int second)
{   
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetDate(day, month, year);
        if (!result)
            result = hw->hw()->ECR_SetTime(hour, minute, second);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setDateTime(day, month, year, hour, minute, second);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка синхронизации даты и времени."), result));
    }

    return result;
}
Ejemplo n.º 5
0
int FRModel::report()
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetMode(3);
        if (!result)
            result = hw->hw()->ECR_Report(Z_REPORT);
    }

    result = err->analizeError(result, "report");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = report();
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка создания z-отчета."), result));
    }

    return result;
}
Ejemplo n.º 6
0
int FRModel::makeFullReport(int sessionBegin, int sessionEnd, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_Report(FULL_REPORT_BY_SESSION, 0, 0, 0, 0, 0, 0, sessionBegin, sessionEnd);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = makeFullReport(sessionBegin, sessionEnd, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка снятия полного отчета по сменам."), result));
    }

    return result;
}
Ejemplo n.º 7
0
int waitForButtonPress() {
	int btnPressed;
	waitForPress();
	btnPressed = nLCDButtons;
	waitForRelease();
	return btnPressed; //return the buttons that were pressed
}
Ejemplo n.º 8
0
int FRModel::fiscalization(QString registrationNumber, QString INN, QString newPassword, QString password)
{
    fillString(password, getPasswordLength(password));
    fillString(newPassword, getPasswordLength(password));
    fillString(registrationNumber, getRegistrationNumberLength());
    fillString(INN, getINNNumberLength());

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
           result = hw->hw()->ECR_Fiscalization(codec->fromUnicode(registrationNumber), codec->fromUnicode(INN), codec->fromUnicode(newPassword));
    }

    result = err->analizeError(result, "fiscalization");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = fiscalization(registrationNumber, INN, newPassword, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка фискализации."), result));
    }

    return result;
}
Ejemplo n.º 9
0
void resetLCD(){
	//reset all LCD variables to reset selection
	waitForRelease();
	rightLeft = 0;
	easyHard = 0;
	autonL = false;
	autonR = false;
	auton1 = false;
	auton = false;
	firstchoice = 0;
}
task LCD()
{
	//Declare count variable to keep track of our choice
	int count = 0;
	LCDselect = 0;
	//------------- Beginning of User Interface Code ---------------
	//Clear LCD
	clearLCDLine(0);
	clearLCDLine(1);
	//Loop while center button is not pressed
	while(LCDselect == 0 && nSysTime < 20000)
	{
		//Switch case that allows the user to choose from 4 different options
		while(nSysTime < 20000){
			//Display first choice
			displayLCDCenteredString(0, "The only autonomous play");
			displayLCDCenteredString(1, "<		 Enter		>");
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count = 5;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			else if(nLCDButtons == centerButton){
				OoT = 1;
				BoR = 1;
				LCDselect = 1;
				break;
				waitForRelease();

			}
		}
		clearLCDLine(0);
		clearLCDLine(1);
	}
}
Ejemplo n.º 11
0
void incrementOrDecrement() 
{ 
    waitForPress(); 
    //Increment or decrement "AutonomousNumber" based on button press 
            if(nLCDButtons == leftButton) 
            { 
                waitForRelease(); 
                AutonomousNumber--; 
                if (AutonomousNumber < 0) 
                { 
                    AutonomousNumber = NUMBER_OF_MODES; 
                } 
            } 
            else if(nLCDButtons == rightButton) 
            { 
                waitForRelease(); 
                AutonomousNumber++; 
                if (AutonomousNumber > NUMBER_OF_MODES) 
                { 
                    AutonomousNumber = 0; 
                } 
            } 
} 
Ejemplo n.º 12
0
int FRModel::testSale(double price)
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetMode(1);
        if (!result)
        {
            result = hw->hw()->ECR_OpenCheck(0);
            if (!result)
            {
                result = hw->hw()->ECR_Registration(price, 1, "");
                if (!result)
                    result = hw->hw()->ECR_CloseCheck(price);
            }
        }
    }

    result = err->analizeError(result, "check");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = testSale(price);
        break;

    default:
            emit signalFail(generateErrorMessage(conv("Ошибка печати чека."), result));
    }

    return result;
}
Ejemplo n.º 13
0
int FRModel::setLicence(const QString &license)
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
        hw->hw()->ECR_SetLicense(4, codec->fromUnicode(license));

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setLicence(license);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка установки лицензии."), result));
    }

    return result;
}
Ejemplo n.º 14
0
void autonomousSelection(){

	while(LCDselect == 0  && nSysTime < 15000){
		//set the while loop for the choices
		while(firstchoice == 0  && nSysTime < 15000){
			displayLCDCenteredString(0, "Left or Right?");
			//Autonomous or Not?
			if(nLCDButtons == leftButton){
				waitForRelease();
				auton = true;
				auton1 = true;
				firstchoice = 1;
				//set up the variables and booleans for autonomous = true
			}

			if(nLCDButtons == rightButton){
				waitForRelease();
				auton = false;
				firstchoice = 1;
				//Do nothing, prepare for User Control
			}

		} //End the Autonomous yes or no loop

		while(auton1 == true  && nSysTime < 15000){
			//when autonomous is selected
			displayLCDCenteredString(0, "Five sack or Y?");
			//Left or right Autonomous?
			if(nLCDButtons == leftButton){
				waitForRelease();
				rightLeft = 1;
				auton1 = false;
				autonL = true;
				//Set the variables for autonomous left
			}

			if(nLCDButtons == rightButton){
				waitForRelease();
				rightLeft = 2;
				auton1 = false;
				autonR = true;
				//set the variables for autonomous Right
			}
    }
	  displayLCDCenteredString(0, "Are you sure?");
		//Are you sure with the Code selected?
		displayLCDCenteredString(1, "Press center");
		//If sure, press center

		if(nLCDButtons == centerButton){
			//End LCD selections
			waitForRelease();
			LCDselect = 1;
		}

		if(nLCDButtons == leftButton)
		{
			// User is unsure, clear ALL variables to restart selection
			resetLCD();
		}

		if(nLCDButtons == rightButton)
		{
			// User is unsure, Clear ALL variables to restart Selection
			resetLCD();
		}

		}
}
Ejemplo n.º 15
0
// wait for any of the specified buttons to be pressed and then released,
// at which point execution will return from this method.  The argument
// 'buttons' can refer to multiple buttons using the bitwise OR operator |.
// The return value is the ID of the button that was pressed and released.
// Note that this method takes care of button debouncing.
// Example: waitForButton(TOP_BUTTON | BOTTOM_BUTTON);
unsigned char OrangutanPushbuttons::waitForButton(unsigned char buttons)
{
  unsigned char pressedButton = waitForPress(buttons);
  waitForRelease(pressedButton);
  return pressedButton;
}
Ejemplo n.º 16
0
void pre_auton()
{


	//------------- Beginning of User Interface Code ---------------
	//Clear LCD
	clearLCDLine(0);
	clearLCDLine(1);
		bLCDBacklight = true;
	//Loop while center button is not pressed
	while(nLCDButtons != centerButton)
	{
		//Switch case that allows the user to choose from 4 different options
		switch(count){
		case 0:
			//Display first choice
			displayLCDCenteredString(0, "Red Middle");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count = 3;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 1:
			//Display second choice
			displayLCDCenteredString(0, "blue Middle");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 2:
			//Display third choice
			displayLCDCenteredString(0, "RED hang");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 3:
			//Display fourth choice
			displayLCDCenteredString(0, "Blue hang");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count = 0;
			}
			break;
		default:

			count = 0;

			break;

		}
	}

}
Ejemplo n.º 17
0
void autonomousSelection(){
	//LCD selection in the form of asking questions
	while(LCDselect == 0  && nSysTime < 15000){
		//set the while loop for the choices
		while(firstchoice == 0  && nSysTime < 15000){
			displayLCDCenteredString(0, one);
			//Autonomous or Not?
			if(nLCDButtons == leftButton){
				waitForRelease();
				auton = true;
				auton1 = true;
				firstchoice = 1;
				//set up the variables and booleans for autonomous = true
			}
			if(nLCDButtons == rightButton){
				waitForRelease();
				auton = false;
				firstchoice = 1;
				//Do nothing, prepare for User Control
			}

		} //End the Autonomous yes or no loop

		while(auton1 == true  && nSysTime < 15000){
			//when autonomous is selected
			displayLCDCenteredString(0, two);
			//Left or right Autonomous?
			if(nLCDButtons == leftButton){
				waitForRelease();
				rightLeft = 1;
				auton1 = false;
				autonL = true;
				//Set the variables for autonomous left
			}

			if(nLCDButtons == rightButton){
				waitForRelease();
				rightLeft = 2;
				auton1 = false;
				autonR = true;
				//set the variables for autonomous Right
			}

		}

		while (autonL == true  && nSysTime < 15000) {
			//if left autonomous is selected
			displayLCDCenteredString(0, hard);
			// Easy, Rush, or Hard autonomous?
			if(nLCDButtons == leftButton){
				waitForRelease();
				easyHard = 1;
				autonL = false;
				//set variables for autonomous Left Easy
			}

			if(nLCDButtons == centerButton){
				waitForRelease();
				easyHard = 3; //this selects the rush mode
				autonL = false;
		}

			if(nLCDButtons == rightButton){
				waitForRelease();
				easyHard = 2;
				autonL = false;
				//set variables for autonomous Left Hard
			}
		}

		while (autonR == true) {
			//if right autonomous is selected
			displayLCDCenteredString(0, either);
			// Press Either L/R
			//Code for leftEasy can't be mirrored due to field positioning
			if(nLCDButtons == leftButton){
				waitForRelease();
				easyHard = 1;
				autonR = false;
				//set variables for autonomous right Hard
			}

			if(nLCDButtons == rightButton){
				waitForRelease();
				easyHard = 2;
				autonR = false;
				//set variables for autonomous right Hard
			}

		}

		displayLCDCenteredString(0, sure);
		//Are you sure with the Code selected?
		displayLCDCenteredString(1, center);
		//If sure, press center

		if(nLCDButtons == centerButton){
			//End LCD selections
			waitForRelease();
			LCDselect = 1;
		}

		if(nLCDButtons == leftButton){
			// User is unsure, clear ALL variables to restart selection
			resetLCD();
		}

		if(nLCDButtons == rightButton){
			// User is unsure, Clear ALL variables to restart Selection
			resetLCD();
		}
	}
}
Ejemplo n.º 18
0
void lcdPreAuton()
{
	//Clear LCD
	clearLCDLine(0);
	clearLCDLine(1);
	//Loop while center button is not pressed
	while(lcdTerminate == false)
	{
		while(nLCDButtons != centerButton)
		{
			switch(colorCount)
			{
				case 0:
					//Display first choice
					displayLCDCenteredString(0, "Red");
					displayLCDCenteredString(1, "<		 Enter		>");
					waitForPress();
					//Increment or decrement "count" based on button press
					if(nLCDButtons == leftButton)
					{
						waitForRelease();
						colorCount = 1;
					}
					else if(nLCDButtons == rightButton)
					{
						waitForRelease();
						colorCount = 1;
					}
					ifRed = true;
					ifBlue = false;
					break;
				case 1:
					//Display first choice
					displayLCDCenteredString(0, "Blue");
					displayLCDCenteredString(1, "<		 Enter		>");
					waitForPress();
					//Increment or decrement "count" based on button press
					if(nLCDButtons == leftButton)
					{
						waitForRelease();
						colorCount = 0;
					}
					else if(nLCDButtons == rightButton)
					{
						waitForRelease();
						colorCount = 0;
					}
					ifBlue = true;
					ifRed = false;
					break;
			}
		}
		wait10Msec(10);
		//next go to side selection
		waitForRelease();
		if(ifBlue == true && ifRed == false)
		{
			while(nLCDButtons != centerButton)
			{
				switch(sideCount)
				{
					case 0:
						displayLCDCenteredString(0, "Left");
						displayLCDCenteredString(1, "<		 Enter		>");
						waitForPress();
						if(nLCDButtons == leftButton)
						{
							waitForRelease();
							sideCount = 1;
						}
						else if(nLCDButtons == rightButton)
						{
							waitForRelease();
							sideCount = 1;
						}
						autonCount = 0;
						break;
					case 1:
						displayLCDCenteredString(0, "Right");
						displayLCDCenteredString(1, "<		 Enter		>");
						waitForPress();
						if(nLCDButtons == leftButton)
						{
							waitForRelease();
							sideCount = 0;
						}
						else if(nLCDButtons == rightButton)
						{
							waitForRelease();
							sideCount = 0;
						}
						autonCount = 1;
						break;
				}
			}
		}
		else if(ifBlue == false && ifRed == true)
		{
			while(nLCDButtons != centerButton)
			{
				switch(sideCount)
				{
					case 0:
						displayLCDCenteredString(0, "Left");
						displayLCDCenteredString(1, "<		 Enter		>");
						waitForPress();
						if(nLCDButtons == leftButton)
						{
							waitForRelease();
							sideCount = 1;
						}
						else if(nLCDButtons == rightButton)
						{
							waitForRelease();
							sideCount = 1;
						}
						autonCount = 2;
						break;
					case 1:
						displayLCDCenteredString(0, "Right");
						displayLCDCenteredString(1, "<		 Enter		>");
						waitForPress();
						if(nLCDButtons == leftButton)
						{
							waitForRelease();
							sideCount = 0;
						}
						else if(nLCDButtons == rightButton)
						{
							waitForRelease();
							sideCount = 0;
						}
						autonCount = 3;
						break;
				}
			}
		}
		wait10Msec(10);
		waitForRelease();
		while(nLCDButtons !=centerButton)
		{
		switch(delayCount){
		case 0:
			//Display first choice
			displayLCDCenteredString(0, "Delay");
			displayLCDCenteredString(1, "< 0 seconds >");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				delayCount = 3;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				delayCount++;
			}
			delayer1 = 0;
			break;
		case 1:
			//Display second choice
			displayLCDCenteredString(0, "Delay");
			displayLCDCenteredString(1, "< 3 seconds >");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				delayCount--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				delayCount++;
			}
			delayer1 = 3;
			break;
		case 2:
			//Display third choice
			displayLCDCenteredString(0, "Delay");
			displayLCDCenteredString(1, "< 5 seconds >");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				delayCount--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				delayCount++;
			}
			delayer1 = 5;
			break;
		case 3:
			//Display fourth choice
			displayLCDCenteredString(0, "Delay");
			displayLCDCenteredString(1, "< 7 seconds >");
			waitForPress();
			//Increment or decrement "count" based on button press
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				delayCount--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				delayCount = 0;
			}
			delayer1 = 7;
			break;
		default:
			delayCount = 0;
			break;
		}
		lcdTerminate = true;
	}
}
}
Ejemplo n.º 19
0
task LCDSelect() {
	if (showVersion) {
		clearLCD();
		displayLCDCenteredString(0,"LCD Select v2.0-f"); //briefly display version for debug purposes
		wait1Msec(750);
	}
	showVersion = false; //don't show the version again if autonSelection is ever reset


	//Q1: Which side?
	showOnLCD("Which side?","Left  Right  Sk.");
	waitForPress();
	int q1Response = nLCDButtons;
	waitForRelease();
	int q2Page = 1; //1 - Big/Small choices shown, 2 - Cube/Fence choices shown, 3 - Nothing choice shown
	int q2Response = 0;
	int q2PlayChosen = 0;

	if (q1Response != 4) {

		while (q2PlayChosen == 0) {

			if (q2Page == 1) {
				if (LCD_CUBE && LCD_STARS) {
					showOnLCD("Choose play: 1/2","Cube   Star   >>");
				} else if (LCD_CUBE && !LCD_STARS) {
				  showOnLCD("Choose play:","Cube          >>");
				} else if (!LCD_CUBE && LCD_STARS) {
				  showOnLCD("Choose play:","       Star   >>");
				} else {
					showOnLCD("Press any btn","");
				}

				wait1Msec(250); //short delay to prevent button press from triggering multiple times
				waitForPress();
				q2Response = nLCDButtons;
				if (q2Response == 4) {
					q2Page = 3;
				} else if (q2Response == 1) {
					q2PlayChosen = 1;
				} else if (q2Response == 2) {
					q2PlayChosen = 2;
				}
				waitForRelease();
				if (q2Response == 1 ||q2Response == 2) {
					break;
				}

			}/* else if (q2Page == 2) {
				showOnLCD("Choose play: 2/3","Cube   Fence  >>");
				wait1Msec(250);
			  waitForPress();
				q2Response = nLCDButtons;
				if (q2Response == 4) {
					q2Page = 3;
				} else if (q2Response == 1) {
					q2PlayChosen = 3;
				} else if (q2Response == 2) {
					q2PlayChosen = 4;
				}
				waitForRelease();
				if (q2Response == 1 ||q2Response == 2) {
					break;
				}
			} */else if (q2Page == 3) {
				showOnLCD("Choose play: 2/2","Nothing       >>");
				wait1Msec(250);
			  waitForPress();
				q2Response = nLCDButtons;
				if (q2Response == 4) {
					q2Page = 1;
				} else if (q2Response == 1) {
					q2PlayChosen = 4;
				}
				waitForRelease();
				if (q2Response == 1 ||q2Response == 2) {
					break;
				}
			} //end else if
		} //end while
	} //end if


	if (q1Response == 4) {
		AUTON_PLAY = 3;
		playConfirmName = "Prog. skills";
	} else {
		if (q1Response == 1) {
			AUTON_SIDE = LEFT;
		} else { //q1Response == 2
			AUTON_SIDE = RIGHT;
		}
		switch (q2PlayChosen) {
			case 1:
				AUTON_PLAY = 1;
				playConfirmName = "Cube";
				break;
			case 2:
				AUTON_PLAY = 2;
				playConfirmName = "Back stars";
				break;
			//case 3 would be programming skills, which is handled above
			case 4:
				AUTON_PLAY = 4;
				playConfirmName = "NOTHING";
				break;
		}
	}

	startTask(confirmChoice);
	wait1Msec(250);
	int confirmResult = waitForButtonPress();
	stopTask(confirmChoice);
	if (confirmResult == 2) {
		if (AUTON_PLAY == 5) {
			showOnLCD("NOTHING","No auton!");
		} else {
			showOnLCD(playConfirmName,"will run!");
		}
	} else {
		startTask(restartAutonSelection);
	}



} //end task
Ejemplo n.º 20
0
void pre_auton(){

	bLCDBacklight = true;	// Turn on LCD Backlight

	clearLCDLine(0);
	clearLCDLine(1);

	//Display the Primary Robot battery voltage
	displayLCDString(0, 0, "Primary: ");
	sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0, 'V'); //Build the value to be displayed
	displayNextLCDString(mainBattery);

	//Display the Backup battery voltage
	displayLCDString(1, 0, "Backup: ");
	sprintf(backupBattery, "%1.2f%c", BackupBatteryLevel/1000.0, 'V');	//Build the value to be displayed
	displayNextLCDString(backupBattery);

	//Short delay for the LCD refresh rate
	waitForPress();

	// Clear LCD
	clearLCDLine(0);
	clearLCDLine(1);

	wait1Msec(500);

	//Declare count variable to keep track of our choice

	int count = 0;

	while(nLCDButtons != centerButton)
	{
		//Switch case that allows the user to choose from 5 different options
		switch(count){

			case 0: //Display first choice
				displayLCDCenteredString(0, "Goal Auto red");
				displayLCDCenteredString(1, "<     Enter    >");
				waitForPress();

				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton)
				{
					waitForRelease();
					count--;
				}

				else if(nLCDButtons == rightButton)
				{
					waitForRelease();
					count++;
				}
				break;
			case 1: //display 2nd choice
				displayLCDCenteredString(0, "Goal Auto Blue");
				displayLCDCenteredString(1, "<     Enter    >");


				if(nLCDButtons == leftButton) {
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton) {
					waitForRelease();
					count++;
				}
				break;

			default:
				count = 0;
				break;
		}

		switch(count){
			case 2: //Display 3rd choice
				displayLCDCenteredString(0, " Blue Hang auto");
				displayLCDCenteredString(1, "<     Enter    >");
				waitForPress();
				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton) {
					waitForRelease();
					count--;
				}

				else if(nLCDButtons == rightButton) {
					waitForRelease();
					count++;
				}
				break;

			case 3: //display 4th choice
				displayLCDCenteredString(0, "Red Hang auto");
				displayLCDCenteredString(1, "<     Enter    >");


				if(nLCDButtons == leftButton) {
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton) {
					waitForRelease();
					count++;
				}
				break;

				default:
				count = 0;
				break;

							case 4: //display 5th choice
				displayLCDCenteredString(0, "Skills Challenge");
				displayLCDCenteredString(1, "<     Enter    >");


				if(nLCDButtons == leftButton) {
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton) {
					waitForRelease();
					count++;
				}
				break;

				default:
				count = 0;
				break;
		}
		//Clear LCD
		clearLCDLine(0);
		clearLCDLine(1);

		switch(count) {  //pick auto, display
			case 0: //Choice 1 from LCD
				displayLCDCenteredString(0, "Red Goal Auto");
				displayLCDCenteredString(1, "is running!");
				wait1Msec(1000);
				programChoice = 1;
				break;

			case 1: //Choice 2 from LCD
				displayLCDCenteredString(0, "Blue Goal Auto");
				displayLCDCenteredString(1, "is running!");
				wait1Msec(1000);
				programChoice = 2;
				break;

			case 2: //Choice 2 from LCD
				displayLCDCenteredString(0, "Blue Hang Auto");
				displayLCDCenteredString(1, "is running!");
				wait1Msec(1000);
				programChoice = 3;
				break;

			case 3: //Choice 3 from LCD
				displayLCDCenteredString(0, "Red Hang Auto");
				displayLCDCenteredString(1, "is running!");
				wait1Msec(1000);
				programChoice = 4;
				break;

			case 4: //Choice 3 from LCD
				displayLCDCenteredString(0, "Skills Challenge");
				displayLCDCenteredString(1, "is running!");
				wait1Msec(1000);
				programChoice = 5;
				break;

			default:
				displayLCDCenteredString(0, "No valid choice");
				displayLCDCenteredString(1, "was made!");
				wait1Msec(1000);
				break;
		}
	}
}