Helper to verify header bytes match expected RGB gains
| 55 | |
| 56 | /// Helper to verify header bytes match expected RGB gains |
| 57 | void checkHeaderBytes(u8 f0, u8 f1, u8 expected_r, u8 expected_g, u8 expected_b) { |
| 58 | // Verify f0 encoding: 0x80 | ((r_gain & 0x1F) << 2) | ((g_gain >> 3) & 0x03) |
| 59 | u8 expected_f0 = 0x80 | ((expected_r & 0x1F) << 2) | ((expected_g >> 3) & 0x03); |
| 60 | FL_CHECK_EQ(f0, expected_f0); |
| 61 | |
| 62 | // Verify f1 encoding: ((g_gain & 0x07) << 5) | (b_gain & 0x1F) |
| 63 | u8 expected_f1 = ((expected_g & 0x07) << 5) | (expected_b & 0x1F); |
| 64 | FL_CHECK_EQ(f1, expected_f1); |
| 65 | |
| 66 | // Verify decoded gains match |
| 67 | u8 r_decoded, g_decoded, b_decoded; |
| 68 | decodeGains(f0, f1, &r_decoded, &g_decoded, &b_decoded); |
| 69 | FL_CHECK_EQ(r_decoded, expected_r); |
| 70 | FL_CHECK_EQ(g_decoded, expected_g); |
| 71 | FL_CHECK_EQ(b_decoded, expected_b); |
| 72 | } |
| 73 | |
| 74 | /// Test fixture that exposes protected showPixels method |
| 75 | template<int DATA_PIN, fl::u8 CLOCK_PIN, EOrder RGB_ORDER> |
no test coverage detected