fix: DDP frames respect the max brightness ceiling

DDP frames still skip the device and master brightness, since the sender
sets the colours, but they are now scaled by max_brightness instead of
being shown at a fixed full 255.

ddp_test expects the same scale.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-12 11:12:15 +13:00
1 parent 59eb37cad5
commit 94e300f6ad
2 files changed
+5 -4

No files matched your search

+3 -3
View File
@@ -236,9 +236,9 @@ static bool within(uint32_t now, uint32_t stamp, uint32_t window_ms)
// Show the shadow frame, crossfading from the previous frame while a fade runs
static void output(uint32_t now, bool full_brightness)
{
// device brightness x master scale, under the max brightness ceiling. DDP frames are shown at
// full brightness: the sender sets the colours.
int s_scale = full_brightness ? 255 : s_global * s_master / 255 * s_max_brightness / 255;
// Pattern output: device brightness x master scale, under the max brightness ceiling. DDP frames
// skip the device and master brightness (the sender sets the colours) but still respect the ceiling.
int s_scale = full_brightness ? s_max_brightness : s_global * s_master / 255 * s_max_brightness / 255;
int k = -1;
if (s_fading) {
uint32_t el = now - s_fade_t0;
+2 -1
View File
@@ -732,7 +732,8 @@ def run_all(hosts, serial_port, broadcast):
before, scale = {}, {}
for h in hosts:
before[h] = get(h, "/api/ddp")
scale[h] = 255 # DDP frames are shown at full brightness, whatever the device's brightness settings
# DDP frames ignore the device and master brightness, but the max brightness ceiling still applies
scale[h] = get(h, "/api/hardware")["max_brightness"]
out[h].append(f"before: active={before[h]['active']} packets={before[h]['packets']}")
out[h].append(f"output scale: {scale[h]}/255")