void showPg(int Pg) {
if (Pg == 0)
{
basicPg();
box(255, 255, 255, 1, 71, 120, 195, 0); //BOX 1 - Top Left frame
box(255, 255, 255, 121, 71, 238, 195, 0); //BOX 2 - Top Right frame
box(255, 255, 255, 1, 196, 120, 318, 0); //BOX 3 - Bottom Left frame
box(255, 255, 255, 121, 196, 238, 318, 0); //BOX 4 - Bottom Right frame
}
if (Pg == 1)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
myGLCD.print("BOX 1", CENTER, 75);
myGLCD.print(b1PlantName, 10, 100);
if (L1_E - L1_S > 12) {myGLCD.print("Flower Cycle", 10, 125);} else {myGLCD.print("Veg Cycle", 10, 125);}
if (CurDay < 10) {myGLCD.print("Day 0" + String(CurDay) + " of " + String(G1_L), 10, 150);} else {myGLCD.print("Day " + String(CurDay) + " of " + String(G1_L), 10, 150);}
delay(zzz);
myGLCD.clrScr();
}
if (Pg == 2)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
myGLCD.print("BOX 2", CENTER, 75);
myGLCD.print(b2PlantName, 10, 100);
if (L2_E - L2_S > 12) {myGLCD.print("Flower Cycle ", 10, 125);} else {myGLCD.print("Veg Cycle ", 10, 125);}
if (CurDay < 10) {myGLCD.print("Day 0" + String(CurDay) + " of " + String(G2_L), 10, 150);} else {myGLCD.print("Day " + String(CurDay) + " of " + String(G2_L), 10, 150);}
delay(zzz);
myGLCD.clrScr();
}
if (Pg == 3)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
myGLCD.print("BOX 3", CENTER, 75);
myGLCD.print(b3PlantName, 10, 100);
if (L3_E - L3_S > 12) {myGLCD.print("Flower Cycle ", 10, 125);} else {myGLCD.print("Veg Cycle ", 10, 125);}
if (CurDay < 10) {myGLCD.print("Day 0" + String(CurDay) + " of " + String(G3_L), 10, 150);} else {myGLCD.print("Day " + String(CurDay) + " of " + String(G3_L), 10, 150);}
delay(zzz);
myGLCD.clrScr();
}
if (Pg == 4)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
myGLCD.print("BOX 4", CENTER, 75);
myGLCD.print(b4PlantName, 10, 100);
if (L4_E - L4_S > 12) {myGLCD.print("Flower Cycle ", 10, 125);} else {myGLCD.print("Veg Cycle ", 10, 125);}
if (CurDay < 10) {myGLCD.print("Day 0" + String(CurDay) + " of " + String(G4_L), 10, 150);} else {myGLCD.print(" Day " + String(CurDay) + " of " + String(G4_L), 10, 150);}
delay(zzz);
myGLCD.clrScr();
}
if (Pg == 5)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
Serial.println("Reads:");
Serial.print(rtcReads);
myGLCD.print("Reads:", 10, 75);
myGLCD.print(String(rtcReads), 200, 75);
Serial.println("Passed Read");
Serial.print(rtcPassed);
myGLCD.print("Passed", 10, 100);
myGLCD.print(String(rtcPassed), 200, 100);
Serial.println("Failed Read");
Serial.print(rtcFailed);
myGLCD.print("Failed", 10, 125);
myGLCD.print(String(rtcFailed), 200, 125);
Serial.println("Resync Fail");
Serial.print(resyncFailed);
myGLCD.print("Resync Fail", 10, 150);
myGLCD.print(String(resyncFailed), 200, 150);
exitButton(); //was delay(zzz);
myGLCD.clrScr();
}
if (Pg == 10)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
//
myGLCD.clrScr();
}
if (Pg == 99)
{
myGLCD.clrScr();
basicPg();
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 255, 255);
Serial.print("RESETTING");
myGLCD.print("RESETTING", CENTER, 90);
Serial.println("---------");
myGLCD.print("---------", CENTER, 110);
for (int x=0; x<=8; x++) {Serial.println(8-x); myGLCD.print(" ", CENTER, 150); delay(100); myGLCD.print(String(8-x), CENTER, 150); delay(900);}
myGLCD.clrScr();
}
}
void basicPg() {
box(255, 255, 255, 0, 0, 239, 319, 0); //Main outside frame
box(255, 255, 255, 1, 1, 238, 70, 0); //Top center frame
myGLCD.setColor(0, 255, 0);
myGLCD.setFont(BigFont);
myGLCD.print("T0YB0X", CENTER, 6);
myGLCD.setColor(0, 0, 0);
myGLCD.drawLine(2, 25, 237, 25);
Date(CENTER, 30);
Clock(CENTER, 50);
wdt_reset();
}
void exitButton() {
box(255, 255, 255, 10, 175, 50, 215, 0);
myGLCD.print("1", 22, 187);
box(255, 255, 255, 55, 175, 95, 215, 0);
myGLCD.print("2", 67, 187);
box(255, 255, 255, 100, 175, 140, 215, 0);
myGLCD.print("3", 112, 187);
box(255, 255, 255, 145, 175, 185, 215, 0);
myGLCD.print("4", 157, 187);
box(255, 255, 255, 190, 175, 230, 215, 0);
myGLCD.print("5", 202, 187);
box(255, 255, 255, 10, 225, 50, 265, 0);
myGLCD.print("6", 22, 237);
box(255, 255, 255, 55, 225, 95, 265, 0);
myGLCD.print("7", 67, 237);
box(255, 255, 255, 100, 225, 140, 265, 0);
myGLCD.print("8", 112, 237);
box(255, 255, 255, 145, 225, 185, 265, 0);
myGLCD.print("9", 157, 237);
box(255, 255, 255, 190, 225, 230, 265, 0);
myGLCD.print("0", 202, 237);
box(255, 255, 255, 10, 275, 228, 309, 0);
myGLCD.print("E X I T", CENTER, 285);
delay(zzz*2);
myGLCD.clrScr();
myTouch.read();
x = myTouch.getX();
y = myTouch.getY();
myGLCD.print(String(x), 22, 187);
myGLCD.print(String(y), 22, 237);
delay(zzz*10);
}