[apps/POST/HWtest] VBlank test failure doesn't freeze the calculator

This commit is contained in:
Léa Saviot
2019-05-22 15:53:23 +02:00
parent 9a1eb3ede9
commit 680fd5086a
5 changed files with 15 additions and 24 deletions

View File

@@ -12,23 +12,14 @@ bool VBlankTestController::handleEvent(Ion::Events::Event event) {
// Handled in WizardViewController
return false;
}
assert(strcmp(m_view.vBlankStateTextView()->text(), k_vBlankLaunchTest) == 0);
m_view.setColor(KDColorRed);
m_view.vBlankStateTextView()->setText(k_vBlankFailTest);
static_cast<AppsContainer *>(const_cast<Container *>(app()->container()))->redrawWindow();
/* We redraw the window with "VBLANK FAIL" before lauching the test. This
* test might end up in an infinite loop, in which case "VBLANK fail" keeps
* being displayed. If the test succeeds, the screen should change very
* quickly to "VBLANK OK". */
Shared::POSTAndHardwareTests::VBlankOK();
m_view.setColor(KDColorGreen);
m_view.vBlankStateTextView()->setText(k_vBlankOKText);
}
return true;
}
void VBlankTestController::viewWillAppear() {
m_view.vBlankStateTextView()->setText(k_vBlankLaunchTest);
bool testOK = Shared::POSTAndHardwareTests::VBlankOK();
m_view.setColor(testOK ? KDColorGreen : KDColorRed);
m_view.vBlankStateTextView()->setText(testOK ? k_vBlankOKText : k_vBlankFailTest);
}
VBlankTestController::ContentView::ContentView() :

View File

@@ -32,7 +32,6 @@ private:
};
constexpr static const char * k_vBlankOKText = "VBLANK: OK";
constexpr static const char * k_vBlankFailTest = "VBLANK: FAIL";
constexpr static const char * k_vBlankLaunchTest = "Launch VBLANK test";
ContentView m_view;
};

View File

@@ -6,10 +6,7 @@ namespace OnBoarding {
KDColor PowerOnSelfTest::Perform() {
KDColor previousLEDColor = Ion::LED::getColor();
/* Light up the LED in blue now. If VBlank test fails, we end up in an
* infinite loop and the LED will still be lit up in blue. */
Ion::LED::setColor(KDColorBlue);
KDColor resultColor = KDColorGreen;
// Screen tests
bool screenTestsOK = Shared::POSTAndHardwareTests::VBlankOK() && Shared::POSTAndHardwareTests::LCDDataOK(k_LCDTestIterationsCount);
@@ -19,12 +16,15 @@ KDColor PowerOnSelfTest::Perform() {
Ion::Display::pushRectUniform(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), KDColorWhite);
Ion::Display::waitForVBlank();
// Battery test
if (screenTestsOK) {
// Battery test
bool batteryTestOK = Shared::POSTAndHardwareTests::BatteryOK();
Ion::LED::setColor(batteryTestOK ? KDColorGreen : KDColorRed);
if (!Shared::POSTAndHardwareTests::BatteryOK()) {
resultColor = KDColorRed;
}
} else {
resultColor = KDColorBlue;
}
Ion::LED::setColor(resultColor);
return previousLEDColor;
}

View File

@@ -10,10 +10,11 @@ bool POSTAndHardwareTests::BatteryOK() {
}
bool POSTAndHardwareTests::VBlankOK() {
bool result = true;
for (int i=0; i<3; i++) {
Ion::Display::waitForVBlank();
result = result && Ion::Display::waitForVBlank();
}
return true;
return result;
}
bool POSTAndHardwareTests::LCDDataOK(int numberOfIterations) {

View File

@@ -27,7 +27,7 @@ void usleep(uint32_t us) {
}
}
uint64_t millis() {
volatile uint64_t millis() {
return MillisElapsed;
}