🐛 E3V2 Brightness followup (#22821)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Miguel Risco-Castillo
2021-09-25 05:59:43 -05:00
committed by Scott Lahteine
parent e705a7724e
commit 89898181bd
16 changed files with 82 additions and 63 deletions

View File

@ -78,14 +78,16 @@ bool DWIN_Handshake() {
&& databuf[3] == 'K' );
}
// Set the backlight brightness
// brightness: (0x00-0x1F)
void DWIN_LCD_Brightness(const uint8_t brightness) {
size_t i = 0;
DWIN_Byte(i, 0x30);
DWIN_Byte(i, _MAX(brightness, 0x1F));
DWIN_Send(i);
}
#if HAS_LCD_BRIGHTNESS
// Set LCD backlight (from DWIN Enhanced)
// brightness: 0x00-0xFF
void DWIN_LCD_Brightness(const uint8_t brightness) {
size_t i = 0;
DWIN_Byte(i, 0x30);
DWIN_Byte(i, brightness);
DWIN_Send(i);
}
#endif
// Set screen display direction
// dir: 0=0°, 1=90°, 2=180°, 3=270°

View File

@ -90,9 +90,11 @@ bool DWIN_Handshake();
// DWIN startup
void DWIN_Startup();
// Set the backlight brightness
// brightness: (0x00-0xFF)
void DWIN_LCD_Brightness(const uint8_t brightness);
#if HAS_LCD_BRIGHTNESS
// Set the backlight brightness
// brightness: (0x00-0xFF)
void DWIN_LCD_Brightness(const uint8_t brightness);
#endif
// Set screen display direction
// dir: 0=0°, 1=90°, 2=180°, 3=270°