Fix light control API functionality, changed light setting endpoints

This commit is contained in:
Djuri Baars 2024-06-08 11:35:23 +02:00
parent 474ddbb086
commit 491618dd78
4 changed files with 10 additions and 9 deletions

2
data

@ -1 +1 @@
Subproject commit e859adac8631c6380a6a3f8b20b118a5531d4f8c
Subproject commit 4f15eee72bcd3873a0edb61bc77638a0ff5e3724

View file

@ -722,7 +722,7 @@ void setupFrontlight()
}
if (!preferences.isKey("flEffectDelay"))
{
preferences.putUInt("flEffectDelay", 5);
preferences.putUInt("flEffectDelay", 15);
}
if (!preferences.isKey("flFlashOnUpd"))

View file

@ -6,7 +6,7 @@ Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
uint ledTaskParams;
#ifdef HAS_FRONTLIGHT
#define FL_FADE_STEP 50
#define FL_FADE_STEP 25
bool frontlightOn = false;
bool flInTransition = false;
@ -15,13 +15,13 @@ void frontlightFlash(int flDelayTime)
{
if (frontlightOn)
{
frontlightFadeOutAll(flDelayTime);
frontlightFadeInAll(flDelayTime);
frontlightFadeOutAll(flDelayTime, true);
frontlightFadeInAll(flDelayTime, true);
}
else
{
frontlightFadeInAll(flDelayTime);
frontlightFadeOutAll(flDelayTime);
frontlightFadeInAll(flDelayTime, true);
frontlightFadeOutAll(flDelayTime, true);
}
}
@ -264,6 +264,7 @@ void ledTask(void *parameter)
#ifdef HAS_FRONTLIGHT
if (preferences.getBool("flFlashOnUpd", false))
{
vTaskDelay(pdMS_TO_TICKS(10));
if (frontlightWasOn)
{
frontlightFadeInAll(1);

View file

@ -46,7 +46,7 @@ void setupWebserver()
server.addHandler(handler);
AsyncCallbackJsonWebHandler *lightsJsonHandler =
new AsyncCallbackJsonWebHandler("/api/lights", onApiLightsSetJson);
new AsyncCallbackJsonWebHandler("/api/lights/set", onApiLightsSetJson);
server.addHandler(lightsJsonHandler);
server.on("/api/lights/off", HTTP_GET, onApiLightsOff);
@ -68,7 +68,7 @@ void setupWebserver()
// onApiLightsSetColor);
server.on("/api/restart", HTTP_GET, onApiRestart);
server.addRewrite(new OneParamRewrite("/api/lights/{color}",
server.addRewrite(new OneParamRewrite("/api/lights/color/{color}",
"/api/lights/color?c={color}"));
server.addRewrite(
new OneParamRewrite("/api/show/screen/{s}", "/api/show/screen?s={s}"));