|
26 | 26 | console_esp32::console_esp32(kek_event_t *const stop_event, comm *const io_port, const int t_width, const int t_height) : |
27 | 27 | console_comm(stop_event, io_port, t_width, t_height) |
28 | 28 | { |
| 29 | +#if defined(WAVESHARE_S3_ETH) |
| 30 | + rgb_led.begin(); |
| 31 | + rgb_led.setBrightness(50); |
| 32 | +#endif |
29 | 33 | } |
30 | 34 |
|
31 | 35 | console_esp32::~console_esp32() |
@@ -188,22 +192,24 @@ void console_esp32::panel_update_thread() |
188 | 192 |
|
189 | 193 | pixels.clear(); |
190 | 194 | pixels.show(); |
191 | | -#elif defined(HEARTBEAT_PIN) && !defined(WAVESHARE_S3_ETH) |
192 | | - uint64_t prev_count = 0; |
193 | | - bool led_state = true; |
194 | | - |
195 | | - while(!stop_panel) { |
196 | | - vTaskDelay(333 / portTICK_PERIOD_MS); |
| 195 | +#endif |
197 | 196 |
|
198 | | - uint64_t current_count = c->get_trap_counter(); |
199 | | - if (prev_count != current_count) { |
200 | | - prev_count = current_count; |
| 197 | + DOLOG(info, false, "panel task terminating"); |
| 198 | +} |
201 | 199 |
|
202 | | - digitalWrite(HEARTBEAT_PIN, led_state ? HIGH : LOW); |
203 | | - led_state = !led_state; |
204 | | - } |
205 | | - } |
| 200 | +void console_esp32::set_LED_state(const bool state) |
| 201 | +{ |
| 202 | +#if defined(WAVESHARE_S3_ETH) |
| 203 | + uint8_t brightness = state ? 255 : 0; |
| 204 | + rgb_led.setPixelColor(0, brightness, brightness, brightness); |
| 205 | + rgb_led.show(); |
| 206 | +#else |
| 207 | + digitalWrite(HEARTBEAT_PIN, state); |
206 | 208 | #endif |
| 209 | + prev_led_state = state; |
| 210 | +} |
207 | 211 |
|
208 | | - DOLOG(info, false, "panel task terminating"); |
| 212 | +void console_esp32::toggle_LED_state() |
| 213 | +{ |
| 214 | + set_LED_state(!prev_led_state); |
209 | 215 | } |
0 commit comments