Files
cube/cube.h
T
mikeandClaude Opus 5.5 92d507fb0d 84 Effekte in 7 Kategorien: Festtage, Natur, Fraktal und Ruhe neu
- Kategorien Flash, Festtage (Weihnachten + Silvester), Musik, Floating,
  Natur, Fraktal, Ruhe mit je 12 Effekten; 66 neue Effekte, u. a.
  Weihnachtsbaum, Adventskranz, Countdown, Vulkan, Polarlicht, Mandelbrot,
  Lorenz-Attraktor, Leben 3D, Hilbertkurve, Sanduhr, Kerzenschein
- eine Datei je Kategorie (fx_*.cpp), gemeinsame Hilfen in fx.h
  (plotSoft, fresh/fxStart für den Effektstart, ringPos, wrap8)
- Gewitter bleibt der Starteffekt (jetzt in Natur)
- App: Farben für die neuen Kategorien
- README-Tabellen und API-Beispiele angepasst

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:31:58 +01:00

154 lines
5.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <Arduino.h>
#include <FastLED.h>
#include "config.h"
extern CRGB leds[NUM_LEDS];
// Grundhelligkeit der Effekte und Helligkeit für Funken, Raketen, Bälle
// (per Taster 2 oder REST-API einstellbar, siehe cube.ino)
extern uint8_t brightness, highlight;
const uint8_t TOP = NUM_LAYERS - 1; // oberste Etage
// Koordinaten: z = Etage (0 = Etage 1 am ESP, unten), x/y = Position in der Etage.
// Reihenfolge der LEDs innerhalb einer Etage – ungeprüfte Annahme (Schlangenlinie).
const uint8_t LAYER_MAP[CUBE_SIZE][CUBE_SIZE] = {
{ 0, 1, 2, 3, 4 },
{ 9, 8, 7, 6, 5 },
{ 10, 11, 12, 13, 14 },
{ 19, 18, 17, 16, 15 },
{ 20, 21, 22, 23, 24 },
};
inline CRGB &at(uint8_t x, uint8_t y, uint8_t z) {
return leds[z * CUBE_SIZE * CUBE_SIZE + LAYER_MAP[y][x]];
}
// Steuerung (cube.ino), z. B. für die REST-API
uint8_t numCategories();
const char *categoryId(uint8_t c); // feste Kennung, z. B. "musik"
const char *categoryName(uint8_t c); // Anzeigename, z. B. "Musik"
uint8_t numEffects();
const char *effectId(uint8_t i); // feste Kennung, z. B. "feuer"
const char *effectName(uint8_t i); // Anzeigename, z. B. "Feuer"
uint8_t effectCategory(uint8_t i); // Index der Kategorie
uint8_t currentEffect();
void selectEffect(uint8_t i);
void setBaseBrightness(uint8_t b); // Grundhelligkeit 0..255
extern bool autoAdvance; // Effekte automatisch weiterschalten
// WLAN und REST-API (web.cpp)
void webBegin();
void webUpdate(uint32_t now); // einmal pro Frame aufrufen
// Mikrofon (audio.cpp)
void audioBegin();
void audioUpdate(uint32_t now); // einmal pro Frame aufrufen
bool audioClap(); // true, wenn seit dem letzten Aufruf geklatscht wurde
bool audioBeat(); // true, wenn seit dem letzten Aufruf ein Bass-Schlag kam
float audioLevel(); // Lautstärke 0..1, passt sich automatisch an
void audioSpectrum(float bands[CUBE_SIZE]); // 5 Frequenzbänder 0..1, Bass zuerst
// Spezialeffekte, die kurz über jedem Effekt laufen (effects.cpp)
void triggerLightning(uint32_t now);
void triggerExplosion(uint32_t now);
void triggerRainbowWave(uint32_t now);
void drawLightning(uint32_t now);
void drawSpecials(uint32_t now); // alle laufenden Spezialeffekte zeichnen
// Effekte (effects.cpp und fx_*.cpp, eine Datei je Kategorie); now = millis()
void resetEffects(); // beim Effektwechsel
// Flash
void renderShells(uint32_t now);
void renderMatrix(uint32_t now);
void renderBounce(uint32_t now);
void renderStrobe(uint32_t now);
void renderScanner(uint32_t now);
void renderComets(uint32_t now);
void renderSnake(uint32_t now);
void renderRotor(uint32_t now);
void renderStack(uint32_t now);
void renderPolice(uint32_t now);
void renderPixelStorm(uint32_t now);
void renderLaser(uint32_t now);
// Festtage
void renderTree(uint32_t now);
void renderWreath(uint32_t now);
void renderSnow(uint32_t now);
void renderFairyLights(uint32_t now);
void renderXmasStar(uint32_t now);
void renderGift(uint32_t now);
void renderCandyCane(uint32_t now);
void renderGlitter(uint32_t now);
void renderCountdown(uint32_t now);
void renderFireworks(uint32_t now);
void renderSparkler(uint32_t now);
void renderBubbly(uint32_t now);
// Musik
void renderSpectrum(uint32_t now);
void renderPulse(uint32_t now);
void renderShockwave(uint32_t now);
void renderSoundLayers(uint32_t now);
void renderSoundWave(uint32_t now);
void renderDisco(uint32_t now);
void renderVu(uint32_t now);
void renderBeatPlanes(uint32_t now);
void renderSoundCube(uint32_t now);
void renderSparkRain(uint32_t now);
void renderScope(uint32_t now);
void renderRings(uint32_t now);
// Floating
void renderRainbow(uint32_t now);
void renderLava(uint32_t now);
void renderWave(uint32_t now);
void renderHelix(uint32_t now);
void renderPlasma(uint32_t now);
void renderBubbles(uint32_t now);
void renderColorFog(uint32_t now);
void renderMetaballs(uint32_t now);
void renderVortex(uint32_t now);
void renderWeightless(uint32_t now);
void renderRings3d(uint32_t now);
void renderPendulums(uint32_t now);
// Natur
void renderStorm(uint32_t now);
void renderFire(uint32_t now);
void renderRain(uint32_t now);
void renderAurora(uint32_t now);
void renderOcean(uint32_t now);
void renderFireflies(uint32_t now);
void renderSunrise(uint32_t now);
void renderMeadow(uint32_t now);
void renderWaterfall(uint32_t now);
void renderVolcano(uint32_t now);
void renderAutumn(uint32_t now);
void renderShootingStars(uint32_t now);
// Fraktal
void renderMandelbrot(uint32_t now);
void renderJulia(uint32_t now);
void renderBitPattern(uint32_t now);
void renderFractalTree(uint32_t now);
void renderChaosGame(uint32_t now);
void renderLorenz(uint32_t now);
void renderThomas(uint32_t now);
void renderLife3d(uint32_t now);
void renderAutomaton(uint32_t now);
void renderHilbert(uint32_t now);
void renderCrystal(uint32_t now);
void renderFractalClouds(uint32_t now);
// Ruhe
void renderBreathe(uint32_t now);
void renderCandle(uint32_t now);
void renderStarrySky(uint32_t now);
void renderMoonlight(uint32_t now);
void renderColorCycle(uint32_t now);
void renderEmbers(uint32_t now);
void renderDeepSea(uint32_t now);
void renderDusk(uint32_t now);
void renderTide(uint32_t now);
void renderLanterns(uint32_t now);
void renderHourglass(uint32_t now);
void renderPastel(uint32_t now);