 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 number = 0;						// unknown variable.....
-
-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
+                                      // 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 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;

int tempSetPointAddress = 2;
int brightnessAddress = 3;

int fuelLevel;                                          // value from 0 to 100 equating to the fuel level
float fuelLevelVal;                                     // analog value from 728 to 254, read from the fuel level voltage divider;
int xLength;                                            // length of bar in fuel level bar graph
int oldxLength;
int fuelLevelPin = A15;                                    // pin that is reading the voltage of the voltage divider for the fuel sender

int readingP[numReadings];          // the readings from the analog input
int indexP = 0;                      // the index of the current reading
int sumP = 0;                      // the running total
int psi = 0;
int pressure = 0;                   // current fuel pressure
int oldpressure = 0;                // old fuel pressure
int pressurePin = A14;              // analog pressure pin
double pressureVoltage;

TouchScreen ts = TouchScreen(XP, YP, XM, YM);	        // values for coordinate system inputs on touchscreen.

  //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();
