       return request->send( 200, HEADER_HTML, hostName );
     }
 
-    else if ( request->hasArg( "bootlog" ) )
-    {
+    else if ( request->hasArg( "bootlog" ) ) {
       if ( request->arg("bootlog").equalsIgnoreCase("on") || ( request->arg("bootlog").equalsIgnoreCase("off") ) )
         preferences.putString( "bootlog", request->arg("bootlog") );
       return request->send( 200, HEADER_HTML, request->arg("bootlog") );
     }
 
-    else if ( request->hasArg( "lightsoff" ) )
-    {
+    else if ( request->hasArg( "lightsoff" ) ) {
       leds.setState( LIGHTS_OFF );
       return request->send( 200, HEADER_HTML, leds.stateString() );
     }
 
-    else if ( request->hasArg( "lightson" ) )
-    {
+    else if ( request->hasArg( "lightson" ) ) {
       leds.setState( LIGHTS_ON );
       return request->send( 200, HEADER_HTML, leds.stateString() );
     }
 
-    else if ( request->hasArg( "lightsprogram" ) )
-    {
+    else if ( request->hasArg( "lightsprogram" ) ) {
       leds.setState( LIGHTS_AUTO );
       return request->send( 200, HEADER_HTML, leds.stateString() );
     }
 
-    else if ( request->hasArg( "loadtimers" ) )
-    {
+    else if ( request->hasArg( "loadtimers" ) ) {
       return request->send( 200, HEADER_HTML, defaultTimersLoaded() ? "Timers loaded." : "Not loaded." );
     }
 
-    else if ( request->hasArg( "oledcontrast" ) )
-    {
+    else if ( request->hasArg( "oledcontrast" ) ) {
       request->arg( "oledcontrast" );
       uint8_t contrast = request->arg( "oledcontrast" ).toInt();
-      if ( contrast < 0 || contrast > 15 )
-      {
+      if ( contrast < 0 || contrast > 15 ) {
         return request->send( 400, HEADER_HTML, "Invalid contrast." );
       }
       oledContrast = contrast;

      return request->send( response );
    }

    else if ( request->hasArg( "hostname" ) )
    {
      return request->send( 200, HEADER_HTML, hostName );
    }

    else if ( request->hasArg( "minimumlevels" ) )
    {
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      for ( uint8_t channelNumber = 0; channelNumber < NUMBER_OF_CHANNELS; channelNumber++ )
      {
        response->printf( "%.2f\n", channel[channelNumber].minimumLevel );
      }
      return request->send( response );
    }

    else if ( request->hasArg( "moonphase" ) )
    {
      if ( !MOON_SIMULATOR )
      {
        return request->send( 501, HEADER_HTML, NOT_PRESENT_ERROR_501 );
      }
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      response->printf( "%i\n%.4f\n", moonData.angle, moonData.percentLit );
      return request->send( response );
    }

    else if ( request->hasArg( "oledcontrast" ) )
    {
      if ( !xOledTaskHandle )
      {
        return request->send( 501, HEADER_HTML, NOT_PRESENT_ERROR_501 );
      }
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      response->printf( "%i", oledContrast );
      return request->send( response );
    }

    else if ( request->hasArg( "oledorientation" ) )
    {
      if ( !xOledTaskHandle )
      {
        return request->send( 501, HEADER_HTML, NOT_PRESENT_ERROR_501 );
      }
      return request->send( 200, HEADER_HTML, oledOrientation == OLED_ORIENTATION_NORMAL ? "normal" : "upsidedown" );
    }

    else if ( request->hasArg( "pwmdepth" ) )
    {
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      response->printf( "%i", ledcNumberOfBits );
      return request->send( response );
    }

    else if ( request->hasArg( "pwmfrequency" ) )
    {
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      response->printf( "%.0f", ledcActualFrequency );
      return request->send( response );
    }

    else if ( request->hasArg( "sensor" ) )
    {
      if ( !sensor.count() ) return request->send( 501, HEADER_HTML, NOT_PRESENT_ERROR_501 );
      if ( !request->hasArg( "number" ) ) return request->send( 400, HEADER_HTML, "No sensornumber" );
      uint8_t num = request->arg( "number" ).toInt();
      if ( num >= sensor.count() ) return request->send( 400, HEADER_HTML, "Invalid sensornumber" );
      AsyncResponseStream *response = request->beginResponseStream( HEADER_HTML );
      sensorName_t name;
      sensorId_t id;
      response->printf( "%s\n%.3f\n%s\n", sensor.getName( num, name ), sensor.temp( num ), sensor.getId( num, id ) );
      return request->send( response );
    }

    else if ( request->hasArg( "sensors" ) )
    {
      if ( !sensor.count() ) return request->send( 501, HEADER_HTML, NOT_PRESENT_ERROR_501 );
      sensorName_t name;
      sensorId_t id;


#define INVALID_CHANNEL 100

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

