forked from btclock/btclock_v3
Web UI improvements, better frontlight functionality
This commit is contained in:
parent
32e40e2cb7
commit
9ede0f4dc3
7 changed files with 477 additions and 211 deletions
2
data
2
data
|
@ -1 +1 @@
|
||||||
Subproject commit 6ecb4826000e4a34f22d98541d28448f844340f7
|
Subproject commit e859adac8631c6380a6a3f8b20b118a5531d4f8c
|
|
@ -148,7 +148,7 @@ void onWebsocketBlockMessage(esp_websocket_event_data_t *event_data)
|
||||||
filter["block"]["height"] = true;
|
filter["block"]["height"] = true;
|
||||||
filter["mempool-blocks"][0]["medianFee"] = true;
|
filter["mempool-blocks"][0]["medianFee"] = true;
|
||||||
|
|
||||||
DeserializationError error = deserializeJson(doc, (char *)event_data->data_ptr, DeserializationOption::Filter(filter));
|
deserializeJson(doc, (char *)event_data->data_ptr, DeserializationOption::Filter(filter));
|
||||||
|
|
||||||
// if (error) {
|
// if (error) {
|
||||||
// Serial.print("deserializeJson() failed: ");
|
// Serial.print("deserializeJson() failed: ");
|
||||||
|
|
|
@ -67,6 +67,14 @@ void setup()
|
||||||
setupOTA();
|
setupOTA();
|
||||||
|
|
||||||
waitUntilNoneBusy();
|
waitUntilNoneBusy();
|
||||||
|
|
||||||
|
#ifdef HAS_FRONTLIGHT
|
||||||
|
if (!preferences.getBool("flAlwaysOn", false)) {
|
||||||
|
frontlightFadeOutAll(preferences.getUInt("flEffectDelay"), true);
|
||||||
|
flArray.allOFF();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
forceFullRefresh();
|
forceFullRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,15 +720,17 @@ void setupFrontlight()
|
||||||
{
|
{
|
||||||
preferences.putUInt("flMaxBrightness", 2048);
|
preferences.putUInt("flMaxBrightness", 2048);
|
||||||
}
|
}
|
||||||
|
if (!preferences.isKey("flEffectDelay"))
|
||||||
if (preferences.getBool("flAlwaysOn", false)) {
|
{
|
||||||
Serial.println(F("FL Always on"));
|
preferences.putUInt("flEffectDelay", 5);
|
||||||
|
|
||||||
frontlightFadeInAll();
|
|
||||||
} else {
|
|
||||||
Serial.println(F("FL all off"));
|
|
||||||
flArray.allOFF();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!preferences.isKey("flFlashOnUpd"))
|
||||||
|
{
|
||||||
|
preferences.putBool("flFlashOnUpd", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
frontlightFadeInAll(preferences.getUInt("flEffectDelay"), true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -5,138 +5,357 @@ QueueHandle_t ledTaskQueue = NULL;
|
||||||
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
|
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
|
||||||
uint ledTaskParams;
|
uint ledTaskParams;
|
||||||
|
|
||||||
void ledTask(void *parameter) {
|
#ifdef HAS_FRONTLIGHT
|
||||||
while (1) {
|
#define FL_FADE_STEP 50
|
||||||
if (ledTaskQueue != NULL) {
|
|
||||||
if (xQueueReceive(ledTaskQueue, &ledTaskParams, portMAX_DELAY) ==
|
|
||||||
pdPASS) {
|
|
||||||
|
|
||||||
if (preferences.getBool("disableLeds", false)) {
|
bool frontlightOn = false;
|
||||||
|
bool flInTransition = false;
|
||||||
|
|
||||||
|
void frontlightFlash(int flDelayTime)
|
||||||
|
{
|
||||||
|
if (frontlightOn)
|
||||||
|
{
|
||||||
|
frontlightFadeOutAll(flDelayTime);
|
||||||
|
frontlightFadeInAll(flDelayTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frontlightFadeInAll(flDelayTime);
|
||||||
|
frontlightFadeOutAll(flDelayTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeInAll()
|
||||||
|
{
|
||||||
|
frontlightFadeInAll(preferences.getUInt("flEffectDelay"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeOutAll()
|
||||||
|
{
|
||||||
|
frontlightFadeOutAll(preferences.getUInt("flEffectDelay"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeIn(uint num)
|
||||||
|
{
|
||||||
|
frontlightFadeIn(num, preferences.getUInt("flEffectDelay"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeOut(uint num)
|
||||||
|
{
|
||||||
|
frontlightFadeOut(num, preferences.getUInt("flEffectDelay"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightSetBrightness(uint brightness)
|
||||||
|
{
|
||||||
|
if (brightness > 4096)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++)
|
||||||
|
{
|
||||||
|
flArray.setPWM(ledPin, 0, brightness);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeInAll(int flDelayTime)
|
||||||
|
{
|
||||||
|
frontlightFadeInAll(flDelayTime, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeInAll(int flDelayTime, bool staggered)
|
||||||
|
{
|
||||||
|
if (flInTransition)
|
||||||
|
return;
|
||||||
|
|
||||||
|
flInTransition = true;
|
||||||
|
|
||||||
|
if (staggered)
|
||||||
|
{
|
||||||
|
int maxBrightness = preferences.getUInt("flMaxBrightness");
|
||||||
|
int step = FL_FADE_STEP;
|
||||||
|
int staggerDelay = flDelayTime / NUM_SCREENS;
|
||||||
|
|
||||||
|
for (int dutyCycle = 0; dutyCycle <= maxBrightness + (NUM_SCREENS - 1) * maxBrightness / NUM_SCREENS; dutyCycle += step)
|
||||||
|
{
|
||||||
|
for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++)
|
||||||
|
{
|
||||||
|
int ledBrightness = dutyCycle - ledPin * maxBrightness / NUM_SCREENS;
|
||||||
|
if (ledBrightness < 0)
|
||||||
|
ledBrightness = 0;
|
||||||
|
else if (ledBrightness > maxBrightness)
|
||||||
|
ledBrightness = maxBrightness;
|
||||||
|
|
||||||
|
flArray.setPWM(ledPin + 1, 0, ledBrightness);
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(staggerDelay));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += FL_FADE_STEP)
|
||||||
|
{
|
||||||
|
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++)
|
||||||
|
{
|
||||||
|
flArray.setPWM(ledPin, 0, dutyCycle);
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frontlightOn = true;
|
||||||
|
flInTransition = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeOutAll(int flDelayTime)
|
||||||
|
{
|
||||||
|
frontlightFadeOutAll(flDelayTime, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeOutAll(int flDelayTime, bool staggered)
|
||||||
|
{
|
||||||
|
if (flInTransition)
|
||||||
|
return;
|
||||||
|
flInTransition = true;
|
||||||
|
|
||||||
|
if (staggered)
|
||||||
|
{
|
||||||
|
int maxBrightness = preferences.getUInt("flMaxBrightness");
|
||||||
|
int step = FL_FADE_STEP;
|
||||||
|
int staggerDelay = flDelayTime / NUM_SCREENS;
|
||||||
|
|
||||||
|
for (int dutyCycle = maxBrightness; dutyCycle >= 0; dutyCycle -= step)
|
||||||
|
{
|
||||||
|
for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++)
|
||||||
|
{
|
||||||
|
int ledBrightness = dutyCycle - (NUM_SCREENS - 1 - ledPin) * maxBrightness / NUM_SCREENS;
|
||||||
|
if (ledBrightness < 0)
|
||||||
|
ledBrightness = 0;
|
||||||
|
else if (ledBrightness > maxBrightness)
|
||||||
|
ledBrightness = maxBrightness;
|
||||||
|
|
||||||
|
flArray.setPWM(ledPin + 1, 0, ledBrightness);
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(staggerDelay));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int dutyCycle = preferences.getUInt("flMaxBrightness"); dutyCycle >= 0; dutyCycle -= FL_FADE_STEP)
|
||||||
|
{
|
||||||
|
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++)
|
||||||
|
{
|
||||||
|
flArray.setPWM(ledPin, 0, dutyCycle);
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flArray.allOFF();
|
||||||
|
frontlightOn = false;
|
||||||
|
flInTransition = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeIn(uint num, int flDelayTime)
|
||||||
|
{
|
||||||
|
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5)
|
||||||
|
{
|
||||||
|
flArray.setPWM(num, 0, dutyCycle);
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void frontlightFadeOut(uint num, int flDelayTime)
|
||||||
|
{
|
||||||
|
for (int dutyCycle = preferences.getUInt("flMaxBrightness"); dutyCycle >= 0; dutyCycle -= 5)
|
||||||
|
{
|
||||||
|
flArray.setPWM(num, 0, dutyCycle);
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ledTask(void *parameter)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (ledTaskQueue != NULL)
|
||||||
|
{
|
||||||
|
if (xQueueReceive(ledTaskQueue, &ledTaskParams, portMAX_DELAY) ==
|
||||||
|
pdPASS)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (preferences.getBool("disableLeds", false))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t oldLights[NEOPIXEL_COUNT];
|
uint32_t oldLights[NEOPIXEL_COUNT];
|
||||||
|
|
||||||
// get current state
|
// get current state
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
oldLights[i] = pixels.getPixelColor(i);
|
oldLights[i] = pixels.getPixelColor(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ledTaskParams) {
|
switch (ledTaskParams)
|
||||||
case LED_POWER_TEST:
|
{
|
||||||
ledRainbow(20);
|
case LED_POWER_TEST:
|
||||||
pixels.clear();
|
ledRainbow(20);
|
||||||
break;
|
pixels.clear();
|
||||||
case LED_EFFECT_WIFI_CONNECT_ERROR:
|
break;
|
||||||
blinkDelayTwoColor(100, 3, pixels.Color(8, 161, 236),
|
case LED_EFFECT_WIFI_CONNECT_ERROR:
|
||||||
pixels.Color(255, 0, 0));
|
blinkDelayTwoColor(100, 3, pixels.Color(8, 161, 236),
|
||||||
break;
|
pixels.Color(255, 0, 0));
|
||||||
case LED_FLASH_ERROR:
|
break;
|
||||||
blinkDelayColor(250, 3, 255, 0, 0);
|
case LED_FLASH_ERROR:
|
||||||
break;
|
blinkDelayColor(250, 3, 255, 0, 0);
|
||||||
case LED_EFFECT_HEARTBEAT:
|
break;
|
||||||
blinkDelayColor(150, 2, 0, 0, 255);
|
case LED_EFFECT_HEARTBEAT:
|
||||||
break;
|
blinkDelayColor(150, 2, 0, 0, 255);
|
||||||
case LED_DATA_BLOCK_ERROR:
|
break;
|
||||||
blinkDelayColor(150, 2, 128, 0, 128);
|
case LED_DATA_BLOCK_ERROR:
|
||||||
break;
|
blinkDelayColor(150, 2, 128, 0, 128);
|
||||||
case LED_DATA_PRICE_ERROR:
|
break;
|
||||||
blinkDelayColor(150, 2, 177, 90, 31);
|
case LED_DATA_PRICE_ERROR:
|
||||||
break;
|
blinkDelayColor(150, 2, 177, 90, 31);
|
||||||
case LED_FLASH_IDENTIFY:
|
break;
|
||||||
blinkDelayTwoColor(100, 2, pixels.Color(255, 0, 0),
|
case LED_FLASH_IDENTIFY:
|
||||||
pixels.Color(0, 255, 255));
|
blinkDelayTwoColor(100, 2, pixels.Color(255, 0, 0),
|
||||||
blinkDelayTwoColor(100, 2, pixels.Color(0, 255, 0),
|
pixels.Color(0, 255, 255));
|
||||||
pixels.Color(0, 0, 255));
|
blinkDelayTwoColor(100, 2, pixels.Color(0, 255, 0),
|
||||||
break;
|
pixels.Color(0, 0, 255));
|
||||||
case LED_EFFECT_WIFI_CONNECT_SUCCESS:
|
break;
|
||||||
case LED_FLASH_SUCCESS:
|
case LED_EFFECT_WIFI_CONNECT_SUCCESS:
|
||||||
blinkDelayColor(150, 3, 0, 255, 0);
|
case LED_FLASH_SUCCESS:
|
||||||
break;
|
blinkDelayColor(150, 3, 0, 255, 0);
|
||||||
case LED_PROGRESS_100:
|
break;
|
||||||
pixels.setPixelColor(0, pixels.Color(0, 255, 0));
|
case LED_PROGRESS_100:
|
||||||
case LED_PROGRESS_75:
|
pixels.setPixelColor(0, pixels.Color(0, 255, 0));
|
||||||
pixels.setPixelColor(1, pixels.Color(0, 255, 0));
|
case LED_PROGRESS_75:
|
||||||
case LED_PROGRESS_50:
|
pixels.setPixelColor(1, pixels.Color(0, 255, 0));
|
||||||
pixels.setPixelColor(2, pixels.Color(0, 255, 0));
|
case LED_PROGRESS_50:
|
||||||
case LED_PROGRESS_25:
|
pixels.setPixelColor(2, pixels.Color(0, 255, 0));
|
||||||
pixels.setPixelColor(3, pixels.Color(0, 255, 0));
|
case LED_PROGRESS_25:
|
||||||
pixels.show();
|
pixels.setPixelColor(3, pixels.Color(0, 255, 0));
|
||||||
break;
|
pixels.show();
|
||||||
case LED_FLASH_UPDATE:
|
break;
|
||||||
break;
|
case LED_FLASH_UPDATE:
|
||||||
case LED_FLASH_BLOCK_NOTIFY:
|
break;
|
||||||
blinkDelayTwoColor(250, 3, pixels.Color(224, 67, 0),
|
case LED_FLASH_BLOCK_NOTIFY:
|
||||||
pixels.Color(8, 2, 0));
|
{
|
||||||
break;
|
#ifdef HAS_FRONTLIGHT
|
||||||
case LED_EFFECT_WIFI_WAIT_FOR_CONFIG:
|
bool frontlightWasOn = false;
|
||||||
blinkDelayTwoColor(100, 1, pixels.Color(8, 161, 236),
|
|
||||||
pixels.Color(156, 225, 240));
|
if (preferences.getBool("flFlashOnUpd", false))
|
||||||
break;
|
{
|
||||||
case LED_EFFECT_WIFI_ERASE_SETTINGS:
|
if (frontlightOn)
|
||||||
blinkDelay(100, 3);
|
{
|
||||||
break;
|
frontlightWasOn = true;
|
||||||
case LED_EFFECT_WIFI_CONNECTING:
|
frontlightFadeOutAll(1);
|
||||||
for (int i = NEOPIXEL_COUNT; i >= 0; i--) {
|
|
||||||
for (int j = NEOPIXEL_COUNT; j >= 0; j--) {
|
|
||||||
if (j == i) {
|
|
||||||
pixels.setPixelColor(i, pixels.Color(16, 197, 236));
|
|
||||||
} else {
|
|
||||||
pixels.setPixelColor(j, pixels.Color(0, 0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pixels.show();
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(100));
|
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
case LED_EFFECT_PAUSE_TIMER:
|
{
|
||||||
for (int i = NEOPIXEL_COUNT; i >= 0; i--) {
|
frontlightFadeInAll(1);
|
||||||
for (int j = NEOPIXEL_COUNT; j >= 0; j--) {
|
|
||||||
uint32_t c = pixels.Color(0, 0, 0);
|
|
||||||
if (i == j) c = pixels.Color(0, 255, 0);
|
|
||||||
pixels.setPixelColor(j, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
pixels.show();
|
|
||||||
|
|
||||||
delay(100);
|
|
||||||
}
|
}
|
||||||
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
}
|
||||||
pixels.show();
|
#endif
|
||||||
|
blinkDelayTwoColor(250, 3, pixels.Color(224, 67, 0),
|
||||||
delay(900);
|
pixels.Color(8, 2, 0));
|
||||||
|
#ifdef HAS_FRONTLIGHT
|
||||||
pixels.clear();
|
if (preferences.getBool("flFlashOnUpd", false))
|
||||||
pixels.show();
|
{
|
||||||
break;
|
if (frontlightWasOn)
|
||||||
case LED_EFFECT_START_TIMER:
|
{
|
||||||
pixels.clear();
|
frontlightFadeInAll(1);
|
||||||
pixels.setPixelColor((NEOPIXEL_COUNT - 1), pixels.Color(255, 0, 0));
|
}
|
||||||
pixels.show();
|
else
|
||||||
|
{
|
||||||
delay(900);
|
frontlightFadeOutAll(1);
|
||||||
|
}
|
||||||
for (int i = NEOPIXEL_COUNT; i--; i > 0) {
|
}
|
||||||
for (int j = NEOPIXEL_COUNT; j--; j > 0) {
|
#endif
|
||||||
uint32_t c = pixels.Color(0, 0, 0);
|
break;
|
||||||
if (i == j) c = pixels.Color(0, 255, 0);
|
}
|
||||||
|
case LED_EFFECT_WIFI_WAIT_FOR_CONFIG:
|
||||||
pixels.setPixelColor(j, c);
|
blinkDelayTwoColor(100, 1, pixels.Color(8, 161, 236),
|
||||||
|
pixels.Color(156, 225, 240));
|
||||||
|
break;
|
||||||
|
case LED_EFFECT_WIFI_ERASE_SETTINGS:
|
||||||
|
blinkDelay(100, 3);
|
||||||
|
break;
|
||||||
|
case LED_EFFECT_WIFI_CONNECTING:
|
||||||
|
for (int i = NEOPIXEL_COUNT; i >= 0; i--)
|
||||||
|
{
|
||||||
|
for (int j = NEOPIXEL_COUNT; j >= 0; j--)
|
||||||
|
{
|
||||||
|
if (j == i)
|
||||||
|
{
|
||||||
|
pixels.setPixelColor(i, pixels.Color(16, 197, 236));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
pixels.show();
|
{
|
||||||
|
pixels.setPixelColor(j, pixels.Color(0, 0, 0));
|
||||||
delay(100);
|
}
|
||||||
|
}
|
||||||
|
pixels.show();
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LED_EFFECT_PAUSE_TIMER:
|
||||||
|
for (int i = NEOPIXEL_COUNT; i >= 0; i--)
|
||||||
|
{
|
||||||
|
for (int j = NEOPIXEL_COUNT; j >= 0; j--)
|
||||||
|
{
|
||||||
|
uint32_t c = pixels.Color(0, 0, 0);
|
||||||
|
if (i == j)
|
||||||
|
c = pixels.Color(0, 255, 0);
|
||||||
|
pixels.setPixelColor(j, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
pixels.clear();
|
|
||||||
pixels.show();
|
pixels.show();
|
||||||
break;
|
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
|
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
||||||
|
pixels.show();
|
||||||
|
|
||||||
|
delay(900);
|
||||||
|
|
||||||
|
pixels.clear();
|
||||||
|
pixels.show();
|
||||||
|
break;
|
||||||
|
case LED_EFFECT_START_TIMER:
|
||||||
|
pixels.clear();
|
||||||
|
pixels.setPixelColor((NEOPIXEL_COUNT - 1), pixels.Color(255, 0, 0));
|
||||||
|
pixels.show();
|
||||||
|
|
||||||
|
delay(900);
|
||||||
|
|
||||||
|
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, 255, 0);
|
||||||
|
|
||||||
|
pixels.setPixelColor(j, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixels.show();
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixels.clear();
|
||||||
|
pixels.show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// revert to previous state unless power test
|
// revert to previous state unless power test
|
||||||
|
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(i, oldLights[i]);
|
pixels.setPixelColor(i, oldLights[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,14 +365,17 @@ void ledTask(void *parameter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupLeds() {
|
void setupLeds()
|
||||||
|
{
|
||||||
pixels.begin();
|
pixels.begin();
|
||||||
pixels.setBrightness(preferences.getUInt("ledBrightness", 128));
|
pixels.setBrightness(preferences.getUInt("ledBrightness", 128));
|
||||||
pixels.clear();
|
pixels.clear();
|
||||||
pixels.show();
|
pixels.show();
|
||||||
setupLedTask();
|
setupLedTask();
|
||||||
if (preferences.getBool("ledTestOnPower", true)) {
|
if (preferences.getBool("ledTestOnPower", true))
|
||||||
while (!ledTaskQueue) {
|
{
|
||||||
|
while (!ledTaskQueue)
|
||||||
|
{
|
||||||
delay(1);
|
delay(1);
|
||||||
// wait until queue is available
|
// wait until queue is available
|
||||||
}
|
}
|
||||||
|
@ -161,14 +383,17 @@ void setupLeds() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupLedTask() {
|
void setupLedTask()
|
||||||
|
{
|
||||||
ledTaskQueue = xQueueCreate(5, sizeof(uint));
|
ledTaskQueue = xQueueCreate(5, sizeof(uint));
|
||||||
|
|
||||||
xTaskCreate(ledTask, "LedTask", 2048, NULL, tskIDLE_PRIORITY, &ledTaskHandle);
|
xTaskCreate(ledTask, "LedTask", 2048, NULL, 10, &ledTaskHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blinkDelay(int d, int times) {
|
void blinkDelay(int d, int times)
|
||||||
for (int j = 0; j < times; j++) {
|
{
|
||||||
|
for (int j = 0; j < times; j++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
|
||||||
pixels.setPixelColor(1, pixels.Color(0, 255, 0));
|
pixels.setPixelColor(1, pixels.Color(0, 255, 0));
|
||||||
pixels.setPixelColor(2, pixels.Color(255, 0, 0));
|
pixels.setPixelColor(2, pixels.Color(255, 0, 0));
|
||||||
|
@ -187,9 +412,12 @@ void blinkDelay(int d, int times) {
|
||||||
pixels.show();
|
pixels.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void blinkDelayColor(int d, int times, uint r, uint g, uint b) {
|
void blinkDelayColor(int d, int times, uint r, uint g, uint b)
|
||||||
for (int j = 0; j < times; j++) {
|
{
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int j = 0; j < times; j++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(i, pixels.Color(r, g, b));
|
pixels.setPixelColor(i, pixels.Color(r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,15 +432,19 @@ void blinkDelayColor(int d, int times, uint r, uint g, uint b) {
|
||||||
pixels.show();
|
pixels.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void blinkDelayTwoColor(int d, int times, uint32_t c1, uint32_t c2) {
|
void blinkDelayTwoColor(int d, int times, uint32_t c1, uint32_t c2)
|
||||||
for (int j = 0; j < times; j++) {
|
{
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int j = 0; j < times; j++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(i, c1);
|
pixels.setPixelColor(i, c1);
|
||||||
}
|
}
|
||||||
pixels.show();
|
pixels.show();
|
||||||
vTaskDelay(pdMS_TO_TICKS(d));
|
vTaskDelay(pdMS_TO_TICKS(d));
|
||||||
|
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(i, c2);
|
pixels.setPixelColor(i, c2);
|
||||||
}
|
}
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
@ -222,7 +454,8 @@ void blinkDelayTwoColor(int d, int times, uint32_t c1, uint32_t c2) {
|
||||||
pixels.show();
|
pixels.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearLeds() {
|
void clearLeds()
|
||||||
|
{
|
||||||
preferences.putBool("ledStatus", false);
|
preferences.putBool("ledStatus", false);
|
||||||
pixels.clear();
|
pixels.clear();
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
@ -230,24 +463,31 @@ void clearLeds() {
|
||||||
|
|
||||||
void setLights(int r, int g, int b) { setLights(pixels.Color(r, g, b)); }
|
void setLights(int r, int g, int b) { setLights(pixels.Color(r, g, b)); }
|
||||||
|
|
||||||
void setLights(uint32_t color) {
|
void setLights(uint32_t color)
|
||||||
|
{
|
||||||
bool ledStatus = true;
|
bool ledStatus = true;
|
||||||
|
|
||||||
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
pixels.setPixelColor(i, color);
|
pixels.setPixelColor(i, color);
|
||||||
}
|
}
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
|
||||||
if (color == pixels.Color(0, 0, 0)) {
|
if (color == pixels.Color(0, 0, 0))
|
||||||
|
{
|
||||||
ledStatus = false;
|
ledStatus = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
saveLedState();
|
saveLedState();
|
||||||
}
|
}
|
||||||
preferences.putBool("ledStatus", ledStatus);
|
preferences.putBool("ledStatus", ledStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveLedState() {
|
void saveLedState()
|
||||||
for (int i = 0; i < pixels.numPixels(); i++) {
|
{
|
||||||
|
for (int i = 0; i < pixels.numPixels(); i++)
|
||||||
|
{
|
||||||
int pixelColor = pixels.getPixelColor(i);
|
int pixelColor = pixels.getPixelColor(i);
|
||||||
char key[12];
|
char key[12];
|
||||||
snprintf(key, 12, "%s%d", "ledColor_", i);
|
snprintf(key, 12, "%s%d", "ledColor_", i);
|
||||||
|
@ -257,8 +497,10 @@ void saveLedState() {
|
||||||
xTaskNotifyGive(eventSourceTaskHandle);
|
xTaskNotifyGive(eventSourceTaskHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreLedState() {
|
void restoreLedState()
|
||||||
for (int i = 0; i < pixels.numPixels(); i++) {
|
{
|
||||||
|
for (int i = 0; i < pixels.numPixels(); i++)
|
||||||
|
{
|
||||||
char key[12];
|
char key[12];
|
||||||
snprintf(key, 12, "%s%d", "ledColor_", i);
|
snprintf(key, 12, "%s%d", "ledColor_", i);
|
||||||
uint pixelColor = preferences.getUInt(key, pixels.Color(0, 0, 0));
|
uint pixelColor = preferences.getUInt(key, pixels.Color(0, 0, 0));
|
||||||
|
@ -270,8 +512,10 @@ void restoreLedState() {
|
||||||
|
|
||||||
QueueHandle_t getLedTaskQueue() { return ledTaskQueue; }
|
QueueHandle_t getLedTaskQueue() { return ledTaskQueue; }
|
||||||
|
|
||||||
bool queueLedEffect(uint effect) {
|
bool queueLedEffect(uint effect)
|
||||||
if (ledTaskQueue == NULL) {
|
{
|
||||||
|
if (ledTaskQueue == NULL)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,13 +523,15 @@ bool queueLedEffect(uint effect) {
|
||||||
xQueueSend(ledTaskQueue, &flashType, portMAX_DELAY);
|
xQueueSend(ledTaskQueue, &flashType, portMAX_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ledRainbow(int wait) {
|
void ledRainbow(int wait)
|
||||||
|
{
|
||||||
// Hue of first pixel runs 5 complete loops through the color wheel.
|
// Hue of first pixel runs 5 complete loops through the color wheel.
|
||||||
// Color wheel has a range of 65536 but it's OK if we roll over, so
|
// Color wheel has a range of 65536 but it's OK if we roll over, so
|
||||||
// just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
|
// just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
|
||||||
// means we'll make 5*65536/256 = 1280 passes through this loop:
|
// means we'll make 5*65536/256 = 1280 passes through this loop:
|
||||||
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536;
|
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536;
|
||||||
firstPixelHue += 256) {
|
firstPixelHue += 256)
|
||||||
|
{
|
||||||
// strip.rainbow() can take a single argument (first pixel hue) or
|
// strip.rainbow() can take a single argument (first pixel hue) or
|
||||||
// optionally a few extras: number of rainbow repetitions (default 1),
|
// optionally a few extras: number of rainbow repetitions (default 1),
|
||||||
// saturation and value (brightness) (both 0-255, similar to the
|
// saturation and value (brightness) (both 0-255, similar to the
|
||||||
|
@ -294,83 +540,53 @@ void ledRainbow(int wait) {
|
||||||
pixels.rainbow(firstPixelHue);
|
pixels.rainbow(firstPixelHue);
|
||||||
// Above line is equivalent to:
|
// Above line is equivalent to:
|
||||||
// strip.rainbow(firstPixelHue, 1, 255, 255, true);
|
// strip.rainbow(firstPixelHue, 1, 255, 255, true);
|
||||||
pixels.show(); // Update strip with new contents
|
pixels.show(); // Update strip with new contents
|
||||||
delayMicroseconds(wait);
|
delayMicroseconds(wait);
|
||||||
// vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
// vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ledTheaterChase(uint32_t color, int wait) {
|
void ledTheaterChase(uint32_t color, int wait)
|
||||||
for (int a = 0; a < 10; a++) { // Repeat 10 times...
|
{
|
||||||
for (int b = 0; b < 3; b++) { // 'b' counts from 0 to 2...
|
for (int a = 0; a < 10; a++)
|
||||||
pixels.clear(); // Set all pixels in RAM to 0 (off)
|
{ // Repeat 10 times...
|
||||||
|
for (int b = 0; b < 3; b++)
|
||||||
|
{ // 'b' counts from 0 to 2...
|
||||||
|
pixels.clear(); // Set all pixels in RAM to 0 (off)
|
||||||
// 'c' counts up from 'b' to end of strip in steps of 3...
|
// 'c' counts up from 'b' to end of strip in steps of 3...
|
||||||
for (int c = b; c < pixels.numPixels(); c += 3) {
|
for (int c = b; c < pixels.numPixels(); c += 3)
|
||||||
pixels.setPixelColor(c, color); // Set pixel 'c' to value 'color'
|
{
|
||||||
|
pixels.setPixelColor(c, color); // Set pixel 'c' to value 'color'
|
||||||
}
|
}
|
||||||
pixels.show(); // Update strip with new contents
|
pixels.show(); // Update strip with new contents
|
||||||
vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ledTheaterChaseRainbow(int wait) {
|
void ledTheaterChaseRainbow(int wait)
|
||||||
int firstPixelHue = 0; // First pixel starts at red (hue 0)
|
{
|
||||||
for (int a = 0; a < 30; a++) { // Repeat 30 times...
|
int firstPixelHue = 0; // First pixel starts at red (hue 0)
|
||||||
for (int b = 0; b < 3; b++) { // 'b' counts from 0 to 2...
|
for (int a = 0; a < 30; a++)
|
||||||
pixels.clear(); // Set all pixels in RAM to 0 (off)
|
{ // Repeat 30 times...
|
||||||
|
for (int b = 0; b < 3; b++)
|
||||||
|
{ // 'b' counts from 0 to 2...
|
||||||
|
pixels.clear(); // Set all pixels in RAM to 0 (off)
|
||||||
// 'c' counts up from 'b' to end of strip in increments of 3...
|
// 'c' counts up from 'b' to end of strip in increments of 3...
|
||||||
for (int c = b; c < pixels.numPixels(); c += 3) {
|
for (int c = b; c < pixels.numPixels(); c += 3)
|
||||||
|
{
|
||||||
// hue of pixel 'c' is offset by an amount to make one full
|
// hue of pixel 'c' is offset by an amount to make one full
|
||||||
// revolution of the color wheel (range 65536) along the length
|
// revolution of the color wheel (range 65536) along the length
|
||||||
// of the strip (strip.numPixels() steps):
|
// of the strip (strip.numPixels() steps):
|
||||||
int hue = firstPixelHue + c * 65536L / pixels.numPixels();
|
int hue = firstPixelHue + c * 65536L / pixels.numPixels();
|
||||||
uint32_t color = pixels.gamma32(pixels.ColorHSV(hue)); // hue -> RGB
|
uint32_t color = pixels.gamma32(pixels.ColorHSV(hue)); // hue -> RGB
|
||||||
pixels.setPixelColor(c, color); // Set pixel 'c' to value 'color'
|
pixels.setPixelColor(c, color); // Set pixel 'c' to value 'color'
|
||||||
}
|
}
|
||||||
pixels.show(); // Update strip with new contents
|
pixels.show(); // Update strip with new contents
|
||||||
vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
vTaskDelay(pdMS_TO_TICKS(wait)); // Pause for a moment
|
||||||
firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
|
firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Adafruit_NeoPixel getPixels() { return pixels; }
|
Adafruit_NeoPixel getPixels() { return pixels; }
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
|
||||||
int flDelayTime = 5;
|
|
||||||
|
|
||||||
void frontlightFadeInAll() {
|
|
||||||
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5) {
|
|
||||||
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++) {
|
|
||||||
flArray.setPWM(ledPin, 0, dutyCycle);
|
|
||||||
}
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void frontlightFadeOutAll() {
|
|
||||||
for (int dutyCycle = preferences.getUInt("flMaxBrightness"); dutyCycle >= 0; dutyCycle -= 5) {
|
|
||||||
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++) {
|
|
||||||
flArray.setPWM(ledPin, 0, dutyCycle);
|
|
||||||
}
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
flArray.allOFF();
|
|
||||||
}
|
|
||||||
|
|
||||||
void frontlightFadeIn(uint num) {
|
|
||||||
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5) {
|
|
||||||
flArray.setPWM(num, 0, dutyCycle);
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void frontlightFadeOut(uint num) {
|
|
||||||
for (int dutyCycle = preferences.getUInt("flMaxBrightness"); dutyCycle >= 0; dutyCycle -= 5) {
|
|
||||||
flArray.setPWM(num, 0, dutyCycle);
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -59,8 +59,19 @@ void ledTheaterChase(uint32_t color, int wait);
|
||||||
Adafruit_NeoPixel getPixels();
|
Adafruit_NeoPixel getPixels();
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
|
void frontlightFlash(int flDelayTime);
|
||||||
void frontlightFadeInAll();
|
void frontlightFadeInAll();
|
||||||
void frontlightFadeOutAll();
|
void frontlightFadeOutAll();
|
||||||
void frontlightFadeIn(uint num);
|
void frontlightFadeIn(uint num);
|
||||||
void frontlightFadeOut(uint num);
|
void frontlightFadeOut(uint num);
|
||||||
|
|
||||||
|
void frontlightSetBrightness(uint brightness);
|
||||||
|
|
||||||
|
void frontlightFadeInAll(int flDelayTime);
|
||||||
|
void frontlightFadeInAll(int flDelayTime, bool staggered);
|
||||||
|
void frontlightFadeOutAll(int flDelayTime);
|
||||||
|
void frontlightFadeOutAll(int flDelayTime, bool staggered);
|
||||||
|
|
||||||
|
void frontlightFadeIn(uint num, int flDelayTime);
|
||||||
|
void frontlightFadeOut(uint num, int flDelayTime);
|
||||||
#endif
|
#endif
|
|
@ -56,8 +56,12 @@ void setupWebserver()
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
server.on("/api/frontlight/on", HTTP_GET, onApiFrontlightOn);
|
server.on("/api/frontlight/on", HTTP_GET, onApiFrontlightOn);
|
||||||
server.on("/api/frontlight/status", HTTP_GET, onApiFrontlightStatus);
|
server.on("/api/frontlight/flash", HTTP_GET, onApiFrontlightFlash);
|
||||||
|
server.on("/api/frontlight/brightness", HTTP_GET, onApiFrontlightSetBrightness);
|
||||||
server.on("/api/frontlight/off", HTTP_GET, onApiFrontlightOff);
|
server.on("/api/frontlight/off", HTTP_GET, onApiFrontlightOff);
|
||||||
|
|
||||||
|
server.addRewrite(
|
||||||
|
new OneParamRewrite("/api/frontlight/brightness/{b}", "/api/frontlight/brightness?b={b}"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// server.on("^\\/api\\/lights\\/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", HTTP_GET,
|
// server.on("^\\/api\\/lights\\/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", HTTP_GET,
|
||||||
|
@ -334,7 +338,7 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String uintSettings[] = {"minSecPriceUpd", "fullRefreshMin", "ledBrightness", "flMaxBrightness"};
|
String uintSettings[] = {"minSecPriceUpd", "fullRefreshMin", "ledBrightness", "flMaxBrightness", "flEffectDelay"};
|
||||||
|
|
||||||
for (String setting : uintSettings)
|
for (String setting : uintSettings)
|
||||||
{
|
{
|
||||||
|
@ -357,7 +361,7 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json)
|
||||||
String boolSettings[] = {"fetchEurPrice", "ledTestOnPower", "ledFlashOnUpd",
|
String boolSettings[] = {"fetchEurPrice", "ledTestOnPower", "ledFlashOnUpd",
|
||||||
"mdnsEnabled", "otaEnabled", "stealFocus",
|
"mdnsEnabled", "otaEnabled", "stealFocus",
|
||||||
"mcapBigChar", "useSatsSymbol", "useBlkCountdown",
|
"mcapBigChar", "useSatsSymbol", "useBlkCountdown",
|
||||||
"suffixPrice", "disableLeds", "ownDataSource", "flAlwaysOn"};
|
"suffixPrice", "disableLeds", "ownDataSource", "flAlwaysOn", "flFlashOnUpd"};
|
||||||
|
|
||||||
for (String setting : boolSettings)
|
for (String setting : boolSettings)
|
||||||
{
|
{
|
||||||
|
@ -478,8 +482,10 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
root["hasFrontlight"] = true;
|
root["hasFrontlight"] = true;
|
||||||
root["flMaxBrightness"] = preferences.getUInt("flMaxBrightness", 4095);
|
root["flMaxBrightness"] = preferences.getUInt("flMaxBrightness", 2048);
|
||||||
root["flAlwaysOn"] = preferences.getBool("flAlwaysOn", false);
|
root["flAlwaysOn"] = preferences.getBool("flAlwaysOn", false);
|
||||||
|
root["flEffectDelay"] = preferences.getUInt("flEffectDelay");
|
||||||
|
root["flFlashOnUpd"] = preferences.getBool("flFlashOnUpd", false);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
root["hasFrontlight"] = false;
|
root["hasFrontlight"] = false;
|
||||||
|
@ -1035,6 +1041,26 @@ void onApiFrontlightStatus(AsyncWebServerRequest *request)
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onApiFrontlightFlash(AsyncWebServerRequest *request)
|
||||||
|
{
|
||||||
|
frontlightFlash(preferences.getUInt("flEffectDelay"));
|
||||||
|
|
||||||
|
request->send(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onApiFrontlightSetBrightness(AsyncWebServerRequest *request)
|
||||||
|
{
|
||||||
|
if (request->hasParam("b"))
|
||||||
|
{
|
||||||
|
frontlightSetBrightness(request->getParam("b")->value().toInt());
|
||||||
|
request->send(200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
request->send(400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onApiFrontlightOff(AsyncWebServerRequest *request)
|
void onApiFrontlightOff(AsyncWebServerRequest *request)
|
||||||
{
|
{
|
||||||
frontlightFadeOutAll();
|
frontlightFadeOutAll();
|
||||||
|
|
|
@ -58,6 +58,9 @@ void onApiRestartDataSources(AsyncWebServerRequest *request);
|
||||||
|
|
||||||
#ifdef HAS_FRONTLIGHT
|
#ifdef HAS_FRONTLIGHT
|
||||||
void onApiFrontlightOn(AsyncWebServerRequest *request);
|
void onApiFrontlightOn(AsyncWebServerRequest *request);
|
||||||
|
void onApiFrontlightFlash(AsyncWebServerRequest *request);
|
||||||
|
void onApiFrontlightSetBrightness(AsyncWebServerRequest *request);
|
||||||
|
|
||||||
void onApiFrontlightStatus(AsyncWebServerRequest *request);
|
void onApiFrontlightStatus(AsyncWebServerRequest *request);
|
||||||
void onApiFrontlightOff(AsyncWebServerRequest *request);
|
void onApiFrontlightOff(AsyncWebServerRequest *request);
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue