mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/POSTAndHWTest] In LCDDataOK iterate on Text and Tiling tests
This commit is contained in:
@@ -8,11 +8,14 @@ KDColor PowerOnSelfTest::Perform() {
|
||||
KDColor previousLEDColor = Ion::LED::getColor();
|
||||
KDColor resultColor = KDColorGreen;
|
||||
|
||||
// Screen tests
|
||||
/* Screen tests
|
||||
* CAUTION: Timing is important. TextLCDTestOK fails only if done at an
|
||||
* unknown time, which happens to be for VBlankOK being done just before.
|
||||
* TextLCDTestOK is done many times in a row in the HardwareTest, so if the
|
||||
* screen passes the POST and fails the Hardware Test, we will need to find
|
||||
* the right time to sleep here before launching TextLCDTestOK. */
|
||||
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();
|
||||
Ion::Display::pushRectUniform(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), KDColorWhite);
|
||||
Ion::Display::waitForVBlank();
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ bool POSTAndHardwareTests::TextLCDTestOK() {
|
||||
for (int i = 0; i < Ion::Display::Height / glyphHeight; i++) {
|
||||
KDIonContext::sharedContext()->drawString(text, KDPoint(0, i * glyphHeight), font);
|
||||
}
|
||||
|
||||
// Check the drawing
|
||||
for (int i = 0; i < Ion::Display::Height / glyphHeight; i++) {
|
||||
if (!KDIonContext::sharedContext()->checkDrawnString(text, KDPoint(0, i * glyphHeight), font)) {
|
||||
@@ -39,23 +38,27 @@ bool POSTAndHardwareTests::TextLCDTestOK() {
|
||||
}
|
||||
|
||||
bool POSTAndHardwareTests::LCDDataOK() {
|
||||
if (!TextLCDTestOK()) {
|
||||
return false;
|
||||
for (int iteration = 0; iteration < k_numberOfLCDIterations; iteration++) {
|
||||
if (!TextLCDTestOK() || !TilingLCDTestOK()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int iteration = 0; iteration < k_numberOfTilingLCDIterations; iteration++) {
|
||||
Ion::Display::POSTPushMulticolor(iteration, k_stampSize);
|
||||
KDColor stamp[k_stampSize*k_stampSize];
|
||||
for (int i = 0; i < Ion::Display::Width / k_stampSize; i++) {
|
||||
for (int j = 0; j < Ion::Display::Height / k_stampSize; j++) {
|
||||
Ion::Display::pullRect(KDRect(i * k_stampSize, j * k_stampSize, k_stampSize, k_stampSize), stamp);
|
||||
int shift = (i+j+iteration) % 16;
|
||||
uint16_t color = (uint16_t)(1 << shift);
|
||||
for (int k = 0; k < k_stampSize*k_stampSize; k++) {
|
||||
if (stamp[k] != color) {
|
||||
return false;
|
||||
}
|
||||
color ^= 0xFFFF;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool POSTAndHardwareTests::TilingLCDTestOK() {
|
||||
Ion::Display::POSTPushMulticolor(k_stampSize);
|
||||
KDColor stamp[k_stampSize*k_stampSize];
|
||||
for (int i = 0; i < Ion::Display::Width / k_stampSize; i++) {
|
||||
for (int j = 0; j < Ion::Display::Height / k_stampSize; j++) {
|
||||
Ion::Display::pullRect(KDRect(i * k_stampSize, j * k_stampSize, k_stampSize, k_stampSize), stamp);
|
||||
int shift = (i+j) % 16;
|
||||
uint16_t color = (uint16_t)(1 << shift);
|
||||
for (int k = 0; k < k_stampSize*k_stampSize; k++) {
|
||||
if (stamp[k] != color) {
|
||||
return false;
|
||||
}
|
||||
color ^= 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ public:
|
||||
static bool LCDDataOK();
|
||||
private:
|
||||
constexpr static int k_stampSize = 8;
|
||||
constexpr static int k_numberOfTilingLCDIterations = 20;
|
||||
constexpr static int k_numberOfLCDIterations = 20;
|
||||
static bool TilingLCDTestOK();
|
||||
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.");
|
||||
|
||||
@@ -29,7 +29,7 @@ constexpr int WidthInTenthOfMillimeter = 576;
|
||||
constexpr int HeightInTenthOfMillimeter = 432;
|
||||
|
||||
// For Power On Self tests
|
||||
void POSTPushMulticolor(int shift, int tileSize);
|
||||
void POSTPushMulticolor(int tileSize);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ bool waitForVBlank() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void POSTPushMulticolor(int shift, int tileSize) {
|
||||
void POSTPushMulticolor(int tileSize) {
|
||||
const int maxI = Ion::Display::Width / tileSize;
|
||||
const int maxJ = Ion::Display::Height / tileSize;
|
||||
for (int i = 0; i < maxI; i++) {
|
||||
for (int j = 0; j < maxJ; j++) {
|
||||
uint16_t k = (i+j+shift) % 16;
|
||||
uint16_t k = (i+j) % 16;
|
||||
uint16_t color = 1 << k;
|
||||
setDrawingArea(KDRect(i*tileSize,j*tileSize,tileSize, tileSize), Orientation::Landscape);
|
||||
pushColorAndContraryPixels(color, tileSize*tileSize);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <ion/display.h>
|
||||
|
||||
void Ion::Display::POSTPushMulticolor(int shift, int tileSize) {
|
||||
void Ion::Display::POSTPushMulticolor(int tileSize) {
|
||||
}
|
||||
|
||||
bool Ion::Display::waitForVBlank() {
|
||||
|
||||
Reference in New Issue
Block a user