state tracking for LEDs
This commit is contained in:
parent
c359ecb544
commit
a198ae4225
@ -1,6 +1,7 @@
|
||||
#include "leds.h"
|
||||
#include "led_strip.h"
|
||||
#include <esp_log.h>
|
||||
#include "state_tracking.h"
|
||||
|
||||
static const char* TAG = "leds";
|
||||
|
||||
@ -29,6 +30,13 @@ void init_leds() {
|
||||
|
||||
void led_set(uint32_t led, uint8_t r, uint8_t g, uint8_t b) {
|
||||
led_strip_set_pixel(leds, led, r, g, b);
|
||||
|
||||
if (is_state_tracking()) {
|
||||
char buf[32];
|
||||
uint32_t color = (r << 16) | (g << 8) | b;
|
||||
sprintf(buf, "%ld,%ld", led, color);
|
||||
event_occured("LED_SET", buf);
|
||||
}
|
||||
}
|
||||
|
||||
void led_set(uint32_t led, uint32_t color) {
|
||||
@ -37,9 +45,16 @@ void led_set(uint32_t led, uint32_t color) {
|
||||
|
||||
void leds_flush() {
|
||||
led_strip_refresh(leds);
|
||||
|
||||
if (is_state_tracking()) {
|
||||
event_occured("LED_FLUSH", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void leds_clear()
|
||||
{
|
||||
void leds_clear() {
|
||||
led_strip_clear(leds);
|
||||
|
||||
if (is_state_tracking()) {
|
||||
event_occured("LED_CLR", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user