backlight: always allow backlight to dim/wake
This commit adds the ability for the firmware to dim and wake the backlight when LCD updates are disabled. Such as in the MMU error screen or when rendering full screen messages which typically disable the LCD updates to prevent the status screen from rendering. Fixes #2777 Change in memory: Flash: -26 bytes SRAM: +1 byte
This commit is contained in:
parent
074057c110
commit
db878c9996
|
|
@ -15,6 +15,7 @@
|
|||
#include "fastio.h"
|
||||
//-//
|
||||
#include "sound.h"
|
||||
#include "backlight.h"
|
||||
|
||||
#define LCD_DEFAULT_DELAY 100
|
||||
|
||||
|
|
@ -638,6 +639,7 @@ int8_t lcd_encoder_diff = 0;
|
|||
uint8_t lcd_buttons = 0;
|
||||
uint8_t lcd_button_pressed = 0;
|
||||
uint8_t lcd_update_enabled = 1;
|
||||
static bool lcd_backlight_wake_trigger; // Flag set by interrupt when the knob is pressed or rotated
|
||||
|
||||
uint32_t lcd_next_update_millis = 0;
|
||||
|
||||
|
|
@ -695,8 +697,16 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
|
|||
{
|
||||
if (lcd_draw_update < lcdDrawUpdateOverride)
|
||||
lcd_draw_update = lcdDrawUpdateOverride;
|
||||
if (!lcd_update_enabled)
|
||||
return;
|
||||
|
||||
if (lcd_backlight_wake_trigger) {
|
||||
lcd_backlight_wake_trigger = false;
|
||||
backlight_wake();
|
||||
}
|
||||
|
||||
backlight_update();
|
||||
|
||||
if (!lcd_update_enabled) return;
|
||||
|
||||
if (lcd_lcdupdate_func)
|
||||
lcd_lcdupdate_func();
|
||||
}
|
||||
|
|
@ -742,6 +752,7 @@ void lcd_buttons_update(void)
|
|||
if (!buttonBlanking.running() || buttonBlanking.expired(BUTTON_BLANKING_TIME)) {
|
||||
buttonBlanking.start();
|
||||
safetyTimer.start();
|
||||
lcd_backlight_wake_trigger = true; // flag event, knob pressed
|
||||
if ((lcd_button_pressed == 0) && (lcd_long_press_active == 0))
|
||||
{
|
||||
longPressTimer.start();
|
||||
|
|
@ -776,6 +787,7 @@ void lcd_buttons_update(void)
|
|||
if (lcd_buttons & EN_B) enc |= B10;
|
||||
if (enc != lcd_encoder_bits)
|
||||
{
|
||||
lcd_backlight_wake_trigger = true; // flag event, knob rotated
|
||||
switch (enc)
|
||||
{
|
||||
case encrot0:
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ Sound_SaveMode();
|
|||
|
||||
//if critical is true then silend and once mode is ignored
|
||||
void __attribute__((noinline)) Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
||||
backlight_wake();
|
||||
if (critical || eSoundMode != e_SOUND_MODE_SILENT) {
|
||||
if(!tone_) {
|
||||
WRITE(BEEPER, HIGH);
|
||||
|
|
@ -127,7 +126,6 @@ static void Sound_DoSound_Blind_Alert(void)
|
|||
|
||||
static void Sound_DoSound_Encoder_Move(void)
|
||||
{
|
||||
backlight_wake();
|
||||
uint8_t nI;
|
||||
|
||||
for(nI=0;nI<5;nI++)
|
||||
|
|
@ -141,7 +139,6 @@ uint8_t nI;
|
|||
|
||||
static void Sound_DoSound_Echo(void)
|
||||
{
|
||||
backlight_wake();
|
||||
uint8_t nI;
|
||||
|
||||
for(nI=0;nI<10;nI++)
|
||||
|
|
@ -163,7 +160,6 @@ WRITE(BEEPER,LOW);
|
|||
|
||||
static void Sound_DoSound_Alert(bool bOnce)
|
||||
{
|
||||
backlight_wake();
|
||||
uint8_t nI,nMax;
|
||||
|
||||
nMax=bOnce?1:3;
|
||||
|
|
|
|||
|
|
@ -7446,7 +7446,6 @@ void menu_lcd_longpress_func(void)
|
|||
// Wake up the LCD backlight and,
|
||||
// start LCD inactivity timer
|
||||
lcd_timeoutToStatus.start();
|
||||
backlight_wake();
|
||||
if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z || menu_block_mask != MENU_BLOCK_NONE || Stopped)
|
||||
{
|
||||
// disable longpress during re-entry, while homing, calibration or if a serious error
|
||||
|
|
@ -7551,7 +7550,6 @@ void menu_lcd_lcdupdate_func(void)
|
|||
}
|
||||
}
|
||||
#endif//CARDINSERTED
|
||||
backlight_update();
|
||||
if (lcd_next_update_millis < _millis())
|
||||
{
|
||||
if (abs(lcd_encoder_diff) >= ENCODER_PULSES_PER_STEP)
|
||||
|
|
@ -7562,13 +7560,11 @@ void menu_lcd_lcdupdate_func(void)
|
|||
Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
||||
lcd_encoder_diff = 0;
|
||||
lcd_timeoutToStatus.start();
|
||||
backlight_wake();
|
||||
}
|
||||
|
||||
if (LCD_CLICKED)
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
backlight_wake();
|
||||
}
|
||||
|
||||
(*menu_menu)();
|
||||
|
|
|
|||
Loading…
Reference in New Issue