Fix dense images on the Nano and the off image in slow mode

- Nano: B data is drawn fast enough for the serial line. A hex digit arrives
  every 87 us; with a division and four drawPixel() calls per digit a lit
  digit took about 105 us, so dense frames (all yellow, the panda bitmap)
  overflowed the 64 byte receive buffer: frames not shown or wrong, "Line
  too long", frame check repairs that failed the same way. Now the parser
  counts columns and rows and BROSE9323::drawDots() sets the 4 dots
  (about 20 us).
- ESP32: Power off and the start of the night draw the off image also when
  slow mode had the power off already (it powers on for it, once)
- Tests: drawDots() against drawPixel(), off image in slow mode
- Version 2.19.3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-22 00:24:14 +02:00
1 parent 41af2944bc
commit 7a28e34380
13 files changed
+130 -17

No files matched your search

+33
View File
@@ -226,6 +226,38 @@ void test_crc_of_equal_images_is_equal()
delete b;
}
// The fast path for B data must give the same image as drawPixel(), also at the right edge
// (B widths are rounded up to 4, so x + 3 can be past it) and below the last row
void test_draw_dots_is_like_draw_pixel()
{
BROSE9323 *a = make(), *b = make();
a->fillScreen(1);
b->fillScreen(1);
for (int y = 0; y <= H; y++)
for (int x = 0; x < W; x += 4)
{
uint8_t bits = (x * 5 + y * 3) & 0xF;
bool color = (x / 4 + y) % 3 == 0;
a->drawDots(x + 2, y, bits, color);
for (int i = 0; i < 4; i++)
if (bits & (8 >> i))
b->drawPixel(x + 2 + i, y, color);
}
TEST_ASSERT_EQUAL_HEX16(b->crc(), a->crc());
for (int x = 0; x < W; x++)
for (int y = 0; y < H; y++)
{
a->drawPixel(x, y, 0);
b->drawPixel(x, y, 0);
}
a->drawDots(-2, 0, 0xF, 1); // dots 0 and 1 of the first row
b->drawPixel(0, 0, 1);
b->drawPixel(1, 0, 1);
TEST_ASSERT_EQUAL_HEX16(b->crc(), a->crc());
delete a;
delete b;
}
int main()
{
UNITY_BEGIN();
@@ -237,5 +269,6 @@ int main()
RUN_TEST(test_refresh_waits_for_a_running_effect);
RUN_TEST(test_interrupted_first_frame_still_reaches_every_dot);
RUN_TEST(test_crc_of_equal_images_is_equal);
RUN_TEST(test_draw_dots_is_like_draw_pixel);
return UNITY_END();
}