FastLED XY Map Generator

by Garrett Mace (macetech.com), inspired by Mark Kriegsman

Code: https://github.com/macetech/FastLED-XY-Map-Generator

Automatically generates XYmap function for irregular/gapped LED arrays.

Set the maximum x and y dimensions, layout style (how the LEDs are actually wired), and click Rebuild.

Then click LEDs to edit the shape of the array by enabling and disabling pixels. The code is updated in realtime.

Copy the resulting function and paste into your code.

The function will map ordinary X-Y coordinates to the irregular array, preserving pixels that land in gaps.

Serpentine Vertical
V-Flip H-Flip

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
1
2
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2
3
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
3
4
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
4
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Params for width and height
const uint8_t kMatrixWidth = 16;
const uint8_t kMatrixHeight = 5;

#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[ NUM_LEDS ];
#define LAST_VISIBLE_LED 79
uint8_t XY (uint8_t x, uint8_t y) {
// any out of bounds address maps to the first hidden pixel
if ( (x >= kMatrixWidth) || (y >= kMatrixHeight) ) {
return (LAST_VISIBLE_LED + 1);
}

const uint8_t XYTable[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79
};

uint8_t i = (y * kMatrixWidth) + x;
uint8_t j = XYTable[i];
return j;
}