 void setup()
 {
   dayLightVal = analogRead(A10);
-  //Serial.println(dayLightVal);
-  //backlightPerc = (0.0000003*(dayLightVal*dayLightVal*dayLightVal))-(0.0006*(dayLightVal*dayLightVal))+(0.397*dayLightVal);
-  //Serial.println(backlightPerc);
   backlightValue = 0.2138*dayLightVal + 20.5;
-  //Serial.println(backlightValue);
-  //backlightValue = ((backlightPercent*backlightPercent*backlightPercent)/3937) + 1.5;
-  //backlightValue = (127 * backlightPercent) / 50 + 1;
   analogWrite(backlightPin, backlightValue);
-  //Serial.println(backlightValue);
 
   Tft.TFTinit();                                        // init TFT library
 
-  pinMode(24, OUTPUT);					// needed to set digital pin to high at 5v for switching MOSFET
-  pinMode(26, OUTPUT);					// needed to set digital pin to high at 5v for switching MOSFET
+  pinMode(24, OUTPUT);					                        // needed to set digital pin to high at 5v for switching MOSFET
+  pinMode(26, OUTPUT);					                        // needed to set digital pin to high at 5v for switching MOSFET
 
   Serial.begin(9600);
 
-  //Tft.fillRectangle(0, 0, 239, 319, WHITE);
-
-  Tft.drawRectangle(10, 20, 220, 280, GREEN); 	    // (X-coord start, Y-coord start, X length, y length, color)
+  Tft.drawRectangle(10, 20, 220, 280, GREEN); 	        // (X-coord start, Y-coord start, X length, y length, color)
   Tft.drawString("OIL", 73, 38, 5, GREEN);
   Tft.drawString("OIL", 75, 40, 5, BLUE);
   delay(500);

  //degreesC = (voltage - 0.5) * 100.0;
  //degreesF = degreesC * (9.0/5.0) + 32.0;
  // subtract the last reading:
  total = total - readings[index];
  // read from the sensor:
  readings[index] = temp;
  // add the reading to the total:
  total = total + readings[index];
  // advance to the next position in the array:
  index = index + 1;
  // if we're at the end of the array...
  if (index >= numReadings)
    // ...wrap around to the beginning:
    index = 0;
  // calculate the average:
  average = total / numReadings;

fuelGage();

const int returnValve = 24;      			// red LED
const int supplyValve = 26;    				// green LED, will also power bypass valve and Fuel pump Relay
int page = 0;                  				// the page to prevent button pushes from working on pages where the button doesnt exist
                                      // homescreen = 0, settings = 2, purgeSetTime = 3, tempSet = 4

int purgeTime;					              // purge time of the of valves in seconds. Set to 5 now for ease of troubleshooting.
                                      // minimum in purgeSetTime menu is 30. this value will be changed for final code.
unsigned long Timer = 0;				      // unkown variable.....
boolean autoState;    				        // whether the controller is running in auto or manual mode. Auto = 1, manual = 0.
boolean oilState = 0;     				    // whether the controller is switched to oil or not. Oil = 1, diesel = 0.
boolean tempState = 0;     				    // whether the temp is above or below set temp. Above setTemp = 1, below setTemp = 0.
boolean oldtempState = 0;				      // used to get into if statements only when tempState has just switched and oldTempState is different.
boolean purgeState = 0;					      // whether or not purgeTimer is running. Purging = 1, not purging = 0.
int setTemp;       				            // Automatic oil switch and purge temperature threshold in degrees Farenheit
long previousMillis = 0;				      // time in millis when purge timer function begins
unsigned long currentMillis = 0;			// current time in millis compared to previousMillis to determine when purgeTime is met
int countdown = 0;					          // purgeTime left in seconds, to be displayed during purge process
int oldCountdown = 0;					        // old purgeTime value , compared to countdown to determine when to overwrite countdown value.

int backlightPin = 7;
float backlightValue;
