Likethis?
top part:
// DEFINE ARDUINO DIGITAL PINS FOR THE NAVIGATION BUTTONS FOR MENWIZ
#define MW_BTNULL //NOBUTTON
#define MW_BTU //UP
#define MW_BTD //DOWN
#define MW_BTE //ESCAPE
#define MW_BTC //CONFIRM
// Create global object for menu and lcd
menwiz menu;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlightpin, polarity
void setup():
// initialize the menu object (20 colums x 4 rows LCD)
menu.begin(&lcd,20,4);
menu.addUsrNav(navMenu);
MW_navbtn=4; // force 4 buttons mode
//create the menu tree
r=menu.addMenu(MW_ROOT,NULL,F("MAIN MENU")); //create a root menu at first (required)
//---------------
s1=menu.addMenu(MW_SUBMENU,r,F("SET1")); //add a submenu node 1 to the root menu
s2=menu.addMenu(MW_VAR,s1,F("MD")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,&modelNumber,1,10,1); //Set value
s2=menu.addMenu(MW_VAR,s1,F("BR")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,&brakeRValue,1,255,stepsMValue); //Set value
s2=menu.addMenu(MW_VAR,s1,F("RH")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,®enHyValue,1,25,1); //Set value
//---------------
s1=menu.addMenu(MW_SUBMENU,r,F("SET2")); //add a submenu node 2 to the root menu
s2=menu.addMenu(MW_VAR,s1,F("CP")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&endCurvePower,1,50,1); //Set value
s2=menu.addMenu(MW_VAR,s1,F("DB")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,&deadbandXvalue,1,25,1); //Set value
s2=menu.addMenu(MW_VAR,s1,F("SQ")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,&stepsQValue,0,10,1); //Set value
s2=menu.addMenu(MW_VAR,s1,F("SM")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_BYTE,&stepsMValue,0,10,1); //Set value
//---------------
s1=menu.addMenu(MW_SUBMENU,r,F("SET3")); //add a submenu node 3 to the root menu
s2=menu.addMenu(MW_VAR,s1,F("RS")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_BOOLEAN,®brakeState); //Set value
s2=menu.addMenu(MW_VAR,s1,F("RCALIB")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_ACTION,resetCalibration); //Set value
s2=menu.addMenu(MW_VAR,s1,F("SCALIB")); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_ACTION,saveCalibration); //Set value
//++++++ Splash screen +++++++
sprintf(menu.sbuf,"SLOT WIZARD MEGA\nSLOT RACE\nuCONTROLLER JC-1\nVersion 3.124 CP \n \n",1); //==============================================================================================================================
menu.addSplash((char *) menu.sbuf, 1000);
//++++++ Userscreen ++++++++++
// create an user define screen callback to activate after X secs since last button push
menu.addUsrScreen(msc,3000);
void loop():
// NAVIGATION MANAGEMENT & DRAWING ON LCD. NOT BLOCKING has to be the first in the void loop
menu.draw();
// ++++ Buttons 10 in total ++++++
buttonValue = analogRead(0); // read the input pin 0
// internal 20K ohm pullup is enabled on analog pin 0 (54).
int navMenu(){ //called by menwiz.draw()
}
if(buttonValue >= 920 and buttonValue <= 930 )
{
MW_BTU //Up button
//digitalWrite(led7Pin, HIGH);
delay (200); // 910
}
else if(buttonValue >= 820 and buttonValue <= 835)
{
MW_BTC // Confirm button
//digitalWrite(led7Pin, HIGH);
delay (200);// 827
}
else if(buttonValue >= 725 and buttonValue <= 740)
{
MW_BTD //Down button
//digitalWrite(led7Pin, HIGH);
delay (200); // 731
}
else if(buttonValue >= 630 and buttonValue <= 645)
{
MW_BTE //Escape button
//digitalWrite(led7Pin, HIGH);
delay (200); // 637
}
else if(buttonValue >= 535 and buttonValue <= 550)
{
switchpointYValue = switchpointYValue - stepsQValue;
delay (200); // 542
}
else if(buttonValue >= 440 and buttonValue <= 455)
{
switchpointXValue = switchpointXValue - stepsQValue;
delay (200); //446
}
else if(buttonValue >= 340 and buttonValue <= 355)
{
speedstartValue = speedstartValue - stepsQValue;
delay (200); //347
}
else if(buttonValue >= 235 and buttonValue <= 250)
{
speedstartValue = speedstartValue + stepsQValue;
delay (200); //241
}
else if(buttonValue >= 125 and buttonValue <= 140)
{
switchpointXValue = switchpointXValue + stepsQValue;
delay (200); //131
}
else if(buttonValue >= 5 and buttonValue <= 20)
{
switchpointYValue = switchpointYValue + stepsQValue;
delay (200); //13
}
else
MW_BTNULL