I'm having trouble with the switch!

Hello, I’m a beginner in arduino and anyone who can help me I thank ^^

so I did a program using the switch function, with it I did 3 case (volume studio, main menu and return), I made a button that whenever it tight it changes menu and works perfectly, the problem and when it arrives in case “main menu”
that I press the button and it does not change the menu, until I tried to take the FOR and when I did it worked the button, however, without FOR the function that it did stopped working … someone knows why FOR does not work no SWITCH?

PROGRAM:

////////////// DIGITAUTO ///////////////

*/

//////////// Bibliotecas ///////////////
#include <TFT_HX8357.h> // Biblioteca específica de hardware
#include <EEPROM.h> // info → http://tronixstuff.com/2011/03/16/tutorial-your-arduinos-inbuilt-eeprom/

TFT_HX8357 tft = TFT_HX8357(); // Invoke custom library

// Esquema De Cores Do Medidor
#define RED2RED 0
#define GREEN2GREEN 1
#define BLUE2BLUE 2
#define BLUE2RED 3
#define GREEN2RED 4
#define RED2GREEN 5
#define HX8357_GREY 0x2104 // cinza escuro 16 bit cores

// — Mapeamento de Hardware —
#define butaodesfreq 11 // botão de descer a frequencia 11
#define botaoupfreq 7 // botão de subir a frequencia 7
#define dimvolstudio 1 // botão de diminuir volume studio 1
#define aumvolstudio 0 // botão de aumentar volume studio 0
#define trocamenu 9 // botão de trocar o menu atual
#define aumretorno 2 // botão de aumentar o volume do retorno
#define dimretorno 4 // botão de diminuir o volume do retorno
#define butaodesfreq 11 // botão de diminuir frequencia
#define botaoupfreq 7 // botão de aumentar frequencia
#define memo1 6 // botão da memoria 1
#define memo2 8 // botão da memoria 2
#define memo3 10 // botão da memoria 3

// — Variaveis Globais (PRINCIPAL) —
byte decimal_places = 1;

// — Variaveis Globais (STUDIO) —
uint32_t runTime = -99999; // time for next update
int reading = 0; // Valor a ser exibido
int d = 0; // Variável usada para a forma de onda do teste de onda senoidal
unsigned int ramp = 0; //subir de 1 em 1

// — Variaveis Globais (RETORNO) —
int leitura = 0; // Valor a ser exibido
unsigned int rampa = 0; //subir de 1 em 1

// — Protótipo das Funções Auxiliares —
void changeMenu(); //Função para modificar o menu atual
void Menu(); //Função para mostrar o menu atual
void volume_studio(); //Função do menu1, data e hora
void volume_retorno();
void retorno();

// — Variáveis Globais —
char menu = 0x01; //Variável para selecionar o menu
boolean t_trocamenu;

void setup() {
tft.begin();
//Serial.begin(9600);
tft.setRotation(1);

tft.fillScreen(HX8357_BLACK);

ramp = EEPROM.read(205);
rampa = EEPROM.read(206);

}

void loop() {

changeMenu();
Menu();
}

// — Desenvolvimento das Funções Auxiliares —
void changeMenu() //Modifica o menu atual
{
if(!digitalRead(9)) t_trocamenu = 0x01; //Botão Up pressionado? Seta flag
if(digitalRead(9) && t_trocamenu) //Botão Up solto e flag setada?
{ //Sim…
t_trocamenu = 0x00; //Limpa flag

tft.fillScreen(HX8357_BLACK);
menu++; //Incrementa menu

if(menu > 0x03) menu = 0x01; //Se menu maior que 4, volta a ser 1
} //end butUp
}

void Menu() //Mostra o menu atual
{
switch(menu) //Controle da variável menu
{
case 0x02: //Caso 1
volume_studio(); //Chama a função de relógio

break; //break

//break

case 0x01: //Caso 2
menu_principal();

break;

case 0x03: //Caso 3
retorno();

break;

} //end switch menu

} //end dispMenu

void volume_studio() //Data e Hora (menu1)

{

if (millis() - runTime >= 0L) { // Executa a cada 2s
runTime = millis();

int xpos = 0, ypos = 5, gap = 4, radius = 52;

// Desenhe um medidor grande
xpos = 480/2 - 160, ypos = 0, gap = 15, radius = 170;
reading =(ramp);

if(!digitalRead(aumvolstudio)){
ramp++;
EEPROM.write(205,ramp); // freq

}

if(!digitalRead(dimvolstudio)){
ramp–;
EEPROM.write(205,ramp); // freq

}

if(reading<=0){
reading = 0;
}

if(reading>= 100){
reading = 100;
}

// Comente acima dos medidores, depois remova o comentário da próxima linha para mostrar o medidor grande
ringMeter(reading,0,100, xpos,ypos,radius," Vol Studio",GREEN2RED); // Draw analogue meter

}
}

