From ad85f01c1e8677970de807529e588ec3b3cfac4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 28 May 2019 15:19:31 +0200 Subject: [PATCH] [apps/POSTAndHWTest] POST does Text tests, not full LCD tests --- apps/hardware_test/lcd_data_test_controller.cpp | 2 +- apps/hardware_test/lcd_data_test_controller.h | 11 ----------- apps/on_boarding/power_on_self_test.cpp | 2 +- apps/shared/post_and_hardware_tests.cpp | 4 ++-- apps/shared/post_and_hardware_tests.h | 9 +++++++++ 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/hardware_test/lcd_data_test_controller.cpp b/apps/hardware_test/lcd_data_test_controller.cpp index befab0e3b..1d5be7c38 100644 --- a/apps/hardware_test/lcd_data_test_controller.cpp +++ b/apps/hardware_test/lcd_data_test_controller.cpp @@ -15,7 +15,7 @@ bool LCDDataTestController::handleEvent(Ion::Events::Event event) { } void LCDDataTestController::viewWillAppear() { - bool testOK = Shared::POSTAndHardwareTests::LCDDataOK(k_LCDTestIterationsCount); + bool testOK = Shared::POSTAndHardwareTests::LCDDataOK(); m_view.lcdDataStateTextView()->setText(testOK ? k_lcdDataOKText : k_lcdDataFailTest); m_view.setColor(testOK ? KDColorGreen : KDColorRed); } diff --git a/apps/hardware_test/lcd_data_test_controller.h b/apps/hardware_test/lcd_data_test_controller.h index e349761e4..eacb69689 100644 --- a/apps/hardware_test/lcd_data_test_controller.h +++ b/apps/hardware_test/lcd_data_test_controller.h @@ -7,16 +7,6 @@ namespace HardwareTest { class LCDDataTestController : public ViewController { - -/* We want to test that: - * - Command/data switching is OK, - * - Data is correctly sent, - * - There are no short-circuits between the data wires. - * We thus send a tiled pattern (to test command/data switching), where each - * tile is a checker of a color and its contrary (to tests that Data is sent - * OK). To test each of the 16 data wires for short-circuits, we use 16 colors: - * 2**k with 0 <= k < 16. */ - public: LCDDataTestController(Responder * parentResponder) : ViewController(parentResponder), @@ -42,7 +32,6 @@ private: }; constexpr static const char * k_lcdDataOKText = "LCD DATA: OK"; constexpr static const char * k_lcdDataFailTest = "LCD DATA: FAIL"; - constexpr static int k_LCDTestIterationsCount = 20; ContentView m_view; }; diff --git a/apps/on_boarding/power_on_self_test.cpp b/apps/on_boarding/power_on_self_test.cpp index f5e614c86..4e23e26ac 100644 --- a/apps/on_boarding/power_on_self_test.cpp +++ b/apps/on_boarding/power_on_self_test.cpp @@ -9,7 +9,7 @@ KDColor PowerOnSelfTest::Perform() { KDColor resultColor = KDColorGreen; // Screen tests - bool screenTestsOK = Shared::POSTAndHardwareTests::VBlankOK() && Shared::POSTAndHardwareTests::LCDDataOK(k_LCDTestIterationsCount); + bool screenTestsOK = Shared::POSTAndHardwareTests::VBlankOK() && Shared::POSTAndHardwareTests::TextLCDTestOK(); // We push a white screen so that the LCD Data test is invisible for the user. Ion::Display::waitForVBlank(); diff --git a/apps/shared/post_and_hardware_tests.cpp b/apps/shared/post_and_hardware_tests.cpp index 580db4cfd..5be345fde 100644 --- a/apps/shared/post_and_hardware_tests.cpp +++ b/apps/shared/post_and_hardware_tests.cpp @@ -38,11 +38,11 @@ bool POSTAndHardwareTests::TextLCDTestOK() { return true; } -bool POSTAndHardwareTests::LCDDataOK(int numberOfIterations) { +bool POSTAndHardwareTests::LCDDataOK() { if (!TextLCDTestOK()) { return false; } - for (int iteration = 0; iteration < numberOfIterations; iteration++) { + for (int iteration = 0; iteration < k_numberOfTilingLCDIterations; iteration++) { Ion::Display::POSTPushMulticolor(iteration, k_stampSize); KDColor stamp[k_stampSize*k_stampSize]; int numberOfInvalidPixels = 0; diff --git a/apps/shared/post_and_hardware_tests.h b/apps/shared/post_and_hardware_tests.h index be8051373..2764829ae 100644 --- a/apps/shared/post_and_hardware_tests.h +++ b/apps/shared/post_and_hardware_tests.h @@ -11,10 +11,19 @@ public: static bool BatteryOK(); static bool VBlankOK(); static bool TextLCDTestOK(); + /* LCDDataOK carefully tests the LCD controller. It verifies that: + * - Command/data switching is OK, + * - Data is correctly sent, + * - There are no short-circuits between the data wires. + * LCDDataOK thus sends a tiled pattern (to test command/data switching), + * where each tile is a checker of a color and its contrary (to tests that + * Data is sent OK). To test each of the 16 data wires for short-circuits, 16 + * colors are used: 2**k with 0 <= k < 16. */ static bool LCDDataOK(); private: constexpr static int k_stampSize = 8; constexpr static int k_invalidPixelsLimit = 2; + constexpr static int k_numberOfTilingLCDIterations = 20; static_assert(Ion::Display::Width % k_stampSize == 0, "Stamps must tesselate the display"); static_assert(Ion::Display::Height % k_stampSize == 0, "Stamps must tesselate the display"); static_assert(k_stampSize % 2 == 0, "Even number of XOR needed.");