🚨 Updates led service to show isConnected
This commit is contained in:
@@ -200,6 +200,9 @@ void ESP32SvelteKit::startServices() {
|
|||||||
|
|
||||||
void IRAM_ATTR ESP32SvelteKit::loop() {
|
void IRAM_ATTR ESP32SvelteKit::loop() {
|
||||||
while (1) {
|
while (1) {
|
||||||
|
#if FT_ENABLED(FT_WS2812)
|
||||||
|
_ledService.loop();
|
||||||
|
#endif
|
||||||
_wifiSettingsService.loop();
|
_wifiSettingsService.loop();
|
||||||
_apSettingsService.loop();
|
_apSettingsService.loop();
|
||||||
#if FT_ENABLED(FT_ANALYTICS)
|
#if FT_ENABLED(FT_ANALYTICS)
|
||||||
@@ -207,9 +210,6 @@ void IRAM_ATTR ESP32SvelteKit::loop() {
|
|||||||
#endif
|
#endif
|
||||||
#if FT_ENABLED(FT_BATTERY)
|
#if FT_ENABLED(FT_BATTERY)
|
||||||
_batteryService.loop();
|
_batteryService.loop();
|
||||||
#endif
|
|
||||||
#if FT_ENABLED(FT_WS2812)
|
|
||||||
_ledService.loop();
|
|
||||||
#endif
|
#endif
|
||||||
_peripherals.loop();
|
_peripherals.loop();
|
||||||
delay(20);
|
delay(20);
|
||||||
|
|||||||
@@ -41,13 +41,17 @@ class LEDService {
|
|||||||
if (_brightness >= 200) direction = -5;
|
if (_brightness >= 200) direction = -5;
|
||||||
if (_brightness <= 50) direction = 5;
|
if (_brightness <= 50) direction = 5;
|
||||||
_brightness += direction;
|
_brightness += direction;
|
||||||
fillFromPallette(0);
|
if (WiFi.isConnected()) {
|
||||||
|
fillFromPallette(OceanColors_p, 0);
|
||||||
|
} else {
|
||||||
|
fillFromPallette(ForestColors_p, 128);
|
||||||
|
}
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillFromPallette(uint8_t colorIndex) {
|
void fillFromPallette(CRGBPalette16 colorPalette, uint8_t colorIndex) {
|
||||||
CRGB color = ColorFromPalette(currentPalette, colorIndex, _brightness, currentBlending);
|
CRGB color = ColorFromPalette(colorPalette, colorIndex, _brightness, currentBlending);
|
||||||
for (int i = 0; i < WS2812_NUM_LEDS; ++i) {
|
for (int i = 0; i < WS2812_NUM_LEDS; ++i) {
|
||||||
leds[i] = color;
|
leds[i] = color;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user