From 5e7731c34d8cb3f59949d7589a6a4a0017839b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 30 Apr 2019 15:39:19 +0200 Subject: [PATCH] [apps/on_boarding] Reset LED only if POST was performed Fixes LED color bug in the following scenario: Plug the device, reset, back, unplug the device, select language -> The led is lit up --- apps/on_boarding/logo_controller.cpp | 9 +++++++-- apps/on_boarding/logo_controller.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/on_boarding/logo_controller.cpp b/apps/on_boarding/logo_controller.cpp index 0b79ac495..8bf8b992c 100644 --- a/apps/on_boarding/logo_controller.cpp +++ b/apps/on_boarding/logo_controller.cpp @@ -8,7 +8,8 @@ LogoController::LogoController() : ViewController(nullptr), Timer(15), m_logoView(), - m_previousLEDColor(KDColorBlack) + m_previousLEDColor(KDColorBlack), + m_didPerformTests(false) { } @@ -26,8 +27,10 @@ void LogoController::viewWillAppear() { * mandatory for the end-user.*/ bool backlightInitialized = Ion::Backlight::isInitialized(); if (Ion::USB::isPlugged() || backlightInitialized) { + m_didPerformTests = false; m_previousLEDColor = Ion::LED::getColor(); } else { + m_didPerformTests = true; m_previousLEDColor = PowerOnSelfTest::Perform(); /* If EPSILON_ONBOARDING_APP == 1, the backlight is not initialized in * Ion::Device::Board::initPeripherals, so that the LCD test is not visible to @@ -43,7 +46,9 @@ void LogoController::viewWillAppear() { } void LogoController::viewDidDisappear() { - Ion::LED::setColor(m_previousLEDColor); + if (m_didPerformTests) { + Ion::LED::setColor(m_previousLEDColor); + } ViewController::viewDidDisappear(); } diff --git a/apps/on_boarding/logo_controller.h b/apps/on_boarding/logo_controller.h index 47ca7df4d..32f986671 100644 --- a/apps/on_boarding/logo_controller.h +++ b/apps/on_boarding/logo_controller.h @@ -16,6 +16,7 @@ private: bool fire() override; LogoView m_logoView; KDColor m_previousLEDColor; + bool m_didPerformTests; }; }