forked from jasoncoon/led-mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.htm
575 lines (546 loc) · 21.6 KB
/
index.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css" />
<link href="index.css" rel="stylesheet" />
<title>LED Mapper</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-68S25LC05F"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-68S25LC05F");
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">LED Mapper</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"></li>
</ul>
<span class="navbar-text">
by Jason Coon
<a href="https://twitter.com/jasoncoon_" title="Follow @jasoncoon_ on Twitter" rel="noopener noreferrer" target="_blank" class="ms-1"
><i class="bi bi-twitter"></i
></a>
<a href="https://www.instagram.com/jasoncoon/" rel="noopener noreferrer" title="@jasoncoon on Instagram" target="_blank" class="ms-1"
><i class="bi bi-instagram"></i
></a>
<a href="https://www.youtube.com/jasoncoon" rel="noopener noreferrer" title="YouTube" target="_blank" class="ms-1"><i class="bi bi-youtube"></i></a>
<a
href="https://twitter.com/evilgeniuslab"
title="evilgeniuslabs.org"
class="ms-1 me-2 text-decoration-none text-muted"
rel="noopener noreferrer"
target="_blank"
>
of Evil Genius Labs</a
>|
<a
href="https://github.com/jasoncoon/led-mapper"
title="Source code on GitHub"
rel="noopener noreferrer"
target="_blank"
class="ms-1 text-decoration-none text-muted"
>Source Code:</a
>
<a href="https://github.com/jasoncoon/led-mapper" title="Source code on GitHub" rel="noopener noreferrer" target="_blank"
><i class="bi bi-github"></i
></a>
</span>
</div>
</div>
</nav>
<div class="container-fluid">
Instructions, examples, and more information:
<a href="https://github.com/jasoncoon/led-mapper/blob/main/README.md" target="_blank" rel="noopener noreferrer"
>https://github.com/jasoncoon/led-mapper/blob/main/README.md</a
>
<div class="accordion mt-1" id="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="headingInput">
<button
class="accordion-button text-decoration-none text-body"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseInput"
aria-expanded="true"
aria-controls="collapseInput"
>
1. Input
</button>
</h2>
<div id="collapseInput" class="accordion-collapse collapse show" aria-labelledby="headingInput">
<div class="accordion-body">
<h6 class="mb-2 text-muted">Choose one of the tabs below and paste in your input data.</h6>
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button
class="nav-link active"
id="layout-input-tab"
data-bs-toggle="tab"
data-bs-target="#layout-input"
type="button"
role="tab"
aria-controls="layout-input"
aria-selected="true"
>
Layout
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
id="coordinates-input-tab"
data-bs-toggle="tab"
data-bs-target="#coordinates-input"
type="button"
role="tab"
aria-controls="coordinates-input"
aria-selected="false"
>
Coordinates
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
id="pixelblaze-input-tab"
data-bs-toggle="tab"
data-bs-target="#pixelblaze-input"
type="button"
role="tab"
aria-controls="pixelblaze-input"
aria-selected="false"
>
Pixelblaze Map
</button>
</li>
</ul>
<div class="tab-content mt-1">
<div class="tab-pane fade show active" id="layout-input" role="tabpanel" aria-labelledby="layout-input-tab">
<div class="text-muted">
Paste an LED layout copied from
<a href="https://sheets.google.com" target="_blank" rel="noopener noreferrer">Google Sheets</a>
or other spreadsheet in tab-delimited text format, with a unique LED index in each cell. Cells without an LED should be empty.
</div>
<textarea class="form-control" id="textAreaLayout" rows="7">
0 1 2 3 4 5 6 7 8 9 10 11 12 13
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82
98 99 100 101 102 103 104 105 106 107 108 109 </textarea
>
<div class="btn-toolbar mt-1" role="toolbar">
<div class="btn-group" role="group">
<button id="buttonParseLayout" type="submit" class="btn btn-sm btn-outline-secondary">Parse Layout</button>
<button id="buttonCopyLayout" type="button" class="btn btn-sm btn-outline-secondary">Copy</button>
</div>
<div class="input-group ms-2">
<div class="invisible input-group-text" id="divCopyLayout"></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="coordinates-input" role="tabpanel" aria-labelledby="coordinates-input-tab">
<div class="text-muted">
Paste coordinates copied from
<a href="https://sheets.google.com" target="_blank" rel="noopener noreferrer">Google Sheets</a>
or other spreadsheet in tab-delimited text format. It should have three columns: index, x, and y, with or without column headers.
</div>
<textarea class="form-control" id="textAreaCoordinates" rows="7">
i x y
0 1 0
1 2 0
2 3 0
3 4 0
4 5 0
5 6 0
6 7 0
7 9 0
8 10 0
9 11 0
10 12 0
11 13 0
12 14 0
13 15 0
14 16 1
15 15 1
16 14 1
17 13 1
18 12 1
19 11 1
20 10 1
21 9 1
22 8 1
23 7 1
24 6 1
25 5 1
26 4 1
27 3 1
28 2 1
29 1 1
30 0 1
31 0 2
32 1 2
33 2 2
34 3 2
35 4 2
36 5 2
37 6 2
38 7 2
39 8 2
40 9 2
41 10 2
42 11 2
43 12 2
44 13 2
45 14 2
46 15 2
47 16 2
48 16 3
49 15 3
50 14 3
51 13 3
52 12 3
53 11 3
54 10 3
55 9 3
56 8 3
57 7 3
58 6 3
59 5 3
60 4 3
61 3 3
62 2 3
63 1 3
64 0 3
65 0 4
66 1 4
67 2 4
68 3 4
69 4 4
70 5 4
71 6 4
72 7 4
73 8 4
74 9 4
75 10 4
76 11 4
77 12 4
78 13 4
79 14 4
80 15 4
81 16 4
82 16 5
83 15 5
84 14 5
85 13 5
86 12 5
87 11 5
88 10 5
89 9 5
90 7 5
91 6 5
92 5 5
93 4 5
94 3 5
95 2 5
96 1 5
97 0 5
98 1 6
99 2 6
100 3 6
101 4 6
102 5 6
103 6 6
104 10 6
105 11 6
106 12 6
107 13 6
108 14 6
109 15 6</textarea
>
<div class="btn-toolbar mt-1" role="toolbar">
<div class="btn-group" role="group">
<button id="buttonParseCoordinates" type="submit" class="btn btn-sm btn-outline-secondary">Parse Coordinates</button>
<button id="buttonCopyCoordinates" type="button" class="btn btn-sm btn-outline-secondary">Copy</button>
</div>
<div class="input-group ms-2">
<div class="invisible input-group-text" id="divCopyCoordinates"></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pixelblaze-input" role="tabpanel" aria-labelledby="pixelblaze-input-tab">
<div class="text-muted">
Paste data from your
<a href="https://www.bhencke.com/mapping-in-pixelblaze" target="_blank" rel="noopener noreferrer">Pixelblaze</a>
Mapper tab or
<a href="http://app.bhencke.com/pixelmap.html" target="_blank" rel="noopener noreferrer">Image mapper</a>
in JSON format. It should have one array of [x,y] per LED, all in an array: [[x1,y1],[x2,y2],...] Whitespace does not matter.
</div>
<textarea class="form-control" id="textAreaPixelblaze" rows="4">
[[1,0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,0],[9,0],[10,0],[11,0],[12,0],[13,0],[14,0],[15,0],[16,1],[15,1],[14,1],[13,1],[12,1],[11,1],[10,1],[9,1],[8,1],[7,1],[6,1],[5,1],[4,1],[3,1],[2,1],[1,1],[0,1],[0,2],[1,2],[2,2],[3,2],[4,2],[5,2],[6,2],[7,2],[8,2],[9,2],[10,2],[11,2],[12,2],[13,2],[14,2],[15,2],[16,2],[16,3],[15,3],[14,3],[13,3],[12,3],[11,3],[10,3],[9,3],[8,3],[7,3],[6,3],[5,3],[4,3],[3,3],[2,3],[1,3],[0,3],[0,4],[1,4],[2,4],[3,4],[4,4],[5,4],[6,4],[7,4],[8,4],[9,4],[10,4],[11,4],[12,4],[13,4],[14,4],[15,4],[16,4],[16,5],[15,5],[14,5],[13,5],[12,5],[11,5],[10,5],[9,5],[7,5],[6,5],[5,5],[4,5],[3,5],[2,5],[1,5],[0,5],[1,6],[2,6],[3,6],[4,6],[5,6],[6,6],[10,6],[11,6],[12,6],[13,6],[14,6],[15,6]]</textarea
>
<div class="btn-toolbar mt-1" role="toolbar">
<div class="btn-group" role="group">
<button id="buttonParsePixelblaze" type="submit" class="btn btn-sm btn-outline-secondary">Parse Pixelblaze Map</button>
<button id="buttonCopyPixelblazeInput" type="button" class="btn btn-sm btn-outline-secondary">Copy</button>
</div>
<div class="input-group ms-2">
<div class="invisible input-group-text" id="divCopyPixelblazeInput"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingMapInfo">
<button
class="accordion-button collapsed text-decoration-none text-body"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseMapInfo"
aria-expanded="false"
aria-controls="collapseMapInfo"
>
2. Map Configuration
</button>
</h2>
<div id="collapseMapInfo" class="accordion-collapse collapse" aria-labelledby="headingMapInfo">
<div class="accordion-body">
<h6 class="mb-2 text-muted">Adjust the map's center coordinates, if needed.</h6>
<form class="row g-2" id="form">
<div class="col-sm-2">
<label for="inputWidth" class="form-label">Width</label>
<input class="form-control" id="inputWidth" disabled />
</div>
<div class="col-sm-2">
<label for="inputHeight" class="form-label">Height</label>
<input class="form-control" id="inputHeight" disabled />
</div>
<div class="col-sm-2">
<label for="inputCenterX" class="form-label">Center X</label>
<input type="number" class="form-control" id="inputCenterX" step=".5" />
</div>
<div class="col-sm-2">
<label for="inputCenterY" class="form-label">Center Y</label>
<input type="number" class="form-control" id="inputCenterY" step=".5" />
</div>
</form>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingOutput">
<button
class="accordion-button collapsed text-decoration-none text-body"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseOutput"
aria-expanded="true"
aria-controls="collapseOutput"
>
3. Output
</button>
</h2>
<div id="collapseOutput" class="accordion-collapse collapse" aria-labelledby="headingOutput">
<div class="accordion-body">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button
class="nav-link active"
id="fastled-output-tab"
data-bs-toggle="tab"
data-bs-target="#fastled-output"
type="button"
role="tab"
aria-controls="fastled-output"
aria-selected="true"
>
FastLED
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
id="pixelblaze-output-tab"
data-bs-toggle="tab"
data-bs-target="#pixelblaze-output"
type="button"
role="tab"
aria-controls="pixelblaze-output"
aria-selected="false"
>
Pixelblaze
</button>
</li>
</ul>
<div class="tab-content mt-1">
<div class="tab-pane fade show active" id="fastled-output" role="tabpanel" aria-labelledby="fastled-output-tab">
<h6 class="mb-2 text-muted">
Copy and paste this into your
<a href="https://www.arduino.cc/en/software" target="_blank" rel="noopener noreferrer">Arduino</a>
sketch for
<a href="https://github.com/FastLED/FastLED" target="_blank" rel="noopener noreferrer">FastLED</a>. Here's an
<a href="https://github.com/jasoncoon/led-mapper/blob/main/fastled-map-demo/fastled-map-demo.ino" target="_blank" rel="noopener noreferrer"
>example sketch</a
>.
</h6>
<pre><code id="codeFastLED"></code></pre>
<div class="btn-toolbar mt-1" role="toolbar">
<button id="buttonCopyCode" type="button" class="btn btn-sm btn-outline-secondary">Copy</button>
<div class="input-group ms-2">
<div class="invisible input-group-text" id="divCopyCode"></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pixelblaze-output" role="tabpanel" aria-labelledby="pixelblaze-output-tab">
<h6 class="mb-2 text-muted">
Copy and paste this into your
<a href="https://www.bhencke.com/mapping-in-pixelblaze" target="_blank" rel="noopener noreferrer">Pixelblaze</a>
Mapper tab.
</h6>
<pre><code id="codePixelblaze"></code></pre>
<div class="btn-toolbar mt-1" role="toolbar">
<button id="buttonCopyPixelblaze" type="button" class="btn btn-sm btn-outline-secondary">Copy</button>
<div class="input-group ms-2">
<div class="invisible input-group-text" id="divCopyPixelblaze"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="btn-toolbar mt-3 gap-2" role="toolbar">
<div class="input-group">
<div class="input-group-text">Preview</div>
<select id="selectPattern" class="form-control" style="width: auto">
<option>rainbow</option>
<option>clockwise rainbow</option>
<option>counter-clockwise rainbow</option>
<option selected>outward rainbow</option>
<option>inward rainbow</option>
<option>north rainbow</option>
<option>northeast rainbow</option>
<option>east rainbow</option>
<option>southeast rainbow</option>
<option>south rainbow</option>
<option>southwest rainbow</option>
<option>west rainbow</option>
<option>northwest rainbow</option>
<option>white</option>
</select>
<button id="buttonPreviousPattern" type="button" class="btn btn-sm btn-outline-secondary" title="Previous Pattern">
<i class="bi bi-skip-backward-fill"></i>
</button>
<button id="buttonNextPattern" type="button" class="btn btn-sm btn-outline-secondary" title="Next Pattern">
<i class="bi bi-skip-forward-fill"></i>
</button>
</div>
<div class="btn-group" role="group">
<button id="buttonPlayPause" type="button" title="Pause" class="btn btn-sm btn-outline-secondary">
<i id="iconPlayPause" class="bi bi-pause-fill"></i>
</button>
</div>
<div class="btn-group" role="group">
<div class="input-group-text" id="btnGroupAddon2">LED</div>
<input type="checkbox" class="btn-check" id="checkboxShowPreviewBorders" autocomplete="off" checked />
<label class="btn btn-outline-secondary" for="checkboxShowPreviewBorders">
<i id="iconShowPreviewBorders" class="bi bi-check-square"></i>
Borders</label
>
<input type="checkbox" class="btn-check" id="checkboxShowPreviewNumbers" autocomplete="off" checked />
<label class="btn btn-outline-secondary" for="checkboxShowPreviewNumbers">
<i id="iconShowPreviewNumbers" class="bi bi-check-square"></i>
Numbers</label
>
</div>
<div class="btn-group" role="group">
<div class="input-group" title="LED Numbers Font Size">
<div class="input-group-text">Size</div>
<input id="inputPreviewFontSize" class="form-control" type="number" step="0.25" min="0.25" value="10" style="width: 4rem" />
</div>
</div>
</div>
</div>
<canvas id="canvasPreview" class="mt-2 m-sm-3"></canvas>
<div class="container-fluid">
<div class="accordion mt-2" id="accordionStats">
<div class="accordion-item">
<h2 class="accordion-header" id="headingStats">
<button
class="accordion-button collapsed text-decoration-none text-body"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseStats"
aria-expanded="true"
aria-controls="collapseStats"
>
Stats & Debug Info
</button>
</h2>
<div id="collapseStats" class="accordion-collapse collapse" aria-labelledby="headingStats" data-bs-parent="#accordionStats">
<div class="accordion-body">
Parsed Layout:
<pre><code id="codeParsedLayout"></code></pre>
Parsed Coordinates:
<pre><code id="codeParsedCoordinates"></code></pre>
Parsed Pixelblaze:
<pre><code id="codeParsedPixelblaze"></code></pre>
Stats:
<pre><code id="codeStats"></code></pre>
</div>
</div>
</div>
</div>
<!-- bootstrap breakpoint debug display -->
<!--
<div class="d-block d-sm-none">xs</div>
<div class="d-none d-sm-block d-md-none">sm</div>
<div class="d-none d-md-block d-lg-none">md</div>
<div class="d-none d-lg-block d-xl-none">lg</div>
<div class="d-none d-xl-block d-xxl-none">xl</div>
<div class="d-none d-xxl-block">xxl</div> -->
</div>
<!-- Bootstrap Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"
></script>
<script src="index.js"></script>
</body>
</html>