 
 String getIP(bool cache) {
   static String ip = "";
-  if (ip.length() && cache) {
-     return ip;
+  if (!(ip.length() && cache)) {
+    ip = wifi.getip();
   }
-  String pattern = "STAIP,\"";
-  String answer = wifi.getip().c_str();
-  int starti = answer.indexOf(pattern) + pattern.length();
-  ip = answer.substring(starti, answer.length() -1);  
-  int stopi = ip.indexOf("\"");
-  ip = ip.substring(0,stopi);
   return ip;
 }
 

    SerialUSB.println('connecting to WIFI...');
    delay(5000);
  }
  SerialUSB.println("connected to WIFI.");
  Serial.println(wifi.getip());
  SerialUSB.print("IP from my own getip(): ");
  SerialUSB.println(getIP(true)); // short version of IP, cached
  SerialUSB.print("MAC from my own gethostname(): ");

}

void serial_setup(void) {
  SerialUSB.begin(115200); //Opens USB-Serial connection for terminal
  delay(5000);
  SerialUSB.print("Serial interface is ready\r\n");
}
