       delay(15000);
     }
     digitalWrite(fillpump, LOW);
-    periodicaeration(15,60, now.unixtime());
-    delay(15000);
-}}
-
-void periodicaeration(float ontime, float onfreq, float tt){//on for 15 min freq is 60 min
-  ontime=ontime*60*1000;
-  onfreq=onfreq*60*1000;
-  if (onfreq-ontime>tt-starttime){
-  lcd.clear();
-  lcd.setCursor(0,0);
-  lcd.print("Periodic Aeration ");
+}
+
+void periodicaeration(float ontime){//on for 15 min freq is 60 min
+  ontime=ontime*60;
+  lcd.clear();
+  lcd.setCursor(0,0);
+  lcd.print("PeriodicAeration ");
   DateTime now = rtc.now();
-  float current = now.unixtime();
-  while (current-tt < ontime){
-    float timedisplay= (ontime-(current-tt))*1000*60;
+  float tt = now.unixtime();
+  float current=tt;
+  int timedisplay = round((ontime-(current-tt))/60);
+  while ((current-tt) < ontime){
+    timedisplay = round((ontime-(current-tt))/60);
+    measurevol();
     lcd.setCursor(0,1);
+  lcd.print(tank);lcd.print("gal  ");
   lcd.print(timedisplay);
+  lcd.print("min");
   delay(1000);
   digitalWrite(air, HIGH);
-  DateTime now = rtc.now();
+  now = rtc.now();
   current = now.unixtime();
   }
-digitalWrite(air, LOW);  }
-  }
+digitalWrite(air, LOW);  
+}
 void aeration(float airduration, int lvl){//duration in min check depth and keep air on and pumps off for time period
   airduration=airduration*60*1000;
   lcd.clear();

  lcd.setCursor(0,1);
  lcd.print(tank);lcd.print("gal");
  DateTime now = rtc.now();
   while (now.unixtime()-starttime <3600000){
    
    DateTime now = rtc.now();
    while (tank<lvl){
      digitalWrite(fillpump, HIGH);
      measurevol();

int depth = A0;
int x=0;
float starttime;
float begintime;
float tank;
float airtimer;
void setup() {
