✨ M256 LCD brightness (#22478)
This commit is contained in:
		@@ -98,6 +98,17 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if HAS_LCD_BRIGHTNESS
 | 
			
		||||
  uint8_t MarlinUI::brightness = DEFAULT_LCD_BRIGHTNESS;
 | 
			
		||||
  bool MarlinUI::backlight = true;
 | 
			
		||||
 | 
			
		||||
  void MarlinUI::set_brightness(const uint8_t value) {
 | 
			
		||||
    backlight = !!value;
 | 
			
		||||
    if (backlight) brightness = constrain(value, MIN_LCD_BRIGHTNESS, MAX_LCD_BRIGHTNESS);
 | 
			
		||||
    // Set brightness on enabled LCD here
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if ENABLED(SOUND_MENU_ITEM)
 | 
			
		||||
  bool MarlinUI::buzzer_enabled = true;
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -239,6 +239,22 @@ public:
 | 
			
		||||
    static void media_changed(const uint8_t old_stat, const uint8_t stat);
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if HAS_LCD_BRIGHTNESS
 | 
			
		||||
    #ifndef MIN_LCD_BRIGHTNESS
 | 
			
		||||
      #define MIN_LCD_BRIGHTNESS   1
 | 
			
		||||
    #endif
 | 
			
		||||
    #ifndef MAX_LCD_BRIGHTNESS
 | 
			
		||||
      #define MAX_LCD_BRIGHTNESS 255
 | 
			
		||||
    #endif
 | 
			
		||||
    #ifndef DEFAULT_LCD_BRIGHTNESS
 | 
			
		||||
      #define DEFAULT_LCD_BRIGHTNESS MAX_LCD_BRIGHTNESS
 | 
			
		||||
    #endif
 | 
			
		||||
    static uint8_t brightness;
 | 
			
		||||
    static bool backlight;
 | 
			
		||||
    static void set_brightness(const uint8_t value);
 | 
			
		||||
    FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); }
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if ENABLED(DWIN_CREALITY_LCD)
 | 
			
		||||
    static void refresh();
 | 
			
		||||
  #else
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user