     WiFi.mode( WIFI_AP_STA );
     WiFi.beginSmartConfig();
 
-    const time_t rebootTime = millis() + ( rebootSeconds * 1000 );
+    const unsigned long rebootDelayMs = 60 * 5 * 1000;
 
-    while ( !WiFi.smartConfigDone() && millis() < rebootTime )
+    const unsigned long smartConfigStartMs = millis();
+
+    ESP_LOGI( TAG, "Waiting %i seconds for SmartConfig.", rebootDelayMs / 1000 );
+
+
+    while ( !WiFi.smartConfigDone() && ( (unsigned long) millis() - smartConfigStartMs ) < rebootDelayMs )
     {
       char remainingSCTime[12];
       if ( xOledTaskHandle )

void wifiTask( void * pvParameters )
{
  const uint16_t rebootSeconds = 60 * 5;

  /* trying last accesspoint */
  WiFi.mode( WIFI_STA );
  WiFi.begin();


  if ( WiFi.status() != WL_CONNECTED )
  {
    if ( xTftTaskHandle )
    {
      tft.println( "\nNo WiFi connection.\nWaiting for SmartConfig." );
