-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathesp-lights-led-triangles.yaml
More file actions
154 lines (140 loc) · 5.17 KB
/
Copy pathesp-lights-led-triangles.yaml
File metadata and controls
154 lines (140 loc) · 5.17 KB
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
substitutions:
project_name: HST_LED_Art
project_version: v2
esphome:
includes: shared/esp_led_triangles.h
wifi:
enable_btm: true
enable_rrm: true
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
version: 5.3.1
platform_version: 6.9.0
logger:
hardware_uart: UART0
spi:
clk_pin: 3
mosi_pin: 5
light:
- platform: esp32_rmt_led_strip
id: pixel_strip2
name: HST Art Background
chipset: WS2812
pin: 4
num_leds: 1
rgb_order: GRB
- platform: spi_led_strip
id: pixel_strip1
name: HST Art
num_leds: 128
data_rate: 20MHz
effects:
- addressable_rainbow:
- addressable_color_wipe:
- addressable_scan:
- addressable_twinkle:
- addressable_fireworks:
- addressable_flicker:
# - addressable_lambda:
# name: "Fire"
# update_interval: 16ms
# lambda: "esp_led_triangles::hst_fire(it, initial_run, 32);"
- addressable_lambda:
name: "HST Art Patterns"
update_interval: 16ms
lambda: |-
auto brt = id(pixel_strip2).current_values.is_on() ? id(pixel_strip2).current_values.get_brightness() : 0;
uint8_t pRed = id(pixel_strip2).current_values.get_red() * 255;
uint8_t pGreen = id(pixel_strip2).current_values.get_green() * 255;
uint8_t pBlue = id(pixel_strip2).current_values.get_blue() * 255;
esp_led_triangles::hst_art(it, initial_run, 5, esp_led_triangles::MANUAL, current_color, Color(pRed * brt, pGreen * brt, pBlue * brt));
- addressable_lambda:
name: "HST Art Random Color Patterns"
update_interval: 16ms
lambda: |-
esp_led_triangles::hst_art(it, initial_run, 5, esp_led_triangles::RANDOM);
- addressable_lambda:
name: "HST Art Random Rotating Color Patterns"
update_interval: 16ms
lambda: |-
esp_led_triangles::hst_art(it, initial_run, 5, esp_led_triangles::RANDOM_ROTATE);
- addressable_lambda:
name: "Spin"
update_interval: 125ms
lambda: |-
static uint8_t cell = 0, stall = 0;
static Color fill_color(0, 0, 0);
if (initial_run || (stall > 23)) {
cell = 0;
stall = 0;
}
// if (cell > 7) {
// cell = 0;
// fill_color = Color::random_color();
// }
if ((stall < 4) || (stall > 11 && stall < 16)) {
for (uint8_t i = 0; i < 16; i++) {
// update all pixels within the given pixel group as indicated by 'cell'
uint8_t led = esp_led_triangles::hst_cell_origin[i] + esp_led_triangles::hst_cell_offset[cell];
it[esp_led_triangles::m_leds[led]] = fill_color;
}
cell++;
} else {
fill_color = Color::random_color();
}
stall++;
- addressable_lambda:
name: "Fill Grid"
update_interval: 125ms
lambda: |-
static uint8_t cell = 0;
static Color fill_color(0, 0, 0);
if (initial_run || cell >= it.size() - 1) {
if (!initial_run)
it[esp_led_triangles::m_leds[cell]] = fill_color;
cell = 0;
// it.all() = Color::BLACK;
fill_color = Color::random_color();
it[esp_led_triangles::m_leds[cell]] = Color::WHITE;
} else {
it[esp_led_triangles::m_leds[cell++]] = fill_color;
it[esp_led_triangles::m_leds[cell]] = Color::WHITE;
}
# - addressable_lambda:
# name: "TestEffect1"
# update_interval: 16ms
# lambda: |-
# // it.size() - Number of LEDs
# // it[num] - Access the LED at index num.
# // Set the LED at num to the given r, g, b values
# // it[num] = Color(r, g, b);
# // Get the color at index num (Color instance)
# // it[num].get();
# // Example: Simple color wipe
# for (int i = it.size() - 1; i > 0; i--) {
# it[i] = it[i - 1].get();
# }
# it[0] = Color::random_color();
# // Bonus: use .range() and .all() to set many LEDs without having to write a loop.
# it.range(0, 50) = Color::BLACK;
# it.all().fade_to_black(10);
# - addressable_lambda:
# name: "TestEffect2"
# update_interval: 16ms
# lambda: |-
# // Static variables keep their value even when
# // stopping and starting the effect again
# static uint16_t progress = 0;
# // normal variables lose their value after each
# // execution - basically after each update_interval
# uint16_t changes = 0;
# // To reset static when stopping and starting the effect
# // again you can use the initial_run variable
# if (initial_run) {
# progress = 0;
# it.all() = Color::BLACK;
# // optionally do a return so nothing happens until the next update_interval
# return;
# }