guidance in better way to handle huge switch statement

ok im using 2 buttons to change 33 global points

the switch im using in buttons is getting long at this point so im trying to decide if there's a better way.

ive cut this section to give you a idea of what im talking about

one of my concern is the use of floats, ints and bytes which is why the switch works well but its getting rather long and I hate having to search for the correct number to use

//example of using a switch
case 14:
//set humidity here
while (escape == 0) {
  checkeditbutton();
  buttons(11);
  lcd.setCursor(0, 0);
  lcd.print (F("change humidity"));
  lcd.setCursor(0, 1);
  lcd.print(standardText[2]);
  lcd.print (humidity_setpoint, 0);
  lcd.setCursor(0, 3);
  lcd.print(standardText[1]);
  memory_update = 1;
}
editMode = editMode - 1;
break;


void buttons(byte type) {

  plusButton = digitalRead(buttonPlus);
  minusButton = digitalRead(buttonMinus);

  if ((plusButton == 0) && (prevplusButton == 1)) {
    lcd.clear();
    switch (type) {
 case 11:
        humidity_setpoint++; //float adding 1 
        break;
      case 12:
        cal_temp =  cal_temp + 0.1;//float adding 0.1
        break;
      case 20:
        turnerAlarm = !turnerAlarm;//byte flipflop
        break;
   }
    prevplusButton = 0;
  }
  if (plusButton == 1) {
    prevplusButton = 1; //debounce
  }

  if ((minusButton == 0) && (prevMinusButton == 1)) {
    lcd.clear();
    switch (type) {
     case 11:
        humidity_setpoint--;
        break;
      case 12:
        cal_temp =  cal_temp - 0.1;
        break;
     case 20:
        turnerAlarm = !turnerAlarm;
        break;
    }
    prevMinusButton = 0;
  }
  if (minusButton == 1) {
    prevMinusButton = 1; //debounce
  }

}

so im trying this but it means moving byte, int into float positions then converting back later

//example of using a crude return 

//example 1

buttons2(temp_setpoint, 0.1, 0);//float +/- 0.1 not a flip flop
temp_setpoint = result;

//example 2

buttons2(set_hour, 1, 0);//byte +/- 1 not a flip flop
set_hour = result;

//example 3

buttons2(hatchAlarm, 1, 1);//byte, ????? no scale, flip flop
hatchAlarm = result;




void buttons2(float viarable, float scale, byte flipflop) {

  plusButton = digitalRead(buttonPlus);
  minusButton = digitalRead(buttonMinus);

  if ((plusButton == 0) && (prevplusButton == 1)) {
    lcd.clear();
    if (flipflop == 1) {
      viarable = ! viarable;
    } else {
      viarable = viarable + scale;
    }
    prevplusButton = 0;
  }
  if (plusButton == 1) {
    prevplusButton = 1; //debounce
  }

  if ((minusButton == 0) && (prevMinusButton == 1)) {
    lcd.clear();
    if (flipflop == 1) {
      viarable = ! viarable;
    } else {
      viarable = viarable - scale;
    }
    prevMinusButton = 0;
  }
  if (minusButton == 1) {
    prevMinusButton = 1; //debounce
  }
  result = viarable;//result is global
}

both ways seem to work and I haven't found a problem yet

I like the second way but im not sure if im asking for trouble (buttons are locked into a while loop so they shouldn't play with each other)

any suggestions?

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool. I recommend you to use the standard IDE instead.

I recommend you to avoid the use of "magic numbers" for the case values. Instead use a descriptive name for each. Without knowing more about your application I can't suggest very good names but it could look something like this:

const byte setHumidityType = 14;
const byte increaseHumiditySetpointType = 11;
const byte calibrateTempType = 12;
const byte turnerAlarmType = 20;

If the actual numbers don't matter, they only need to be unique, you can use enum:

enum type_t {
 setHumidityType,
 increaseHumiditySetpointType,
 calibrateTempType,
 turnerAlarmType
};

Previously I didn't like to use enum because they take 2 bytes, which is wasteful because when are you ever going to need more than 256 items in an enum? I found a way to make them only take 1 byte:

enum __attribute__((packed)) type_t {
 setHumidityType,
 increaseHumiditySetpointType,
 calibrateTempType,
 turnerAlarmType
};

Another thing you may find helpful with long switch/case statements is to wrap each case in braces:

case 11:
  {
    humidity_setpoint++; //float adding 1
    break;
  }

Then if you do File > Preferences > Enable Code Folding (check) > OK you will see that you can collapse each case, which makes it easier to browse through the code without so much scrolling. As a bonus, it solves any "crosses initialization of" errors.

What I might do is at least split the work into three functions. That reduces the complexity of any one function and makes the code easier to read.

void buttons(byte type) {
  plusButton = digitalRead(buttonPlus);
  if (plusButton != prevplusButton && millis() - prevplusButtonTime > 100) {
    prevplusButton = plusButton;
    prevplusButtonTime = millis();  // Debounce timer

    if (plusButton == LOW)
      PlusButton(type);
  }

  minusButton = digitalRead(buttonMinus);
  if (minusButton != prevminusButton && millis() - prevminusButtonTime > 100) {
    prevminusButton = minusButton;
    prevminusButtonTime = millis();  // Debounce timer
    if (minusButton == LOW)
      MinusButton(type);
  }
}


void PlusButton(byte type) {
    lcd.clear();
    switch (type) {
   case 11:
        humidity_setpoint++; //float adding 1 
        break;
   case 12:
        cal_temp =  cal_temp + 0.1;//float adding 0.1
        break;
   case 20:
        turnerAlarm = !turnerAlarm;//byte flipflop
        break;
   }
}

void MinusButton(byte type) {
    lcd.clear();
    switch (type) {
     case 11:
        humidity_setpoint--;
        break;
      case 12:
        cal_temp =  cal_temp - 0.1;
        break;
     case 20:
        turnerAlarm = !turnerAlarm;
        break;
    }
}