Manueller Modus: einzelne Pixel per API setzen (/api/pixels)
- PUT /api/pixels: alle 125 Pixel, Index x + 5*y + 25*z
- PATCH /api/pixels: optional fill, dann einzelne Pixel mit x, y, z
- GET /api/pixels: aktuelles Bild
- Schreiben schaltet den manuellen Modus ein: Farben unverändert (nur die
Strombegrenzung dimmt), kein Autowechsel, keine Klatsch-Blitze; ein
Effektstart oder {"manual": false} in /api/state beendet ihn
- Nicht im Flash gespeichert, damit Skripte viele Bilder schicken können
- App zeigt den manuellen Modus in der Statuszeile
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ff1fdeaf4f
commit
ffac7d6ff2
8 files changed
+193
-8
No files matched your search
@@ -17,6 +17,8 @@ uint8_t brightness, highlight;
|
||||
bool autoAdvance = true;
|
||||
bool autoAll = false;
|
||||
bool playFavorites = false;
|
||||
bool manualMode = false;
|
||||
CRGB manualFrame[NUM_LAYERS][CUBE_SIZE][CUBE_SIZE];
|
||||
uint8_t favorites[MAX_FAVORITES], favoriteCount = 0;
|
||||
|
||||
void setBaseBrightness(uint8_t b) {
|
||||
@@ -174,6 +176,7 @@ uint8_t current = 0;
|
||||
uint32_t effectStart = 0;
|
||||
|
||||
void startEffect(uint8_t i, uint32_t now) {
|
||||
manualMode = false;
|
||||
current = i % NUM_EFFECTS;
|
||||
effectStart = now;
|
||||
resetEffects();
|
||||
@@ -235,6 +238,10 @@ void setFavorites(const uint8_t *list, uint8_t n) {
|
||||
memcpy(favorites, list, favoriteCount);
|
||||
}
|
||||
void selectEffect(uint8_t i) { startEffect(i, millis()); }
|
||||
void setManual(bool on) {
|
||||
if (on) manualMode = true;
|
||||
else if (manualMode) startEffect(current, millis());
|
||||
}
|
||||
|
||||
// Taster gegen GND mit Entprellung; pressed() meldet jeden Druck einmal.
|
||||
struct Button {
|
||||
@@ -281,11 +288,21 @@ void loop() {
|
||||
setLevel(brightnessLevel + 1);
|
||||
Serial.printf("Helligkeit: %u\n", brightness);
|
||||
}
|
||||
if (autoAdvance && now - effectStart >= EFFECTS[current].ms) startEffect(nextEffect(current), now);
|
||||
if (autoAdvance && !manualMode && now - effectStart >= EFFECTS[current].ms) startEffect(nextEffect(current), now);
|
||||
settingsUpdate(now);
|
||||
|
||||
audioUpdate(now);
|
||||
if (audioClap()) triggerLightning(now);
|
||||
bool clap = audioClap();
|
||||
if (manualMode) { // Pixel aus der API, unverändert und ohne Überblenden
|
||||
for (uint8_t z = 0; z < NUM_LAYERS; z++)
|
||||
for (uint8_t y = 0; y < CUBE_SIZE; y++)
|
||||
for (uint8_t x = 0; x < CUBE_SIZE; x++) at(x, y, z) = manualFrame[z][y][x];
|
||||
FastLED.setBrightness(255);
|
||||
FastLED.show();
|
||||
delay(16);
|
||||
return;
|
||||
}
|
||||
if (clap) triggerLightning(now);
|
||||
|
||||
EFFECTS[current].render(now);
|
||||
drawSpecials(now);
|
||||
|
||||
Reference in new issue
Block a user