diff --git a/apps/hardware_test/vblank_test_controller.cpp b/apps/hardware_test/vblank_test_controller.cpp index 61e4d2b3a..9736c921c 100644 --- a/apps/hardware_test/vblank_test_controller.cpp +++ b/apps/hardware_test/vblank_test_controller.cpp @@ -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(const_cast(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() : diff --git a/apps/hardware_test/vblank_test_controller.h b/apps/hardware_test/vblank_test_controller.h index b52fdc95b..951394586 100644 --- a/apps/hardware_test/vblank_test_controller.h +++ b/apps/hardware_test/vblank_test_controller.h @@ -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; }; diff --git a/apps/on_boarding/power_on_self_test.cpp b/apps/on_boarding/power_on_self_test.cpp index 3d3d4e22a..f5e614c86 100644 --- a/apps/on_boarding/power_on_self_test.cpp +++ b/apps/on_boarding/power_on_self_test.cpp @@ -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; } diff --git a/apps/shared/post_and_hardware_tests.cpp b/apps/shared/post_and_hardware_tests.cpp index e1661d7e7..944568fdc 100644 --- a/apps/shared/post_and_hardware_tests.cpp +++ b/apps/shared/post_and_hardware_tests.cpp @@ -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) { diff --git a/ion/src/device/shared/drivers/timing.cpp b/ion/src/device/shared/drivers/timing.cpp index 63564d701..13ee49455 100644 --- a/ion/src/device/shared/drivers/timing.cpp +++ b/ion/src/device/shared/drivers/timing.cpp @@ -27,7 +27,7 @@ void usleep(uint32_t us) { } } -uint64_t millis() { +volatile uint64_t millis() { return MillisElapsed; }