 }
 
 /* https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiType.h */
-void waitForWifi()
-{
+void waitForWifi() {
   unsigned long timeOut = millis() + 10000;
   while ( !WiFi.isConnected() && millis() < timeOut )
-  {
-    if ( xTftTaskHandle )
-    {
-      tft.print( "." );
-    }
-    vTaskDelay( 500 / portTICK_PERIOD_MS );
-  }
+    vTaskDelay( 20 / portTICK_PERIOD_MS );
 }
-/*
-  void WiFiEvent( WiFiEvent_t event )
-  {
-  switch ( event )
-  {
+
+void WiFiEvent( WiFiEvent_t event ) {
+  switch ( event ) {
     case SYSTEM_EVENT_AP_START:
       ESP_LOGI( TAG, "AP Started");
       //WiFi.softAPsetHostname(AP_SSID);

    default:
      break;
  }
  }
*/

        OLED.display();
      }

      if ( xTftTaskHandle ) {
        tft.setCursor( 70, 100 );
        tft.print( remainingSCTime );
      }
      else
        digitalWrite( BUILTIN_LED, !gpio_get_level( gpio_num_t( BUILTIN_LED ) ) );
      vTaskDelay( 500 / portTICK_PERIOD_MS );
    }

    if ( !WiFi.smartConfigDone() )
      ESP.restart();

    if ( !xTftTaskHandle )
      digitalWrite( BUILTIN_LED, LOW );
  }

  waitForWifi();

  /* We have succesfully connected */
  uint8_t mac[6];
  esp_efuse_mac_get_default(mac);
  ESP_LOGI( TAG, "WiFi '%s' %s %02x:%02x:%02x:%02x:%02x:%02x",
            WiFi.SSID().c_str(), WiFi.localIP().toString().c_str(), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
  if ( xTftTaskHandle ) {
    tft.invertDisplay( false );
    tft.printf( "WiFi connected.\nLocal IP: %s\n", WiFi.localIP().toString() );
  }
  if ( xOledTaskHandle )
    OLED.normalDisplay();
  strncpy( hostName, preferences.getString( "hostname", "" ).c_str(), sizeof( hostName ) );

  if ( hostName[0] ==  0 ) {
    snprintf( hostName, sizeof( hostName ), "%s%c%c%c%c%c%c", DEFAULT_HOSTNAME_PREFIX,
              WiFi.macAddress()[9], WiFi.macAddress()[10],
              WiFi.macAddress()[12], WiFi.macAddress()[13],
