Add LED effect when retrying time synchronization

This commit is contained in:
Djuri 2024-12-31 11:51:34 +01:00
parent aea69d54b6
commit b8428e1650
3 changed files with 28 additions and 4 deletions

View file

@ -279,6 +279,7 @@ void syncTime()
while (!getLocalTime(&timeinfo))
{
queueLedEffect(LED_EFFECT_CONFIGURING);
configTime(preferences.getInt("gmtOffset", DEFAULT_TIME_OFFSET_SECONDS), 0,
NTP_SERVER);
delay(500);

View file

@ -333,6 +333,26 @@ void ledTask(void *parameter)
blinkDelayTwoColor(100, 3, pixels.Color(8, 161, 236),
pixels.Color(255, 0, 0));
break;
case LED_EFFECT_CONFIGURING:
for (int i = NEOPIXEL_COUNT; i--; i > 0)
{
for (int j = NEOPIXEL_COUNT; j--; j > 0)
{
uint32_t c = pixels.Color(0, 0, 0);
if (i == j)
c = pixels.Color(0, 0, 255);
pixels.setPixelColor(j, c);
}
pixels.show();
delay(100);
}
pixels.clear();
pixels.show();
break;
case LED_FLASH_ERROR:
blinkDelayColor(250, 3, 255, 0, 0);
break;

View file

@ -18,10 +18,13 @@
const int LED_FLASH_ERROR = 0;
const int LED_FLASH_SUCCESS = 1;
const int LED_FLASH_UPDATE = 2;
const int LED_FLASH_BLOCK_NOTIFY = 3;
const int LED_EFFECT_START_TIMER = 4;
const int LED_EFFECT_PAUSE_TIMER = 5;
const int LED_EFFECT_HEARTBEAT = 6;
const int LED_EFFECT_CONFIGURING = 10;
const int LED_FLASH_BLOCK_NOTIFY = 4;
const int LED_EFFECT_START_TIMER = 5;
const int LED_EFFECT_PAUSE_TIMER = 6;
const int LED_EFFECT_HEARTBEAT = 7;
const int LED_EFFECT_WIFI_WAIT_FOR_CONFIG = 100;
const int LED_EFFECT_WIFI_CONNECTING = 101;
const int LED_EFFECT_WIFI_CONNECT_ERROR = 102;