       {
         char wrongName[81];
         snprintf( wrongName , sizeof( wrongName ), "ERROR: %s is already present.", request->arg( "hostname" ).c_str() );
-        return request->send( 400, textHtmlHeader, wrongName );
+        return request->send( 400, HTML_HEADER, wrongName );
       }
       snprintf( hostName , sizeof( hostName ), "%s", request->arg( "hostname" ).c_str() );
       preferences.putString( "hostname", hostName );
-      return request->send( 200, textHtmlHeader, hostName );
+      return request->send( 200, HTML_HEADER, hostName );
     }
 
     else if ( request->hasArg( "lightsoff" ) )
     {
       lightsOff();
-      return request->send( 200, textHtmlHeader, lightStatusToString( lightStatus ) );
+      return request->send( 200, HTML_HEADER, lightStatusToString( lightStatus ) );
     }
 
     else if ( request->hasArg( "lightson" ) )
     {
       lightsOn();
-      return request->send( 200, textHtmlHeader, lightStatusToString( lightStatus ) );
+      return request->send( 200, HTML_HEADER, lightStatusToString( lightStatus ) );
     }
 
     else if ( request->hasArg( "lightsprogram" ) )
     {
       lightsAuto();
-      return request->send( 200, textHtmlHeader, lightStatusToString( lightStatus ) );
+      return request->send( 200, HTML_HEADER, lightStatusToString( lightStatus ) );
     }
 
     else if ( request->hasArg( "loadtimers" ) )
     {
-      return request->send( 200, textHtmlHeader, defaultTimersLoaded() ? "Timers loaded." : "Not loaded." );
+      return request->send( 200, HTML_HEADER, defaultTimersLoaded() ? "Timers loaded." : "Not loaded." );
     }
 
     else if ( request->hasArg( "oledcontrast" ) )

    if ( request->hasArg( "clearnvs" ) )
    {
      preferences.clear();
      return request->send( 200, textHtmlHeader, "NVS cleared" );
    }

    if ( request->hasArg( "clearwifi" ) )
    {
      request->send( 200, textHtmlHeader, "WiFi data erased" );
      WiFi.disconnect(true);
      return;
    }


#define INVALID_CHANNEL 100

const char* HTML_HEADER                       = "text/html";

void webServerTask ( void * pvParameters )
{
  static const char* WWW_USERNAME             = "admin";
  static const char* WWW_DEFAULT_PASSWD       = "esp32";

  static const char* NOT_PRESENT_ERROR_501    = "Not present";

  static const char* PASSWD_KEY_NVS           = "wwwpassword";  //the (changed) admin password is saved in NVS under this key

  static fs::FS &fs = SPIFFS;

  server.on( "/robots.txt", HTTP_GET, []( AsyncWebServerRequest * request )
  {
    request->send( 200, HTML_HEADER, "User-agent: *\nDisallow: /\n" );
  });

  server.on( "/api/login", HTTP_POST, []( AsyncWebServerRequest * request )
  {
    if ( !request->authenticate( WWW_USERNAME, preferences.getString( PASSWD_KEY_NVS, WWW_DEFAULT_PASSWD ).c_str() ) )
    {
      return request->requestAuthentication();
    }
