From 94e300f6adb2d1f9e18b803a0238adabd932eace Mon Sep 17 00:00:00 2001 From: jimmy Date: Thu, 12 Nov 2026 11:12:15 +1300 Subject: [PATCH] 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 --- main/patterns.cpp | 6 +++--- tools/ddp_test.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main/patterns.cpp b/main/patterns.cpp index 9b0e22b..f80a26a 100644 --- a/main/patterns.cpp +++ b/main/patterns.cpp @@ -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; diff --git a/tools/ddp_test.py b/tools/ddp_test.py index 53f8231..16bdc79 100644 --- a/tools/ddp_test.py +++ b/tools/ddp_test.py @@ -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")