feat: add external component and some test configurations

This commit is contained in:
Philip Stark 2023-05-03 20:55:22 +02:00
parent 4c612fc462
commit 5b0930d616
11 changed files with 511 additions and 6 deletions

View file

@ -72,6 +72,7 @@ class Wordclock : public Component, public CustomAPIDevice {
CRGB leds[WORDCLOCK_NUM_LEDS];
int hour = -1;
int minute = -1;
int second = -1;
int red = 124;
int green = 124;
int blue = 124;
@ -83,7 +84,7 @@ class Wordclock : public Component, public CustomAPIDevice {
clear_all_leds();
FastLED.show();
// TODO: Set up some kind of initialization sequence. But it should be based on an effect or similarly supporting the
// cooperative multithreading. delay() calls are uncalled for. ^^
// cooperative multithreading. delay() calls are uncalled for.
}
void clear_all_leds() {
@ -195,16 +196,21 @@ class Wordclock : public Component, public CustomAPIDevice {
if (fastledlight2.get_state() > 0 ) {
brightness = (int) (fastledlight2.get_brightness()*125);
} else {
ESP_LOGD("loop", "fastledlight state off - b: %i rgb %i %i %i", brightness, red, green, blue); delay(100);
// ESP_LOGD("loop", "fastledlight state off - b: %i rgb %i %i %i", brightness, red, green, blue); delay(100);
}
FastLED.setBrightness(brightness);
FastLED.show();
//check if valid time. Blink red,green,blue until valid time is present
if (!time.is_valid() == false) {
if (time.is_valid() == false) {
ESP_LOGD("loop", "time is not valid");
// do something to show that the clock isn't dead. Maybe I can instantiate and effect and use that for this.
}
else {
if (time.second != second) {
second = time.second;
ESP_LOGD("loop", "time is now [%02i:%02i:%02i]", time.hour, time.minute, time.second);
}
if(time.hour != hour || time.minute != minute) {
hour = time.hour;
minute = time.minute;