-
Notifications
You must be signed in to change notification settings - Fork 7
/
leds.h
1033 lines (738 loc) · 23 KB
/
leds.h
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// leds.h
#ifndef _LEDS_h
#define _LEDS_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#endif
#include "leds_palletes.h"
//#include <FastLED.h>
//#include <pixeltypes.h>
//#include "pixeltypes.h"
// defines , DO NOT CHANGE!!!!
#define MAX_NUM_LEDS (170*6) // what is the max it can be set to in the config
#define MAX_NUM_LEDS_BOOT 21 // only set the first 20 for boot info green=ap / red= clinet
#define POT_SENSE_DEF 4 // only take Variable resistor value if it changes more than this.
#define MAX_FADE_VALUE 20 // 90 is to much // maximum for FADE effect on each frame in amount 0-255
#define MAX_JD_SPEED_VALUE 30 // maximum BPM for Juggle and SAW dots
#define MAX_GLITTER_VALUE 255 // max glitter value
#define MAX_PAL_FPS 100 // maximum FPS
#define BMP_MAX_TIME 3000
#define MAX_INDEX_LONG 4096 //6 // must stay under this number!
#define MAX_LAMP_CONFIGS 16
// Strip/Form settings do not change!!!
#define _M_NR_FORM_BYTES_ 8 // 2 bytes = 16 forms // 4 bytes = 32 forms
#define NR_FORM_PARTS 64 // how many forms? default 6*8 = 64
// #define NR_STRIPS 32 // how many strips default 32
#define NR_PALETTS 8 // how many pallets do we have = 2
#define NR_PALETTS_SELECT 32 // how many to choose from with the ones from progmem
#define MICROS_TO_MIN 60000000
#define DEF_CONFNAME "Def"
// Structures
struct led_controls_struct
{
uint8_t PotBriLast;
uint8_t PotFPSLast;
};
struct led_cfg_struct // LED config structure
{ //
uint8_t max_bri; // max Bri
// uint8_t bri; // actual BRI
uint8_t startup_bri; // the startup brightness
// uint8_t r; // max Red
// uint8_t g; // max green
// uint8_t b; // max blue
uint8_t hue; // HSV hue used for effects, every frame increments by one automatically
unsigned long update_time; // when to update the leds again
// uint8_t pal_fps; // pallete FPS ... FFT FPS overrides this if FFT is enabled
// uint8_t pal_bri; // Pallete bri so that we can dimm it down to the FFT
uint8_t bpm; // BPM , used to time the pallete to a bpm
unsigned long bpm_lastT; // timing for BMP
unsigned long bpm_diff; //
uint8_t ledMode; // type of led 0= APA102, 1 = WS2812 , 2 = SK6822
uint16_t NrLeds; // how many leds total not fully implemented TODO!!!
// uint8_t fire_sparking; // For fire animation
// uint8_t fire_cooling; // For fire animation
uint8_t Play_Nr ; // What sequenca are we in.
uint16_t DataNR_leds[5];
uint16_t DataStart_leds[4];
uint8_t apa102data_rate; // data rate for apa102 max 24
unsigned long confSwitch_time; // when to swtich to the next config for sequencer
uint8_t edit_pal;
uint8_t bootCFG;
uint8_t PotSens; // the sensitivity
uint8_t fade_inout_val; // fade value for load/save
uint8_t next_config_loadsave; // whats the next config to load
// unsigned long update_FIN_time; // when to update the leds again
uint8_t realfps; // whats the real fps that we have at the moment.
uint8_t framecounter; // for counting FPS
unsigned long framecounterUpdateTime; // for calculationg fps
char Led_Setup_confname[24];
uint8_t Led_Setup_ConfNr;
};
struct led_master_conf
{
//uint8_t fire_sparking; // For fire animation
//uint8_t fire_cooling; // For fire animation
uint8_t r; // max Red
uint8_t g; // max green
uint8_t b; // max blue
uint8_t pal_fps; // pallete FPS ... FFT FPS overrides this if FFT is enabled
uint8_t pal_bri; // Pallete bri so that we can dimm it down to the FFT
uint8_t bri; // actual BRI
};
/* struct fft_led_cfg_struct
{
unsigned long update_time; // when to update again forFFT vis in Open stage controll
float adjuster; // an adjuster for the timing of the FFT_FPS
uint8_t fps; // FFT
uint8_t fftAutoMax; // FFT Auto mode maximum trigger
uint8_t fftAutoMin; // FFT Auto mode minimum trigger
uint16_t Scale;
uint8_t viz_fps;
}; */
//#define _M_NR_FORM_BYTES_ 4 // 2 bytes = 16 forms // 4 bytes = 32 forms
struct form_Led_Setup_Struct
{
uint16_t start_led; // where the pallete starts
uint16_t nr_leds; // how many ? for mirror how many extra.
};
// *************** Layers ************************
#define MAX_LAYERS_SELECT 49 // up to how many layers can you add
#define MAX_LAYERS 49 // what is the max layer Number
#define MAX_LAYERS_BASIC 22 // what is the max layer Number
enum layer_options
{
_M_LAYER_00_FFT = 1,
_M_LAYER_00_PAL = 2,
_M_LAYER_00_FX01 = 3,
_M_LAYER_00_FIRE = 4,
_M_LAYER_00_SHIMMER = 5,
_M_LAYER_00_STROBE = 11,
_M_LAYER_00_EYES = 13,
_M_LAYER_00_ROTATE = 15,
_M_LAYER_16_FFT = 6,
_M_LAYER_16_PAL = 7,
_M_LAYER_16_FX01 = 8,
_M_LAYER_16_FIRE = 9,
_M_LAYER_16_SHIMMER = 10,
_M_LAYER_16_STROBE = 12,
_M_LAYER_16_EYES = 14,
_M_LAYER_16_ROTATE = 16,
_M_LAYER_32_FFT = 17,
_M_LAYER_32_PAL = 18,
_M_LAYER_32_ROTATE = 19,
_M_LAYER_48_FFT = 20,
_M_LAYER_48_PAL = 21,
_M_LAYER_48_ROTATE = 22,
_M_LAYER_48_MIRROR = 23,
_M_LAYER_00_CLOCK = 24,
_M_LAYER_16_CLOCK = 25,
_M_LAYER_00_MIRROR = 26,
_M_LAYER_16_MIRROR = 27,
_M_LAYER_32_MIRROR = 28,
_M_LAYER_SAVE_ALPHA = 40,
_M_LAYER_SAVE_BETA = 41,
_M_LAYER_SAVE_GAMMA = 42,
_M_LAYER_SAVE_OMEGA = 43,
_M_LAYER_RUN_ALPHA = 44,
_M_LAYER_RUN_BETA = 45,
_M_LAYER_RUN_GAMMA = 46,
_M_LAYER_RUN_OMEGA = 47,
_M_LAYER_CLEAR = 48,
};
enum AutoPalMode
{
Ap_MANUAL = 1
,Ap_M1 = 0
,Ap_M2 = 2
,Ap_M3 = 3
,Ap_M4 = 4
,Ap_M5 = 5
,Ap_M6 = 6
,Ap_M7 = 7
,Ap_M8 = 8
,Ap_M9 = 9
,Ap_M10 = 10
,Ap_D2 = 52
,Ap_D3 = 53
,Ap_D4 = 54
,Ap_D5 = 55
,Ap_D6 = 56
,Ap_D7 = 57
,Ap_D8 = 58
,Ap_D9 = 59
,Ap_D10 = 60
};
// ***************Palette ************************
#define _M_NR_FORM_PAL_OPTIONS_ 6
enum form_pal_options
{
_M_FORM_PAL_RUN,
_M_FORM_PAL_REVERSED,
_M_FORM_PAL_MIRROR,
_M_FORM_PAL_BLEND,
_M_FORM_PAL_ONECOLOR,
_M_FORM_PAL_SPEED_FROM_FFT
};
struct form_fx_pal_run_struct
{
uint16_t indexLong;
uint8_t index; // the pallete index
};
struct form_fx_pal_struct
{
uint8_t level;
uint16_t index_start; // Where to start at reset
uint16_t index_add_led; // how much to add onto the index on
uint16_t index_add_frame; // ???
uint8_t autoPalMode;
};
struct form_fx_pal_singles_struct
{
uint8_t pal;
uint8_t mix_mode;
uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
uint8_t palSpeedBin; // index_add_frame + trigger from bin , 255 = none
uint8_t lvl_bin; // whats the lvl bin to add to the lvl , 255 = none
uint8_t master_lvl; // the master level for the layer
};
// ***************FX 01 ************************
#define _M_NR_FORM_FX1_OPTIONS_ 3
enum form_fx1_options
{
_M_FORM_FX1_RUN,
_M_FORM_FX1_REVERSED,
_M_FORM_FX1_MIRROR,
};
struct form_fx1_struct
{
uint8_t mix_mode;
uint8_t level;
uint8_t fade;
uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
uint8_t lvl_bin;
uint8_t master_lvl;
};
// *************** FX01 Glitter ************************
#define _M_NR_FORM_GLITTER_OPTIONS_ 2
enum form_glitter_options
{
_M_FORM_GLITTER_RUN,
_M_FORM_GLITTER_FFT,
};
struct form_fx_glitter_struct
{
uint8_t value;
};
struct form_fx_glitter_bytes_struct
{
uint8_t pal;
uint8_t level;
uint8_t glit_bin;
};
// *************** FX01 Dots BPM ************************
#define _M_NR_FORM_DOT_OPTIONS_ 2
enum form_dot_options
{
_M_FORM_DOT_RUN,
_M_FORM_DOT_TYPE, // 0 = sine , 1 = saw
//_M_FORM_DOT_COLOR, // 0 = Pallete , 1 FFT
};
enum form_dot_type
{
DOT_SAW = 0,
DOT_SINE = 1
};
struct form_fx_dots_run_struct
{
uint16_t indexLong;
};
struct form_fx_dots_struct
{
uint8_t nr_dots; // Nr Juggle Dots or Saw dots
uint8_t speed; // Dot speed in BPM
uint16_t index_add;
};
struct form_fx_dots_bytes_struct
{
uint8_t pal; // "FFT color result": 250,"Rotating Hue": 251 others = pal
uint8_t level;
};
// *************** FX01 Meteor ************************
#define _M_NR_FORM_METEOR_OPTIONS_ 2
enum form_meteor_options
{
_M_FORM_METEOR_RUN,
_M_FORM_METEOR_RANDOMDECAY
// _M_FORM_METEOR_MIRROR,
// _M_FORM_METEOR_REVERSED
};
struct form_fx_meteor_struct
{
//uint8_t color;
//uint8_t mix_mode;
//uint8_t level;
uint16_t meteorSize;
uint8_t meteorTrailDecay;
//uint8_t lvl_bin;
//uint8_t triggerBin;
uint16_t frame_pos;
};
struct form_fx_meteor_bytes_struct
{
uint8_t color;
//uint8_t mix_mode;
uint8_t level;
//uint16_t meteorSize;
//uint8_t meteorTrailDecay;
uint8_t lvl_bin;
uint8_t triggerBin;
//uint16_t frame_pos;
uint8_t master_lvl;
};
// *************** Fire ************************
#define _M_NR_FORM_FIRE_OPTIONS_ 3
enum form_fire_options
{
_M_FORM_FIRE_RUN,
_M_FORM_FIRE_REVERSED,
_M_FORM_FIRE_MIRROR,
_M_FORM_FIRE_SPK_FFT,
_M_FORM_FIRE_COOL_FFT
};
struct form_fx_fire_struct
{
uint8_t pal;
uint8_t mix_mode;
uint8_t level;
uint8_t cooling;
uint8_t sparking;
uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
uint8_t lvl_bin;
uint8_t master_lvl;
};
// *************** Strobe ************************
#define _M_NR_FORM_STROBE_OPTIONS_ 1
enum form_strobe_options
{
_M_FORM_STROBE_RUN,
};
struct form_fx_strobe_run_struct
{
//uint8_t pal;
//uint8_t mix_mode;
//uint8_t level;
//uint8_t on_frames;
//uint8_t off_frames;
uint16_t frame_pos; // what fft fx bin to trigger from 255 = none.
//uint8_t lvl_bin;
//uint8_t triggerBin;
};
struct form_fx_strobe_bytes_struct
{
uint8_t pal;
uint8_t mix_mode;
uint8_t level;
uint8_t on_frames;
uint8_t off_frames;
//uint16_t frame_pos;
uint8_t lvl_bin;
uint8_t triggerBin;
int8_t master_lvl;
};
// *************** Eyes ************************
#define _M_NR_FORM_EYES_OPTIONS_ 1
enum form_eyes_options
{
_M_FORM_EYES_RUN,
};
struct form_fx_eyes_run_struct
{
uint16_t frame_pos;
uint16_t eye_pos;
};
struct form_fx_eyes_bytes_struct
{
uint8_t color;
uint8_t mix_mode;
uint8_t level;
uint16_t on_frames;
uint16_t EyeWidth;
uint16_t EyeSpace;
uint8_t lvl_bin;
uint8_t triggerBin;
uint8_t fadeval;
uint16_t pause_frames;
uint8_t master_lvl;
};
// *************** Clock ************************
#define _M_NR_FORM_CLOCK_OPTIONS_ 9
enum form_clock_options
{
_M_FORM_CLOCK_RUN,
_M_FORM_CLOCK_PAL_REVERSED,
_M_FORM_CLOCK_PAL_MIRROR,
_M_FORM_CLOCK_PAL_BLEND,
_M_FORM_CLOCK_PAL_ONECOLOR,
_M_FORM_CLOCK_HOUR,
_M_FORM_CLOCK_MINUET,
_M_FORM_CLOCK_SECONDS,
_M_FORM_CLOCK_24h,
};
/*enum form_clock_types
{
CLOCK_DOT = 0
,CLOCK_BAR = 1
,CLOCK_PAL = 2
};
*/
struct form_fx_clock_run_struct
{
uint16_t pal_index;
};
struct form_fx_clock_struct
{
uint8_t color;
uint8_t level;
uint16_t pal_speed;
uint16_t pal_compression;
uint16_t offset;
};
struct form_fx_clock_bytes_struct
{
uint8_t mix_mode;
uint8_t master_lvl;
uint8_t type;
};
// *************** FFT ************************
#define _M_NR_FORM_FFT_OPTIONS_ 4
enum form_fft_options
{
_M_FORM_FFT_RUN,
_M_FORM_FFT_REVERSED,
_M_FORM_FFT_MIRROR,
_M_FORM_FFT_ONECOLOR
};
#define FFT_FX_NR_OF_BINS 10
struct fft_fxbin_struct
{
uint8_t set_val ;
uint8_t trrig_val;
uint8_t menu_select;
uint8_t bin_mode;
};
struct fft_fxbin_run_struct
{
uint8_t sum ;
uint8_t result;
};
enum FFTBIN_MODES
// The different modes for FFTBINS for FX
// When using trigger only the value above the trigger is put into the Bin
{
BIN_MODE_BIN_SUM = 0, // RETURN (SUM)
BIN_MODE_TRIGGER_0 = 1, // If (SUM > Trigger) RETURN (SUM) else (0)
BIN_MODE_TRIGGER_255 = 2, // IF (SUM > Trigger) RETURN (255-SUM) else (255)
BIN_MIDE_SV_TRIGGER = 3, // IF (SUM > Trigger) RETURN (SV + SUM) else (Start Val)
BIN_MODE_SV_DOWN_TRIGGER = 4, // IF (SUM > Trigger) RETURN (Start Val - SUM ) else (Start Val)
};
struct form_fx_ffr_run_struct
{
uint8_t extend_tick;
};
struct form_fx_fft_struct
{
//uint8_t mix_mode;
uint8_t level;
uint8_t offset;
uint8_t extend;
//uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
//uint8_t lvl_bin;
//uint8_t color;
};
struct form_fx_fft_singles_struct
{
uint8_t mix_mode;
//uint8_t level;
//uint8_t offset;
//uint8_t extend;
uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
uint8_t lvl_bin;
uint8_t color;
//uint8_t extend_tick;
uint8_t master_lvl;
};
// *************** Shimmer ************************
#define _M_NR_FORM_SHIMMER_OPTIONS_ 2
enum form_shimmer_options
{
_M_FORM_SHIMMER_RUN,
_M_FORM_SHIMMER_BLEND,
};
struct form_fx_shim_struct
{
// uint8_t pal;
// uint8_t mix_mode;
// uint8_t level;
uint8_t xscale;
uint8_t yscale;
uint8_t beater;
// uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
// uint8_t lvl_bin;
uint16_t dist;
};
struct form_fx_shim_bytes_struct
{
uint8_t pal;
uint8_t mix_mode;
uint8_t level;
// uint8_t xscale;
// uint8_t yscale;
// uint8_t beater;
uint8_t triggerBin; // what fft fx bin to trigger from 255 = none.
uint8_t lvl_bin;
uint8_t master_lvl;
// uint16_t dist;
};
struct form_fx_shim_global_struct
{
int waveA;
int waveB;
int waveC;
uint8_t Abpm;
int Ahigh;
int Alow;
uint8_t index_addA;
uint8_t indexA;
uint8_t Bbpm;
int Bhigh;
int Blow;
uint8_t index_addB;
uint8_t indexB;
uint8_t Cbpm;
int Chigh;
int Clow;
uint8_t index_addC;
uint8_t indexC;
};
// ********* Modify**********************
# define _M_NR_FORM_MODIFY_OPTIONS_ 4
enum form_modify_options
{
_M_FORM_MODIFY_ROTATE,
_M_FORM_MODIFY_ROTATE_REVERSED,
_M_FORM_MODIFY_MIRROR,
_M_FORM_MODIFY_MIRROR_REVERSED,
};
struct form_fx_modify_run_struct
{
uint16_t RotateFramePos;
};
struct form_fx_modify_struct
{
uint16_t RotateFixed;
};
struct form_fx_modify_bytes_struct
{
uint16_t RotateFullFrames;
uint8_t RotateTriggerBin;
};
/*
// ***************Copy Leds ************************
struct led_Copy_Struct // copy strips data structure
{
uint16_t start_led;
int nr_leds;
uint16_t Ref_LED;
};
#define NR_COPY_STRIPS 16
#define NR_COPY_LED_BYTES 2
*/
/*
#define _M_NR_GLOBAL_OPTIONS_ 2 // This was a test to make reversing and mirroring global even in ARTNET
// Was having werad flickering!!
// TODO Check me again
enum global_strip_options {
_M_G_REVERSED_ = 0
, _M_G_MIRROR_ = 1
};
*/
struct fft_data_struct // run values
{
//uint8_t bin_on_red; // bits select what bin to trigger on
//uint8_t bin_on_green; // bits select what bin to trigger on
//uint8_t bin_on_blue; // bits select what bin to trigger on
//uint8_t value; // actual value
uint8_t avarage;
// uint8_t autoFFT;
uint8_t max;
uint8_t result;
};
struct fft_config_struct // Config Values
{
byte fft_menu[3] = { 1,16,128 }; // 3 fft data bins for RGB
byte fft_menu_bri = 0; // howmuch to add to bri based on fft data
byte fft_menu_fps = 0; // howmuch to add to the FPS based on FFT data selected.
//fft_led_cfg_struct fft_led_cfg = { 0,1,25,240,11,1};
uint8_t fft_bin_autoTrigger = 0;
uint8_t trigger[7]; // trigger value
//uint8_t fft_color_result_bri = 0;
//uint8_t fft_color_fps = 0;
//CRGB GlobalColor_result;
fft_fxbin_struct fft_fxbin[FFT_FX_NR_OF_BINS] ;
uint8_t fps; // FFT
uint8_t fftAutoMax; // FFT Auto mode maximum trigger
uint8_t fftAutoMin; // FFT Auto mode minimum trigger
uint16_t Scale;
uint8_t viz_fps;
};
struct fft_run_struct // run vals
{
//byte fft_data_bri = 0; // howmuch to add to bri based on fft data
//byte fft_data_fps = 0; // howmuch to add to the FPS based on FFT data selected.
//fft_led_cfg_struct fft_led_cfg = { 0,1,25,240,11,1};
uint8_t fft_color_result_bri = 0;
uint8_t fft_color_fps = 0;
CRGB GlobalColor_result;
fft_fxbin_run_struct fft_fxbin[FFT_FX_NR_OF_BINS] ;
unsigned long update_time; // when to update again forFFT vis in Open stage controll
float adjuster; // an adjuster for the timing of the FFT_FPS
};
#define NO_OF_SAVE_LAYERS 4
struct layer_struct
{
uint8_t save_mix[NO_OF_SAVE_LAYERS];
uint8_t save_lvl[NO_OF_SAVE_LAYERS];
uint16_t save_startLed[NO_OF_SAVE_LAYERS];
uint16_t save_NrLeds[NO_OF_SAVE_LAYERS];
uint8_t select[MAX_LAYERS_SELECT] ;
uint16_t clear_start_led;
uint16_t clear_Nr_leds;
};
//******************** DEcks *******************
#define NR_FX_BYTES 4
#define NR_FX_PARTS (NR_FX_BYTES * 8)
// The RUN struct these values change with calucations not relevant for saving.
struct deck_run_struct
{
CRGBArray<MAX_NUM_LEDS> leds_FFT_history;
CRGBArray<MAX_NUM_LEDS> led_FX_out;
CRGBArray<MAX_NUM_LEDS> leds;
//CRGB leds_FFT_history[MAX_NUM_LEDS];
//CRGB led_FX_out[MAX_NUM_LEDS];
//CRGB leds[MAX_NUM_LEDS];
byte heat[MAX_NUM_LEDS ];
fft_data_struct fft_data[7];
fft_run_struct fft;
CRGBArray<MAX_NUM_LEDS> SaveLayers[NO_OF_SAVE_LAYERS];
form_fx_ffr_run_struct form_fx_fft[NR_FORM_PARTS];
form_fx_pal_run_struct form_fx_pal[NR_FORM_PARTS];
form_fx_modify_run_struct form_fx_modify[NR_FORM_PARTS];
form_fx_dots_run_struct form_fx_dots[NR_FX_PARTS];
form_fx_eyes_run_struct form_fx_eyes[NR_FX_PARTS];
form_fx_strobe_run_struct form_fx_strobe[NR_FX_PARTS] ;
form_fx_clock_run_struct form_fx_clock[NR_FX_PARTS];
};
struct deck_fx1_struct
{
form_fx1_struct form_fx1[NR_FX_BYTES];
form_fx_shim_struct form_fx_shim[NR_FX_PARTS];
form_fx_shim_bytes_struct form_fx_shim_bytes[NR_FX_BYTES];
form_fx_fire_struct form_fx_fire_bytes[NR_FX_PARTS];
//form_fx_fire_bytes_struct form_fx_fire_bytes[NR_FX_BYTES];
form_fx_glitter_struct form_fx_glitter[NR_FX_PARTS];
form_fx_glitter_bytes_struct form_fx_glitter_bytes[NR_FX_BYTES];
form_fx_dots_struct form_fx_dots[NR_FX_PARTS];
form_fx_dots_bytes_struct form_fx_dots_bytes[NR_FX_BYTES];
form_fx_strobe_bytes_struct form_fx_strobe_bytes[NR_FX_BYTES] ;
form_fx_eyes_bytes_struct form_fx_eyes_bytes[NR_FX_BYTES];
form_fx_meteor_struct form_fx_meteor[NR_FX_PARTS];
form_fx_meteor_bytes_struct form_fx_meteor_bytes[NR_FX_BYTES];
form_fx_clock_struct form_fx_clock[NR_FX_PARTS];
form_fx_clock_bytes_struct form_fx_clock_bytes[NR_FX_BYTES];
byte form_menu_fx1[NR_FX_BYTES][_M_NR_FORM_FX1_OPTIONS_];
byte form_menu_dot[NR_FX_BYTES][_M_NR_FORM_DOT_OPTIONS_];
byte form_menu_fire[NR_FX_BYTES][_M_NR_FORM_FIRE_OPTIONS_];
byte form_menu_shimmer[NR_FX_BYTES][_M_NR_FORM_SHIMMER_OPTIONS_];
byte form_menu_glitter[NR_FX_BYTES][_M_NR_FORM_GLITTER_OPTIONS_];
byte form_menu_strobe[NR_FX_BYTES][_M_NR_FORM_STROBE_OPTIONS_];
byte form_menu_eyes[NR_FX_BYTES][_M_NR_FORM_EYES_OPTIONS_];
byte form_menu_meteor[NR_FX_BYTES][_M_NR_FORM_METEOR_OPTIONS_];
byte form_menu_clock[NR_FX_BYTES][_M_NR_FORM_CLOCK_OPTIONS_];
};
struct deck_cfg_struct
{
char confname[32];
led_master_conf led_master_cfg;
layer_struct layer;
fft_config_struct fft_config;
form_Led_Setup_Struct form_cfg[NR_FORM_PARTS];
form_fx_pal_struct form_fx_pal[NR_FORM_PARTS];
form_fx_pal_singles_struct form_fx_pal_singles[_M_NR_FORM_BYTES_];
form_fx_fft_struct form_fx_fft[NR_FORM_PARTS];
form_fx_fft_singles_struct form_fx_fft_signles[_M_NR_FORM_BYTES_];
//form_fx1_struct form_fx1[NR_FORM_PARTS];
CRGBPalette16 LEDS_pal_cur[NR_PALETTS];
byte form_menu_pal[_M_NR_FORM_BYTES_][_M_NR_FORM_PAL_OPTIONS_];
byte form_menu_fft[_M_NR_FORM_BYTES_][_M_NR_FORM_FFT_OPTIONS_];
form_fx_modify_struct form_fx_modify[NR_FORM_PARTS];
form_fx_modify_bytes_struct form_fx_modify_bytes[_M_NR_FORM_BYTES_];
byte form_menu_modify[_M_NR_FORM_BYTES_][_M_NR_FORM_MODIFY_OPTIONS_];
};
struct deck_struct
{
deck_cfg_struct cfg;
deck_fx1_struct fx1_cfg;
deck_run_struct run;
};
struct save_struct
{
deck_cfg_struct cfg;
deck_fx1_struct fx1_cfg;
};
//struct Master_Leds_struct
//{
//led_cfg_struct led_cfg; // Main Config
//struct form_Led_Setup_Struct form_cfg[NR_FORM_PARTS]; // the Lines / forms
//CRGBPalette16 LEDS_pal_cur[NR_PALETTS]; //pallets
//};
// Functions
void LEDS_loop();
void LEDS_setup();
void LEDS_G_LoadSAveFade(boolean Save, uint8_t confNr) ;
float LEDS_get_FPS(); // osc.cpp
void LEDS_pal_write(uint8_t pal, uint8_t no, uint8_t color, uint8_t value); // used in config_fs , osc.cpp
void LEDS_pal_write(CRGBPalette16* palref, uint8_t pal, uint8_t no, uint8_t color , uint8_t value);
uint8_t LEDS_pal_read(uint8_t pal, uint8_t no, uint8_t color); // used in config_fs. osc.cpp
uint8_t LEDS_pal_read(CRGBPalette16* palref, uint8_t pal, uint8_t no, uint8_t color);
void LEDS_pal_reset_index(); //osc.cpp
void LEDS_pal_load(deck_struct* deckref, uint8_t pal_no, uint8_t pal_menu) ;
void LEDS_pal_load(CRGBPalette16* palref, uint8_t pal_no, uint8_t pal_menu) ;
void LEDS_clear_all_layers(uint8_t deckSelected);
void LEDS_default_layers(uint8_t deckSelected);
//osc.cpp