// #########################################################################
// Desenhe o medidor na tela, retorna x coord do lado direito
// #########################################################################
int ringMeter(int value, int vmin, int vmax, int x, int y, int r, char *units, byte scheme)
{

x += r; y += r; // Calcular coords do centro do anel

int w = r / 3; // Largura do anel externo é 1/4 do raio

int angle = 150; // Metade do ângulo de varredura do medidor (300 graus)

int v = map(value, vmin, vmax, -angle, angle);// Mapeie o valor para um ângulo v

byte seg = 3; // Segmentos são 3 graus de largura = 100 segmentos para 300 graus
byte inc = 6; // Desenhe segmentos a cada 3 graus, aumente para 6 para anel segmentado

// Variável para salvar a cor do texto “valor” do esquema e definir o padrão
int colour = HX8357_BLUE;

// Desenhar cor bloqueia todos os graus de inc
for (int i = -angle+inc/2; i < angle-inc/2; i += inc) {
// Calcular o par de coordenadas para o início do segmento
float sx = cos((i - 90) * 0.0174532925);
float sy = sin((i - 90) * 0.0174532925);
uint16_t x0 = sx * (r - w) + x;
uint16_t y0 = sy * (r - w) + y;
uint16_t x1 = sx * r + x;
uint16_t y1 = sy * r + y;

// Calcular o par de coordenadas para o final do segmento
float sx2 = cos((i + seg - 90) * 0.0174532925);
float sy2 = sin((i + seg - 90) * 0.0174532925);
int x2 = sx2 * (r - w) + x;
int y2 = sy2 * (r - w) + y;
int x3 = sx2 * r + x;
int y3 = sy2 * r + y;

if (i < v) { // Preencha os segmentos coloridos com 2 triângulos
switch (scheme) {
case 0: colour = HX8357_RED; break; // Fixed colour
case 1: colour = HX8357_GREEN; break; // Fixed colour
case 2: colour = HX8357_BLUE; break; // Fixed colour
case 3: colour = rainbow(map(i, -angle, angle, 0, 127)); break; // Full spectrum blue to red
case 4: colour = rainbow(map(i, -angle, angle, 70, 127)); break; // Green to red (high temperature etc)
case 5: colour = rainbow(map(i, -angle, angle, 127, 63)); break; // Red to green (low battery etc)
default: colour = HX8357_BLUE; break; // Fixed colour
}
tft.fillTriangle(x0, y0, x1, y1, x2, y2, colour);
tft.fillTriangle(x1, y1, x2, y2, x3, y3, colour);
// cor do texto = cor; // Salva o último desenho colorido
}
else // Preencha os segmentos em branco
{
tft.fillTriangle(x0, y0, x1, y1, x2, y2, HX8357_GREY);
tft.fillTriangle(x1, y1, x2, y2, x3, y3, HX8357_GREY);
}
}

//////////////// MENU PRINCIPAL ////////////////////////////////////////////////////////

void menu_principal()
{

tft.setTextColor(HX8357_WHITE);
tft.setTextSize(1);
tft.drawString(" Mhz", 208, 79, 4);

//////////////////////////////////////////////////////////////////////////////
/////////////////////////////////FREQUENCIA///////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

tft.drawRoundRect(10, 0, 280, 150, 16, TFT_WHITE);

for (int i = 975; i <= 1080; ) {

if(!digitalRead(9) ){

menu++;
}

tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.drawFloat(i/10.0, decimal_places, 50, 51, 7);

if(!digitalRead(botaoupfreq)){
i++;
EEPROM.write(200,i); // freq

}

if(!digitalRead(butaodesfreq)){
i–;
EEPROM.write(200,i); // freq

}

delay(100);

if(i<875){

i=1080;
}

if(i>1080){

i=875;
}

if(!digitalRead(6) ){

}

if(!digitalRead(8)){

}

}

//////////////

tft.drawRoundRect(10, 170, 280, 150, 16, TFT_WHITE);
tft.drawRoundRect(9, 169, 281, 150, 16, TFT_WHITE);

}

botaoupfreq Is defined twice

You can’t really store a negative number in an unsigned long

uint32_t runTime = -99999;       // time for next update

There is a smiley with glasses in your code

...

Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

J-M-L:
You can’t really store a negative number in an unsigned long

uint32_t runTime = -99999;       // time for next update

That is true. The value actually stored in an unsigned long variable will be positive. However, the behavior is well-defined by C and C++ languages.

The above initialization with -99999 looks highly suspect because of the strange "random" value on the right-hand side.

Meanwhile, initializing an unsigned variable with -1 is a well-established idiom: it initializes the variable with the maximum value of the given unsigned type (and also with "all-ones" bit pattern).