FastLED 3.10.10
Loading...
Searching...
No Matches

◆ init_screenmap()

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

Definition at line 35 of file LedRopeTCL.cpp.

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