Helper to verify pixel data (RGBW 8-bit mode) Verifies that the byte stream contains the expected RGBW pixel data Note: UCS7604 pads data BEFORE LED values, so padding comes right after preamble
| 235 | /// Verifies that the byte stream contains the expected RGBW pixel data |
| 236 | /// Note: UCS7604 pads data BEFORE LED values, so padding comes right after preamble |
| 237 | void verifyPixels8bitRGBW(fl::span<const uint8_t> bytes, fl::span<const RGBW8> pixels, size_t expected_padding) { |
| 238 | const size_t PREAMBLE_SIZE = 15; |
| 239 | const size_t BYTES_PER_PIXEL = 4; // RGBW 8-bit |
| 240 | |
| 241 | // Verify padding bytes are 0x00 (padding comes after preamble, before LED data) |
| 242 | for (size_t i = 0; i < expected_padding; i++) { |
| 243 | FL_CHECK_EQ(bytes[PREAMBLE_SIZE + i], 0x00); |
| 244 | } |
| 245 | |
| 246 | // Verify pixel data (starts after preamble + padding) |
| 247 | for (size_t i = 0; i < pixels.size(); i++) { |
| 248 | size_t byte_offset = PREAMBLE_SIZE + expected_padding + (i * BYTES_PER_PIXEL); |
| 249 | FL_CHECK_EQ(bytes[byte_offset + 0], pixels[i].r); // R |
| 250 | FL_CHECK_EQ(bytes[byte_offset + 1], pixels[i].g); // G |
| 251 | FL_CHECK_EQ(bytes[byte_offset + 2], pixels[i].b); // B |
| 252 | FL_CHECK_EQ(bytes[byte_offset + 3], pixels[i].w); // W |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | /// Helper to verify pixel data (RGBW 16-bit mode) |
| 257 | /// Verifies that the byte stream contains the expected RGBW pixel data |