| 27 | fl::UIButton buttonAllWhite("All white"); |
| 28 | |
| 29 | fl::ScreenMap init_screenmap() { |
| 30 | LedColumns cols = LedLayoutArray(); |
| 31 | const int length = cols.length; |
| 32 | int sum = 0; |
| 33 | int y_max = 0; |
| 34 | for (int i = 0; i < length; ++i) { |
| 35 | sum += cols.array[i]; |
| 36 | int stagger = i % 2 ? 4 : 0; |
| 37 | int col_top = (cols.array[i] - 1) * 8 + stagger; |
| 38 | if (col_top > y_max) { |
| 39 | y_max = col_top; |
| 40 | } |
| 41 | } |
| 42 | fl::ScreenMap screen_map(sum, 0.8f); |
| 43 | int curr_idx = 0; |
| 44 | for (int i = 0; i < length; ++i) { |
| 45 | int n = cols.array[i]; |
| 46 | int stagger = i % 2 ? 4 : 0; |
| 47 | for (int k = 0; k < n; ++k) { |
| 48 | // Wiring is serpentine by column: even columns wind one way, odd |
| 49 | // columns the other, so a single rope can snake up and down. |
| 50 | int j = i % 2 ? (n - 1 - k) : k; |
| 51 | // Mirror y (horizontal flip + 180 deg rotation) so the rendered |
| 52 | // keyboard matches the physical Luminescent Grand orientation. |
| 53 | fl::vec2f xy(i*4, y_max - (j*8 + stagger)); |
| 54 | screen_map.set(curr_idx++, xy); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | return screen_map; |
| 59 | } |
| 60 | |
| 61 | } |
| 62 |
no test coverage detected