     Serial.println( WiFi.status() );
     tft.println( WiFi.status() );
     // restart the AP to try again
-    delay(5000);
+    vTaskDelay( 500 / portTICK_PERIOD_MS );
     ESP.restart();
   }
 }

  {
    Serial.print( "." );
    tft.print( "." );
    delay( 500 );
  }
  tft.println();
  Serial.println();

    tft.invertDisplay( true );
    while ( !WiFi.smartConfigDone() )
    {
      vTaskDelay( 500 / portTICK_PERIOD_MS );
      Serial.print(".");
    }
    Serial.println("");
