   }
 
   /* check if light status has changed */
-  if ( lastStatus != lightStatus )
+  if ( currentLightStatus != lightStatus )
   {
     drawMenuButtons();
-    lastStatus = lightStatus;
+    currentLightStatus = lightStatus;
   }
 
   if ( touch.tirqTouched() )

  }
}

static inline __attribute__((always_inline)) void drawButton( struct button_t button, uint16_t color, uint16_t bordercolor )
{
  tft.setTextSize( 2 );
  tft.setTextColor( ILI9341_YELLOW, color );

  if ( color || bordercolor )
  {
    tft.startWrite();


  for ( uint8_t channelNumber = 0; channelNumber < NUMBER_OF_CHANNELS; channelNumber++ )
  {
    /* only write percentage if changed */
    if ( tftClearScreen || channel[channelNumber].currentPercentage != oldPercentage[channelNumber] )
    {
      button_t label;

      char content[8];

      if ( TFT_SHOW_RAW )
      {
        snprintf( label.text, sizeof( label.text ), "%04X", ledcRead( channelNumber ) );
      }
      else
      {
        snprintf( label.text, sizeof( label.text ), " %.1f%% ", channel[channelNumber].currentPercentage );
      }

      label.x = channelNumber * BARS_WIDTH;
      label.y = BARS_BOTTOM + 4;
      label.w = BARS_WIDTH;
      label.h = 10;
      //tft.setTextColor( channelColor565[channelNumber] , TFT_BACK_COLOR );
      drawButton( label, channelColor565[channelNumber], 0, 0, 0 );
    }
    oldColor565[ channelNumber ] = channelColor565[ channelNumber];
    oldPercentage[ channelNumber ] = channel[channelNumber].currentPercentage;
    averageLedBrightness += ledcRead( channelNumber );
  }
  tftClearScreen = false;

  averageLedBrightness = averageLedBrightness / NUMBER_OF_CHANNELS;

  uint16_t rawBrightness = map( tftBrightness, 0, 100, 0, backlightMaxvalue );

  ledcWrite( TFT_BACKLIGHT_CHANNEL, ( averageLedBrightness > rawBrightness ) ? rawBrightness : averageLedBrightness );

  drawSensors( false );

  struct tm timeinfo;

  getLocalTime( &timeinfo );

  static struct tm oldtimeinfo;

  if ( timeinfo.tm_sec != oldtimeinfo.tm_sec );
  {
    strftime( clockArea.text, sizeof( clockArea.text ), "%T", &timeinfo );
    drawButton( clockArea, ILI9341_YELLOW, 0, 0, 2 );
    oldtimeinfo.tm_sec = timeinfo.tm_sec;
  }

  if ( currentWiFiStatus != WiFi.status() )
  {
    showIPAddress( networkArea );
    currentWiFiStatus = WiFi.status();
  }

  if ( touch.tirqTouched() )
  {
