FastLED 3.9.15
Loading...
Searching...
No Matches

◆ init_screenmap()

fl::ScreenMap anonymous_namespace{LedRopeTCL.cpp}::init_screenmap ( )

Definition at line 29 of file LedRopeTCL.cpp.

29 {
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}
unsigned int xy(unsigned int x, unsigned int y)
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
LedColumns LedLayoutArray()
vec2< float > vec2f
Definition geometry.h:333
const int * array

References LedColumns::array, LedLayoutArray(), LedColumns::length, length(), fl::ScreenMap::set(), and xy().

+ Here is the call graph for this function: