diff --git a/main/main.ino b/main/main.ino index 5f886f1..b7c67f4 100644 --- a/main/main.ino +++ b/main/main.ino @@ -55,16 +55,21 @@ int yOffset = 30; uint8_t fanLevel = 0; // 0 = off, 1..NUM_LEVELS void applyFan() { + static uint8_t lastDuty = 0; if (fanLevel == 0) { ledcWrite(FAN_PIN, 0); + lastDuty = 0; return; } uint8_t duty = LEVELS[fanLevel - 1].duty; - if (duty > 0 && duty < 200) { - ledcWrite(FAN_PIN, 255); // kick-start - delay(300); + // Kick-start whenever spinning up from stopped — full duty briefly so the + // rotor breaks static friction, then drop to the target. + if (lastDuty == 0) { + ledcWrite(FAN_PIN, 255); + delay(400); } ledcWrite(FAN_PIN, duty); + lastDuty = duty; } void publishFan() {