[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
This commit is contained in:
Léa Saviot
2019-04-30 15:39:19 +02:00
parent 89031af4fd
commit 5e7731c34d
2 changed files with 8 additions and 2 deletions

View File

@@ -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();
}

View File

@@ -16,6 +16,7 @@ private:
bool fire() override;
LogoView m_logoView;
KDColor m_previousLEDColor;
bool m_didPerformTests;
};
}