bool displayChanged; const int MAXCOLUMN = 2; // The number of columns in the menus const int MAXROW[2] = {6,6}; // The maximum number of rows is column-dependent String line1txt; // String to be displayed on the LCD's first line String line2txt; // String to be displayed on the LCD's second line int rowcount = 1; // pointer to the row for display int colcount = 0; // pointer to the column for display void readNavButtons() { buttons = lcd.readButtons(); upBtn = (buttons & BUTTON_UP) != 0; dwnBtn = (buttons & BUTTON_DOWN) != 0; lftBtn = (buttons & BUTTON_LEFT) != 0; rgtBtn = (buttons & BUTTON_RIGHT) != 0; selBtn = (buttons & BUTTON_SELECT) != 0; } void selectStatusDisplay(){ if (buttons) { backlightTO = NUMOFSAMPLES; // use the same "timeout" for both the backlight and the logging lcd.setBacklight(ON); displayChanged = true; if (upBtn) { // scroll display towards top of column if (rowcount != 0) { rowcount -= 1; } } if (dwnBtn) { // scroll display towards bottom of column if (rowcount != (MAXROW[colcount])-2){ rowcount += 1; } } if (lftBtn) { if (colcount != 0){ colcount -= 1; rowcount = 0; } } if (rgtBtn) { if (colcount != (MAXCOLUMN-1)){ colcount += 1; rowcount = 0; } } } else { backlightTO -= 1; // Decrement counter if there is no keypress } } void selectStatusStrings(){ switch(colcount){ case 0: switch(rowcount){ case 0: line1txt = "General"; line2txt = accuracy1; break; case 1: line1txt = accuracy1; line2txt = accuracy2; break; case 2: line1txt = accuracy2; line2txt = shldStatus; break; case 3: line1txt = shldStatus; line2txt = udpStatus; break; case 4: line1txt = udpStatus; line2txt = sdStatus; break; default: line1txt = ""; line2txt = ""; } break; case 1: switch(rowcount){ case 0: line1txt = "Connection"; line2txt = connSSID; break; case 1: line1txt = connSSID; line2txt = connIPaddr; break; case 2: line1txt = connIPaddr; line2txt = connSS; break; case 3: line1txt = connSS; line2txt = dateStringStart; break; case 4: line1txt = dateStringStart; line2txt = timeStringStart; break; default: line1txt = ""; line2txt = ""; } break; default: line1txt = ""; line2txt = ""; } } void showStatus(){ if (displayChanged || firstLoop){ lcd.clear(); lcd.setCursor(0,0); lcd.print(line1txt); lcd.setCursor(0,1); lcd.print(line2txt); displayChanged = false; } }