PD4 display test: cycle diagnostic patterns, not just all-on

The real display's power-on test (JP1 jumper 5, firmware $B888) runs through
several drawing sequences — a solid fill, a border+grid, more — each held
briefly, to expose dead dots and addressing faults; it isn't just full on/off.

Both vPLASMA and the replica firmware now cycle 5 representative patterns:
solid, border+grid, horizontal stripes, vertical stripes, checkerboard.
- VPlasmaDevice.ShowTestPattern(int) + TestPatternCount; the app cycles them
  on a 1.2s timer while jumper 5 is installed.
- PlasmaDisplay::showTestPattern(int) + TEST_PATTERN_COUNT (shared logic); the
  Matrix Portal sketch's DOWN button toggles the cycling test.

(The firmware's exact byte patterns live in the display's native scan-buffer
layout, which we haven't mapped, so these stand in for that sequence rather
than reproducing it byte-for-byte.)

Verified: 29 C# tests pass; the C++ patterns render distinctly on the host.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-16 20:34:33 -05:00
co-authored by Claude Opus 4.8
parent ab36cdd826
commit ebad6ee5fe
6 changed files with 82 additions and 13 deletions
@@ -32,8 +32,25 @@ void PlasmaDisplay::setOrientation(Orientation o) {
dirty_ = true;
}
void PlasmaDisplay::showTestPattern() {
for (int i = 0; i < WIDTH * HEIGHT; ++i) pixels_[i] = PIX_LIT;
// The real display's power-on test (JP1 jumper 5, firmware $B888) runs through
// several drawing sequences — solid, border+grid, and more — to expose dead
// dots and addressing faults. These stand in for that; the sketch cycles them.
static bool testDot(int index, int x, int y) {
switch (index) {
case 0: return true; // all on
case 1: return x == 0 || x == PlasmaDisplay::WIDTH - 1 || // frame
y == 0 || y == PlasmaDisplay::HEIGHT - 1 ||
(x % 16) == 0 || (y % 8) == 0; // + grid
case 2: return ((y / 2) % 2) == 0; // horizontal stripes
case 3: return ((x / 4) % 2) == 0; // vertical stripes
default: return (((x / 8) + (y / 8)) % 2) == 0; // checkerboard
}
}
void PlasmaDisplay::showTestPattern(int index) {
for (int y = 0; y < HEIGHT; ++y)
for (int x = 0; x < WIDTH; ++x)
pixels_[y * WIDTH + x] = testDot(index, x, y) ? PIX_LIT : 0;
dirty_ = true;
}