Regler „Effekt“: ein Parameter je Effekt (Tempo, Farbe, Empfindlichkeit, …)
- Tempo (66 Effekte): eigene Effekt-Uhr 0,25- bis 4-mal so schnell; bei mehr Tempo mehrere Rechenschritte pro Bild (aufwändige Effekte nur einer), bei weniger nicht in jedem Bild - Farbe (Blitzlicht, Blaulicht, Geschenk, Fraktalwolken, Lampe): Farbton des fertigen Bilds drehen - Empfindlichkeit (Musik): Pegel und Spektrum verstärken, Beat-Schwelle - Eigene: Gewitter Blitze, Feuer Hitze, Regen Stärke, Schnee Dichte, Weihnachtsbaum Kugelfarbe - Mitte 128 = ursprünglicher Effekt; Wert je Effekt im Flash - API: param in /api/state, Parametername in /api/effects - App: Regler „Effekt“ unter der Helligkeit (Titel antippen = Mitte), Schalter in einer Zeile, „Alle Kategorien“ heißt jetzt „Zufällig“ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a1dc881fb1
commit
a8fee0e960
15 files changed
+278
-73
No files matched your search
@@ -5,6 +5,7 @@
|
||||
// PUT/PATCH /api/state ändern, alle Felder optional, z. B.
|
||||
// {"effect": "feuer", "auto": false, "brightness": 64}
|
||||
// (alle Felder in docs/api.md); wird im Flash gespeichert
|
||||
// "param": 0..255 = Regler "Effekt" des laufenden Effekts
|
||||
// GET /api/categories alle Kategorien: [{"id": "flash", "name": "Flash"}, ...]
|
||||
// GET /api/effects alle Effekte: [{"id": "gewitter", "name": "Gewitter", "category": "natur"}, ...]
|
||||
// GET /api/weather zuletzt abgerufenes Wetter am eingestellten Ort
|
||||
@@ -52,6 +53,7 @@ void sendState() {
|
||||
doc["playFavorites"] = playFavorites;
|
||||
doc["manual"] = manualMode;
|
||||
doc["brightness"] = brightness;
|
||||
doc["param"] = effectParam(currentEffect());
|
||||
JsonArray favs = doc["favorites"].to<JsonArray>();
|
||||
for (uint8_t k = 0; k < numFavorites(); k++) favs.add(effectId(favorite(k)));
|
||||
char hex[8];
|
||||
@@ -102,6 +104,7 @@ void sendEffects() {
|
||||
e["id"] = effectId(i);
|
||||
e["name"] = effectName(i);
|
||||
e["category"] = categoryId(effectCategory(i));
|
||||
e["param"] = effectParamName(i);
|
||||
}
|
||||
sendJson(200, doc);
|
||||
}
|
||||
@@ -127,6 +130,7 @@ void updateState() {
|
||||
JsonVariant effect = body["effect"], autoOn = body["auto"], all = body["allCategories"], level = body["brightness"];
|
||||
JsonVariant playFav = body["playFavorites"], favs = body["favorites"], lamp = body["lampColor"], text = body["text"];
|
||||
JsonVariant place = body["place"], lat = body["latitude"], lon = body["longitude"], manual = body["manual"];
|
||||
JsonVariant param = body["param"];
|
||||
int index = -1;
|
||||
if (!effect.isNull()) {
|
||||
if (!effect.is<const char *>()) return sendError(400, "effect muss eine Effekt-id sein, siehe /api/effects");
|
||||
@@ -139,6 +143,8 @@ void updateState() {
|
||||
return sendError(400, "brightness muss eine ganze Zahl von 0 bis 255 sein");
|
||||
if (!playFav.isNull() && !playFav.is<bool>()) return sendError(400, "playFavorites muss true oder false sein");
|
||||
if (!manual.isNull() && !manual.is<bool>()) return sendError(400, "manual muss true oder false sein");
|
||||
if (!param.isNull() && !(param.is<int>() && param.as<int>() >= 0 && param.as<int>() <= 255))
|
||||
return sendError(400, "param muss eine ganze Zahl von 0 bis 255 sein");
|
||||
uint8_t favList[MAX_FAVORITES], favCount = 0;
|
||||
if (!favs.isNull()) {
|
||||
if (!favs.is<JsonArray>()) return sendError(400, "favorites muss eine Liste von Effekt-ids sein");
|
||||
@@ -167,6 +173,7 @@ void updateState() {
|
||||
}
|
||||
|
||||
if (index >= 0) selectEffect(index);
|
||||
if (!param.isNull()) setEffectParam(currentEffect(), param.as<int>()); // gilt für den (neu gewählten) Effekt
|
||||
if (!autoOn.isNull()) autoAdvance = autoOn.as<bool>();
|
||||
if (!all.isNull()) autoAll = all.as<bool>();
|
||||
if (!level.isNull()) setBaseBrightness(level.as<int>());
|
||||
|
||||
Reference in new issue
Block a user