Skip to content

Commit 536fa70

Browse files
author
haschtl
committed
desk_lampe läuft bis auf init bug
1 parent 9436a2c commit 536fa70

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/lamp_state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ void startBrightnessRamp(float target, uint32_t durationMs, bool affectMaster =
4949
void updateBrightnessRamp();
5050
void setLampEnabled(bool enable, const char *reason = nullptr);
5151
void forceLampOff(const char *reason = nullptr);
52-
void setBrightnessPercent(float percent, bool persist = false, bool announce = true);
52+
void setBrightnessPercent(float percent, bool persist = false, bool announce = true, bool fast = false);

src/inputs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ void updatePoti()
576576

577577
if (!lampEnabled)
578578
setLampEnabled(true, "poti");
579-
setBrightnessPercent(target * 100.0f, true);
579+
// Fast, non-persisted updates for smooth knob response (no flash wear).
580+
setBrightnessPercent(target * 100.0f, false, false, true);
580581
}
581582
#endif
582583

src/lamp_state.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ void forceLampOff(const char *reason)
355355
/**
356356
* @brief Set the master brightness in percent, optionally persisting/announcing.
357357
*/
358-
void setBrightnessPercent(float percent, bool persist, bool announce)
358+
void setBrightnessPercent(float percent, bool persist, bool announce, bool fast)
359359
{
360360
float target = clamp01(percent / 100.0f);
361-
uint32_t dur = (target >= masterBrightness) ? rampOnDurationMs : rampOffDurationMs;
361+
uint32_t dur = fast ? 0 : ((target >= masterBrightness) ? rampOnDurationMs : rampOffDurationMs);
362362
startBrightnessRamp(target, dur);
363363
if (announce)
364364
{

0 commit comments

Comments
 (0)