 
   
     buttonState =digitalRead(BRIGHT_CONTROL_PIN);
+    
     if (buttonState==HIGH){
 
-        
-        
-        int brightness =configuration.brightness+pow(-1,brightDirect)* BRIGHT_STEP;
+      int brightness =configuration.brightness;
+
+      //cрабатывание на второй раз
+        if (state ==STATE_BRIGHT_CONTROL){
+          brightness =brightness+pow(-1,brightDirect)* BRIGHT_STEP;
+        }
+        
 
         if (brightness>100){
           brightness=100;

  return  1.0* BRIGHT_0+ 1.0* brightness_percent*BRIGHT_PERCENT;
}
  
  void saveBrighness(int brightness){
     configuration.brightness =brightness;
     EEPROM_writeAnything(0, configuration);
   }


char* header= " B\1A\2H. TEM\3. ";

        
        analogWrite(BRIGHT_PIN, getBrightLevel(brightness));  

        if (state ==STATE_BRIGHT_CONTROL){
          saveBrighness(brightness);
        }
        
        printBrighnessState(brightness);
        
