feat: max_brightness ceiling set from the controller's device config
Neither the global nor a preset's brightness goes above max_brightness; a change redraws a static pattern under the new ceiling. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
08d7277204
commit
97df6e3cbe
4 files changed
+17
-1
No files matched your search
+3
-1
@@ -23,6 +23,8 @@ class Presets:
|
||||
self.step = 0
|
||||
# Global brightness (0–255), controlled via ESPNow {"b": <value>}
|
||||
self.b = 255
|
||||
# Ceiling for the effective brightness (0–255): neither the global nor a preset's brightness goes above it
|
||||
self.max_b = 255
|
||||
self.reversed = False
|
||||
|
||||
self.generator = None
|
||||
@@ -265,7 +267,7 @@ class Presets:
|
||||
# Combine per-preset brightness (override) with global brightness self.b
|
||||
local = brightness_override if brightness_override is not None else 255
|
||||
# Scale preset brightness by global brightness
|
||||
effective_brightness = int(local * self.b / 255)
|
||||
effective_brightness = min(int(local * self.b / 255), self.max_b)
|
||||
return tuple(int(c * effective_brightness / 255) for c in color)
|
||||
|
||||
def fill(self, color=None):
|
||||
|
||||
Reference in new issue
Block a user