added lighting fading in and out, when connection is lost/reestablished

This commit is contained in:
2026-01-20 14:44:28 +01:00
parent 153d134f88
commit 42e49b6c06
4 changed files with 105 additions and 10 deletions

View File

@@ -26,7 +26,6 @@ static const uint8_t pwmPins[NUM_CHANNELS] = {
5, // D5
18, // D6
19 // D7
// 23 (D8) remains as a spare
};
static const uint32_t pwmFrequency = 25000; // 25 kHz
@@ -79,9 +78,21 @@ static const unsigned long slewDuration = 1000; // 1 second smooth transition
// -------------------------------
// Animation tuning
// -------------------------------
static const float FADE_IN_FACTOR = 0.999f; // boot-up 0 → 100%
static const float FADE_IN_FACTOR = 0.998f; // boot-up 0 → 100%
static const float FADE_OUT_FACTOR = 0.999f; // watchdog 100% → 0
static const unsigned long FADE_INTERVAL = 1; // ms between fade steps
// Lighting fade durations (milliseconds)
#define LIGHTING_FADE_IN_DURATION 1250
#define LIGHTING_FADE_OUT_DURATION 4250
// Clamping brightness at the low end
const uint8_t BRIGHTNESS_MIN_VISIBLE = 33;
// -------------------------------
// Lighting (FastLED)
// -------------------------------
#define LED_PIN 23
#define NUM_LEDS 20
// -------------------------------
// Connection state machine