     }
     cycle = (cycle + 1) % 6000;
     ApplicationMonitor.IAmAlive();
+    unsigned long thisWatchTime = micros();
+    if(thisWatchTime > lastWatchTime) {
+      lastWatch = thisWatchTime - lastWatchTime;
+    } else {
+      lastWatch = 4294967295 - lastWatchTime + thisWatchTime;
+    }
+    lastWatchTime = thisWatchTime;
+    if(lastWatch > maxWatch) {
+      maxWatch = lastWatch;
+    }
     delay(100);
   }
 }

    tap2->Loop(cycle);

    if(cycle % 600 == 0) {
      writeStatus();
    }
    if(cycle % 600 == 0) {
      http->Heartbeat();

  http->LogMessage(buf);
}

void writeStatus(unsigned long lastWatch, unsigned long maxWatch) {
  char buf[128];
  PString pBuf(buf, 128);
  pBuf << "Status: free memory: " << freeMemory() << ", Lowest: " << http->_minFreeMemory << ", lastWatch: " << lastWatch << ", maxWatch: " << maxWatch;
  http->LogMessage(buf);
}

