Tests against lost bytes in dense frames

- test_nano: every hex digit of B data is one drawDots() call, never single
  drawPixel() calls (the slow path that broke dense images in 2.19.2)
- tools/display_smoke_test.py: all yellow, a dense image and a checkerboard
  in live mode on the real display; fails on any frame check problem (wrong
  image, no answer, Nano restart, ERR reply)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-22 00:30:31 +02:00
1 parent 7a28e34380
commit abd63d070f
3 files changed
+126 -1

No files matched your search

+16
View File
@@ -193,6 +193,21 @@ void test_full_screen_bitmap_is_streamed()
TEST_ASSERT_EQUAL(84 * 19, display.count("pixel"));
}
// A hex digit arrives every 87 us, so the Nano must draw each one with a single quick
// drawDots() call. Four drawPixel() calls and a division per dot took about 105 us: dense
// images (all yellow) overflowed the receive buffer (2.19.3). The PC can't time the Nano,
// so this checks the way it is drawn; the speed itself: tools/display_smoke_test.py.
void test_bitmap_digits_are_drawn_with_one_quick_call_each()
{
send("B000054131" + std::string(399, 'F') + "\n");
TEST_ASSERT_EQUAL(399, display.count("dots"));
TEST_ASSERT_EQUAL(4 * 399, display.count("pixel")); // only the ones drawDots() stands for
const DisplayCall *last = display.last("dots");
TEST_ASSERT_EQUAL(80, last->a); // the last digit of the last row
TEST_ASSERT_EQUAL(18, last->b);
TEST_ASSERT_EQUAL(0xF, last->c);
}
// The commands the ESP32 driver sends for a frame (lib/BROSE9323/frame_commands.h), run
// through this parser: the drawn dots must give the wanted image.
static const int IMG_BYTES = 11 * 19;
@@ -711,6 +726,7 @@ int main()
RUN_TEST(test_bitmap_pixels);
RUN_TEST(test_full_screen_bitmap_is_streamed);
RUN_TEST(test_bitmap_digits_are_drawn_with_one_quick_call_each);
RUN_TEST(test_frame_commands_send_only_the_changed_dots);
RUN_TEST(test_frame_commands_full_frame);
RUN_TEST(test_frame_commands_edge_and_nothing_changed);