Error: """""......C:\Users\chara\OneDrive\Documents\Arduino\FUGU-ARDUINO-MPPT-FIRMWARE-main\FUGU-ARDUINO-MPPT-FIRMWARE-main\ARDUINO_MPPT_FIRMWARE_V1.1\8_LCD_Menu.ino: In function 'void LCD_Menu()':
8_LCD_Menu:554:6: error: insn does not satisfy its constraints:
554 | } }
| ^
(insn 11 4070 1574 179 (set (reg:SF 19 f0 [orig:139 _108 ] [139])
(mem/u/c:SF (symbol_ref/u:SI ("*.LC425") [flags 0x2]) [0 S4 A32])) "C:\Users\chara\OneDrive\Documents\Arduino\FUGU-ARDUINO-MPPT-FIRMWARE-main\FUGU-ARDUINO-MPPT-FIRMWARE-main\ARDUINO_MPPT_FIRMWARE_V1.1\8_LCD_Menu.ino":289:33 49 {movsf_internal}
(expr_list:REG_EQUAL (const_double:SF 0.0 [0x0.0p+0])
(nil)))
during RTL pass: postreload
C:\Users\chara\OneDrive\Documents\Arduino\FUGU-ARDUINO-MPPT-FIRMWARE-main\FUGU-ARDUINO-MPPT-FIRMWARE-main\ARDUINO_MPPT_FIRMWARE_V1.1\8_LCD_Menu.ino:554:6: internal compiler error: in extract_constrain_insn, at recog.cc:2692
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See https://gcc.gnu.org/bugs/ for instructions.
exit status 1
insn does not satisfy its constraints:
......... """"""
I am making MPPT based solar charge controller using ESP32. I got this error when I tried to compile the project in Arduino IDE where I need to operate the LCD parameters using buttons. The output must look something like LCD display should show the values based on the push button input. But it is not happening instead the error "insn doesn't satisfy its constraints" is popping up. Kindly help me what can be done in solving this error and make my project work...????
void LCD_Menu(){
int
menuPages = 4,
subMenuPages = 12,
longPressTime = 3000,
longPressInterval = 500,
shortPressInterval = 100;
//SETTINGS MENU
if(settingMode==1){
chargingPause = 1;
//BUTTON KEYPRESS
if(setMenuPage==0){
if(digitalRead(buttonRight)==1){subMenuPage++;}
if(digitalRead(buttonLeft)==1) {subMenuPage--;}
if(digitalRead(buttonBack)==1) {settingMode=0;subMenuPage=0;} //bool engage, main menu int page
if(digitalRead(buttonSelect)==1){setMenuPage=1;} //enter sub menu settings - bool engage
lcdBacklight_Wake();
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1
||digitalRead(buttonBack)==1||digitalRead(buttonSelect)==1){}
}
//SUB MENU PAGE CYCLING
if(subMenuPage>subMenuPages){subMenuPage=0;}
else if(subMenuPage<0){subMenuPage=subMenuPages;}
//--------------------------- SETTINGS MENU PAGES: ---------------------------//
///// SETTINGS MENU ITEM: SUPPLY ALGORITHM SELECT /////
if(subMenuPage==0){
lcd.setCursor(0,0);lcd.print("SUPPLY ALGORITHM");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
if(MPPT_Mode==1){lcd.print("MPPT + CC-CV ");}
else{lcd.print("CC-CV ONLY ");}
//SET MENU - BOOLTYPE
if(setMenuPage==0){boolTemp = MPPT_Mode;}
else{
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}
if(MPPT_Mode==1){MPPT_Mode=0;}else{MPPT_Mode=1;}
}
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}MPPT_Mode = boolTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
}
}
///// SETTINGS MENU ITEM: CHARER/PSU MODE /////
else if(subMenuPage==1){
lcd.setCursor(0,0);lcd.print("CHARGER/PSU MODE");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
if(output_Mode==1){lcd.print("CHARGER MODE ");}
else{lcd.print("PSU MODE ");}
//SET MENU - BOOLTYPE
if(setMenuPage==0){boolTemp = output_Mode;}
else{
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}
if(output_Mode==1){output_Mode=0;}else{output_Mode=1;}
}
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}output_Mode = boolTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
}
}
///// SETTINGS MENU ITEM: MAX BATTERY V /////
else if(subMenuPage==2){
lcd.setCursor(0,0);lcd.print("MAX BATTERY V ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);lcd.print(voltageBatteryMax,2);lcd.print("V");
lcd.print(" ");
//SET MENU - FLOATTYPE
if(setMenuPage==0){floatTemp = voltageBatteryMax;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}voltageBatteryMax = floatTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
currentMenuSetMillis = millis();
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
while(digitalRead(buttonRight)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
voltageBatteryMax += 1.00; //Increment by 1
voltageBatteryMax = constrain(voltageBatteryMax,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMax,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
voltageBatteryMax += 0.01; //Increment by 0.01
voltageBatteryMax = constrain(voltageBatteryMax,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMax,2);delay(shortPressInterval); //Display settings data
}
lcd.print("V "); //Display unit
}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
while(digitalRead(buttonLeft)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
voltageBatteryMax -= 1.00; //Increment by 1
voltageBatteryMax = constrain(voltageBatteryMax,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMax,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
voltageBatteryMax -= 0.01; //Increment by 0.01
voltageBatteryMax = constrain(voltageBatteryMax,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMax,2);delay(shortPressInterval); //Display settings data
}
lcd.print("V "); //Display unit
}
}
}
}
///// SETTINGS MENU ITEM: MIN BATTERY V /////
else if(subMenuPage==3){
lcd.setCursor(0,0);lcd.print("MIN BATTERY V ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);lcd.print(voltageBatteryMin,2);lcd.print("V");
lcd.print(" ");
//SET MENU - FLOATTYPE
if(setMenuPage==0){floatTemp = voltageBatteryMin;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}voltageBatteryMin = floatTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
currentMenuSetMillis = millis();
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
while(digitalRead(buttonRight)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
voltageBatteryMin += 1.00; //Increment by 1
voltageBatteryMin = constrain(voltageBatteryMin,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMin,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
voltageBatteryMin += 0.01; //Increment by 0.01
voltageBatteryMin = constrain(voltageBatteryMin,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMin,2);delay(shortPressInterval); //Display settings data
}
lcd.print("V "); //Display unit
}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
while(digitalRead(buttonLeft)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
voltageBatteryMin -= 1.00; //Increment by 1
voltageBatteryMin = constrain(voltageBatteryMin,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMin,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
voltageBatteryMin -= 0.01; //Increment by 0.01
voltageBatteryMin = constrain(voltageBatteryMin,vOutSystemMin,vOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(voltageBatteryMin,2);delay(shortPressInterval); //Display settings data
}
lcd.print("V "); //Display unit
}
}
}
}
///// SETTINGS MENU ITEM: CHARGING CURRENT /////
else if(subMenuPage==4){
lcd.setCursor(0,0);lcd.print("CHARGING CURRENT");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);lcd.print(currentCharging,2);lcd.print("A");
lcd.print(" ");
//SET MENU - FLOATTYPE
if(setMenuPage==0){floatTemp = currentCharging;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}currentCharging = floatTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
currentMenuSetMillis = millis();
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
while(digitalRead(buttonRight)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
currentCharging += 1.00; //Increment by 1
currentCharging = constrain(currentCharging,0.0,cOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(currentCharging,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
currentCharging += 0.01; //Increment by 0.01
currentCharging = constrain(currentCharging,0.0,cOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(currentCharging,2);delay(shortPressInterval); //Display settings data
}
lcd.print("A "); //Display unit
}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
while(digitalRead(buttonLeft)==1){
if(millis()-currentMenuSetMillis>longPressTime){ //Long Press
currentCharging -= 1.00; //Increment by 1
currentCharging = constrain(currentCharging,0.0,cOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(currentCharging,2);delay(longPressInterval); //Display settings data
}
else{ //Short Press
currentCharging -= 0.01; //Increment by 0.01
currentCharging = constrain(currentCharging,0.0,cOutSystemMax); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(currentCharging,2);delay(shortPressInterval); //Display settings data
}
lcd.print("A "); //Display unit
}
}
}
}
///// SETTINGS MENU ITEM: COOLING FAN /////
else if(subMenuPage==5){
lcd.setCursor(0,0);lcd.print("COOLING FAN ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
if(enableFan==1){lcd.print("ENABLED ");}
else{lcd.print("DISABLE ");}
//SET MENU - BOOLTYPE
if(setMenuPage==0){boolTemp = enableFan;}
else{
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}
if(enableFan==1){enableFan=0;}else{enableFan=1;}
}
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}enableFan = boolTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
}
}
///// SETTINGS MENU ITEM: FAN TRIG TEMP /////
else if(subMenuPage==6){
lcd.setCursor(0,0);lcd.print("FAN TRIGGER TEMP");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);lcd.print(temperatureFan);
lcd.print((char)223);lcd.print("C");lcd.print(" ");
//SET MENU - INTTYPE
if(setMenuPage==0){intTemp = temperatureFan;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}temperatureFan = intTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
while(digitalRead(buttonRight)==1){
temperatureFan++; //Increment by 1
temperatureFan = constrain(temperatureFan,0,100); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(temperatureFan);delay(shortPressInterval); //Display settings data
lcd.print((char)223);lcd.print("C "); //Display unit
}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
while(digitalRead(buttonLeft)==1){
temperatureFan--; //Increment by 1
temperatureFan = constrain(temperatureFan,0,100); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(temperatureFan);delay(shortPressInterval); //Display settings data
lcd.print((char)223);lcd.print("C "); //Display unit
}
}
}
}
///// SETTINGS MENU ITEM: SHUTDOWN TEMP /////
else if(subMenuPage==7){
lcd.setCursor(0,0);lcd.print("SHUTDOWN TEMP ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);lcd.print(temperatureMax);
lcd.print((char)223);lcd.print("C");lcd.print(" ");
//SET MENU - INTTYPE
if(setMenuPage==0){intTemp = temperatureMax;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}temperatureMax = intTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
while(digitalRead(buttonRight)==1){
temperatureMax++; //Increment by 1
temperatureMax = constrain(temperatureMax,0,120); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(temperatureMax);delay(shortPressInterval); //Display settings data
lcd.print((char)223);lcd.print("C "); //Display unit
}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
while(digitalRead(buttonLeft)==1){
temperatureMax--; //Increment by 1
temperatureMax = constrain(temperatureMax,0,120); //Limit settings values to a range
lcd.setCursor(2,1);lcd.print(temperatureMax);delay(shortPressInterval); //Display settings data
lcd.print((char)223);lcd.print("C "); //Display unit
}
}
}
}
///// SETTINGS MENU ITEM: WIFI FEATURE /////
else if(subMenuPage==8){
lcd.setCursor(0,0);lcd.print("WIFI FEATURE ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
if(enableWiFi==1){lcd.print("ENABLED ");}
else{lcd.print("DISABLED ");}
//SET MENU - BOOLTYPE
if(setMenuPage==0){boolTemp = enableWiFi;}
else{
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}
if(enableWiFi==1){enableWiFi=0;}else{enableWiFi=1;}
}
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}enableWiFi = boolTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
}
}
///// SETTINGS MENU ITEM: AUTOLOAD /////
else if(subMenuPage==9){
lcd.setCursor(0,0);lcd.print("AUTOLOAD FEATURE");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
if(flashMemLoad==1){lcd.print("ENABLED ");}
else{lcd.print("DISABLED ");}
//SET MENU - BOOLTYPE
if(setMenuPage==0){boolTemp = flashMemLoad;}
else{
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){
while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}
if(flashMemLoad==1){flashMemLoad=0;}else{flashMemLoad=1;}
}
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}flashMemLoad = boolTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveAutoloadSettings();setMenuPage=0;savedMessageLCD();}
}
}
///// SETTINGS MENU ITEM: BACKLIGHT SLEEP /////
else if(subMenuPage==10){
lcd.setCursor(0,0);lcd.print("BACKLIGHT SLEEP ");
if(setMenuPage==1){lcd.setCursor(0,1);lcd.print(" >");}
else{lcd.setCursor(0,1);lcd.print("= ");}
lcd.setCursor(2,1);
if(backlightSleepMode==1) {lcd.print("10 SECONDS ");}
else if(backlightSleepMode==2){lcd.print("5 MINUTES ");}
else if(backlightSleepMode==3){lcd.print("1 HOUR ");}
else if(backlightSleepMode==4){lcd.print("6 HOURS ");}
else if(backlightSleepMode==5){lcd.print("12 HOURS ");}
else if(backlightSleepMode==6){lcd.print("1 DAY ");}
else if(backlightSleepMode==7){lcd.print("3 DAYS ");}
else if(backlightSleepMode==8){lcd.print("1 WEEK ");}
else if(backlightSleepMode==9){lcd.print("1 MONTH ");}
else{lcd.print("NEVER ");}
//SET MENU - INTMODETYPE
if(setMenuPage==0){intTemp = backlightSleepMode;}
else{
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}backlightSleepMode = intTemp;cancelledMessageLCD();setMenuPage=0;}
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}saveSettings();setMenuPage=0;savedMessageLCD();}
if(digitalRead(buttonRight)==1){ //Right button press (increments setting values)
backlightSleepMode++; //Increment by 1
backlightSleepMode = constrain(backlightSleepMode,0,9); //Limit settings values to a range
lcd.setCursor(2,1);
if(backlightSleepMode==1) {lcd.print("10 SECONDS ");}
else if(backlightSleepMode==2){lcd.print("5 MINUTES ");}
else if(backlightSleepMode==3){lcd.print("1 HOUR ");}
else if(backlightSleepMode==4){lcd.print("6 HOURS ");}
else if(backlightSleepMode==5){lcd.print("12 HOURS ");}
else if(backlightSleepMode==6){lcd.print("1 DAY ");}
else if(backlightSleepMode==7){lcd.print("3 DAYS ");}
else if(backlightSleepMode==8){lcd.print("1 WEEK ");}
else if(backlightSleepMode==9){lcd.print("1 MONTH ");}
else{lcd.print("NEVER ");}
while(digitalRead(buttonRight)==1){}
}
else if(digitalRead(buttonLeft)==1){ //Left button press (decrements setting values)
backlightSleepMode--; //Increment by 1
backlightSleepMode = constrain(backlightSleepMode,0,9); //Limit settings values to a range
lcd.setCursor(2,1);
if(backlightSleepMode==1) {lcd.print("10 SECONDS ");}
else if(backlightSleepMode==2){lcd.print("5 MINUTES ");}
else if(backlightSleepMode==3){lcd.print("1 HOUR ");}
else if(backlightSleepMode==4){lcd.print("6 HOURS ");}
else if(backlightSleepMode==5){lcd.print("12 HOURS ");}
else if(backlightSleepMode==6){lcd.print("1 DAY ");}
else if(backlightSleepMode==7){lcd.print("3 DAYS ");}
else if(backlightSleepMode==8){lcd.print("1 WEEK ");}
else if(backlightSleepMode==9){lcd.print("1 MONTH ");}
else{lcd.print("NEVER ");}
while(digitalRead(buttonLeft)==1){}
}
}
}
///// SETTINGS MENU ITEM: FACTORY RESET /////
else if(subMenuPage==11){
if(setMenuPage==0){
lcd.setCursor(0,0);lcd.print("FACTORY RESET ");
lcd.setCursor(0,1);lcd.print("> PRESS SELECT ");
}
else{
if(confirmationMenu==0){lcd.setCursor(0,0);lcd.print(" ARE YOU SURE? ");lcd.setCursor(0,1);lcd.print(" >NO YES ");} // Display ">No"
else{lcd.setCursor(0,0);lcd.print(" ARE YOU SURE? ");lcd.setCursor(0,1);lcd.print(" NO >YES ");} // Display ">YES"
if(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){while(digitalRead(buttonRight)==1||digitalRead(buttonLeft)==1){}if(confirmationMenu==0){confirmationMenu=1;}else{confirmationMenu=0;}} //Cycle Yes NO
if(digitalRead(buttonBack)==1){while(digitalRead(buttonBack)==1){}cancelledMessageLCD();setMenuPage=0;confirmationMenu=0;} //Cancel
if(digitalRead(buttonSelect)==1){while(digitalRead(buttonSelect)==1){}if(confirmationMenu==1){factoryReset();factoryResetMessageLCD();}setMenuPage=0;confirmationMenu=0;subMenuPage=0;}
}
}
///// SETTINGS MENU ITEM: FIRMWARE VERSION /////
else if(subMenuPage==12){
if(setMenuPage==0){
lcd.setCursor(0,0);lcd.print("FIRMWARE VERSION");
lcd.setCursor(0,1);lcd.print(firmwareInfo);
lcd.setCursor(8,1);lcd.print(firmwareDate);
}
else{
lcd.setCursor(0,0);lcd.print(firmwareContactR1);
lcd.setCursor(0,1);lcd.print(firmwareContactR2);
if(digitalRead(buttonBack)==1||digitalRead(buttonSelect)==1){while(digitalRead(buttonBack)==1||digitalRead(buttonSelect)==1){}setMenuPage=0;} //Cancel
}
}
}
//MAIN MENU
else if(settingMode==0){
chargingPause = 0;
//LCD BACKLIGHT SLEEP
lcdBacklight();
//BUTTON KEYPRESS
if(digitalRead(buttonRight)==1) {buttonRightCommand=1;lcdBacklight_Wake();}
if(digitalRead(buttonLeft)==1) {buttonLeftCommand=1;lcdBacklight_Wake();}
if(digitalRead(buttonBack)==1) {buttonBackCommand=1;lcdBacklight_Wake();}
if(digitalRead(buttonSelect)==1){buttonSelectCommand=1;lcdBacklight_Wake();}
currentLCDMillis = millis();
if(currentLCDMillis-prevLCDMillis>=millisLCDInterval&&enableLCD==1){ //Run routine every millisLCDInterval (ms)
prevLCDMillis = currentLCDMillis;
//MENU PAGE BUTTON ACTION
if(buttonRightCommand==1) {buttonRightCommand=0;menuPage++;lcd.clear();}
else if(buttonLeftCommand==1) {buttonLeftCommand=0;menuPage--;lcd.clear();}
else if(buttonBackCommand==1) {buttonBackCommand=0;menuPage=0;lcd.clear();}
else if(buttonSelectCommand==1&&menuPage==4){buttonSelectCommand=0;settingMode=1;lcd.clear();}
if(menuPage>menuPages){menuPage=0;}
else if(menuPage<0){menuPage=menuPages;}
if(menuPage==0) {displayConfig1();}
else if(menuPage==1){displayConfig2();}
else if(menuPage==2){displayConfig3();}
else if(menuPage==3){displayConfig4();}
else if(menuPage==4){displayConfig5();}
}
} }