NetDeck: freeze tint stamps a checkered 8x8 sprite pattern

- replace the nonexistent draw16bppSprite_P(NULL,...) call with
  pushImage(bx, by, 8, 8, checkered8x8): device = TFT_eSprite::pushImage
  (blits into the fb sprite), emulator = new shim TFT_eSPI::pushImage
  blit into the host framebuffer — same signature on both backends
- shim: define PROGMEM (no-op on host/ESP32, flash is memory-mapped)
- pattern data fixed into a real 2px checkerboard (black / 0x1F1F teal)
- E2E pixel assertions updated to the checker geometry

Verified: make netdeck (both targets) + full test suite, 0 failures
This commit is contained in:
Dejvino
2026-11-14 15:24:42 +01:00
parent c80fcc609b
commit 83ec0217f4
4 changed files with 47 additions and 6 deletions
+4
View File
@@ -9,6 +9,10 @@
// a much richer edge rate than a real roll on the device).
#define EMULATOR 1
// Host flash is memory-mapped, so flash-resident data needs no special read
// macro (same as on ESP32; real AVR pgm_read is not used by our sketches).
#define PROGMEM
#include <cstdint>
#include <cstddef>
#include <cstdio>
+16
View File
@@ -107,6 +107,22 @@ public:
}
}
// Blit a 16bpp (RGB565) image — the pattern-stamp primitive that the
// device-side TFT_eSPI / TFT_eSprite pushImage() provides. Clipped.
void pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data)
{
for (int32_t j = 0; j < h; j++) {
int32_t ty = y + j;
if (ty < 0 || ty >= emuGfx::H) continue;
for (int32_t i = 0; i < w; i++) {
int32_t tx = x + i;
if (tx < 0 || tx >= emuGfx::W) continue;
emuGfx::fb[ty * emuGfx::W + tx] = rgb565to888(data[j * w + i]);
}
}
emuGfx::dirty = true;
}
void fillCircle(int32_t x0, int32_t y0, int32_t r, uint32_t c)
{
for (int dy = -r; dy <= r; dy++) {
+6 -4
View File
@@ -114,10 +114,12 @@ TEST(e2e/boot_and_controls)
// HUD separator rendered across the top of the HUD bar
EXPECT(test::pixelIs565(160, nd::HUD_Y, nd::C_BORDER));
// paused -> freeze scanlines: every 3rd view row is black
EXPECT(test::pixelIs565(50, 0, 0x0000));
EXPECT(test::pixelIs565(50, 3, 0x0000));
EXPECT(!test::pixelIs565(50, 1, 0x0000));
// paused -> checkered freeze tint: 2px checker of black + dark teal
// P(x,y): black when ((x>>1)+(y>>1)) is even
EXPECT(test::pixelIs565(50, 0, 0x1F1F)); // (25+0) odd -> teal
EXPECT(test::pixelIs565(50, 2, 0x0000)); // (25+1) even -> black
EXPECT(test::pixelIs565(52, 0, 0x0000)); // (26+0) even -> black
EXPECT(!test::pixelIs565(52, 0, 0x1F1F));
}
TEST(e2e/network_journey)
+21 -2
View File
@@ -1264,10 +1264,29 @@ static void renderCursor()
}
}
// 8x8 stamp for the tactical-freeze tint: 2px checkerboard of black and a
// dark teal (the map stays readable underneath). RGB565 has no alpha, so a
// dither is the way to "tint" — same trick the old scanlines used.
static const uint16_t PROGMEM checkered8x8[64] = {
0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F,
0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F,
0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000,
0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000,
0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F,
0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F,
0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000,
0x1F1F, 0x1F1F, 0x0000, 0x0000, 0x1F1F, 0x1F1F, 0x0000, 0x0000,
};
static void renderFreezeTint()
{
for (int y = 0; y < nd::VIEW_H; y += 3) {
GFXP->drawFastHLine(0, y, nd::VIEW_W, 0x0000);
// Stamp the checkered 8x8 pattern across the view. pushImage() exists on
// BOTH backends: device = TFT_eSprite::pushImage (blits into the fb
// sprite RAM), emulator = the shim blit into the host framebuffer.
for (int by = 0; by < nd::VIEW_H; by += 8) {
for (int bx = 0; bx < nd::VIEW_W; bx += 8) {
GFXP->pushImage(bx, by, 8, 8, checkered8x8);
}
}
GFXP->setTextDatum(TR_DATUM);
GFXP->setTextColor(nd::C_FREEZE, 0x0000);