ui: Only set brightness when needed.
There is a regression due to recent change in commit
b76af93ab5
, where it started to set
brightness to normal on every key input. This is unneeded and spamming
the recovery log.
Test: Run recovery_unit_test on marlin.
Test: Built and boot into recovery image. Press a few keys, then check
the recovery log.
Change-Id: Ia3a7ea400bcccdebbb27a6a7586e435bfb915923
This commit is contained in:
parent
f83d9f6b71
commit
53be332711
1 changed files with 3 additions and 4 deletions
7
ui.cpp
7
ui.cpp
|
@ -454,8 +454,7 @@ int RecoveryUI::WaitKey() {
|
|||
return static_cast<int>(KeyError::INTERRUPTED);
|
||||
}
|
||||
|
||||
// Time out after UI_WAIT_KEY_TIMEOUT_SEC, unless a USB cable is
|
||||
// plugged in.
|
||||
// Time out after UI_WAIT_KEY_TIMEOUT_SEC, unless a USB cable is plugged in.
|
||||
do {
|
||||
bool rc = key_queue_cond.wait_for(lk, std::chrono::seconds(UI_WAIT_KEY_TIMEOUT_SEC), [this] {
|
||||
return this->key_queue_len != 0 || key_interrupted_;
|
||||
|
@ -466,13 +465,13 @@ int RecoveryUI::WaitKey() {
|
|||
}
|
||||
if (screensaver_state_ != ScreensaverState::DISABLED) {
|
||||
if (!rc) {
|
||||
// Lower the brightness level: NORMAL -> DIMMED; DIMMED -> OFF.
|
||||
// Must be after a timeout. Lower the brightness level: NORMAL -> DIMMED; DIMMED -> OFF.
|
||||
if (screensaver_state_ == ScreensaverState::NORMAL) {
|
||||
SetScreensaverState(ScreensaverState::DIMMED);
|
||||
} else if (screensaver_state_ == ScreensaverState::DIMMED) {
|
||||
SetScreensaverState(ScreensaverState::OFF);
|
||||
}
|
||||
} else {
|
||||
} else if (screensaver_state_ != ScreensaverState::NORMAL) {
|
||||
// Drop the first key if it's changing from OFF to NORMAL.
|
||||
if (screensaver_state_ == ScreensaverState::OFF) {
|
||||
if (key_queue_len > 0) {
|
||||
|
|
Loading…
Reference in a new issue