You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DJ light effect (and others): intensity low after upgrade to v16 #5603
@coderabbitai have any changes been made to this effect between v0.15.0 and v16.0.0 or are we just setting something like different gamma having an effect? Could this also be related to the removal of frame time?
#!/bin/bash
# Check git tags for v0.15.0 and v0.16.0
git tag | grep -E 'v0\.(15|16)' | sort
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Find the DJ Light effect implementation
rg -rn "dj.light\|DJ.light\|DJ_LIGHT\|djlight" --type cpp -i -C 2
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Check available git tags
git tag | sort -V | tail -20
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Search GitHub for commits related to DJ light effect
gh api "repos/wled/WLED/commits?per_page=100" --jq '.[] | select(.commit.message | test("dj|DJ|gamma|frame.time|frametime"; "i")) | {sha: .sha[0:10], message: .commit.message, date: .commit.author.date}' 2>/dev/null | head -100
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Search for the DJ light effect in the WLED repo via GitHub search API
gh api "search/code?q=dj+light+effect+repo:wled/WLED+language:cpp" --jq '.items[] | {path: .path, name: .name}' 2>/dev/null
Length of output: 711
🏁 Script executed:
#!/bin/bash
# Get the DJ light effect code from audio_reactive.cpp
gh api "repos/wled/WLED/contents/usermods/audioreactive/audio_reactive.cpp" --jq '.download_url' 2>/dev/null
Length of output: 91
🏁 Script executed:
#!/bin/bash
# List tags in the WLED repo to find correct tag names
gh api "repos/wled/WLED/tags?per_page=30" --jq '.[].name' 2>/dev/null
Length of output: 315
🏁 Script executed:
#!/bin/bash
# Get the commit SHAs for v0.15.0 and v0.16.0
V15_SHA=$(gh api "repos/wled/WLED/git/refs/tags/v0.15.0" --jq '.object.sha' 2>/dev/null)
V16_SHA=$(gh api "repos/wled/WLED/git/refs/tags/v0.16.0" --jq '.object.sha' 2>/dev/null)
echo "v0.15.0 SHA: $V15_SHA"
echo "v0.16.0 SHA: $V16_SHA"
# Get the audio_reactive.cpp file at v0.15.0
gh api "repos/wled/WLED/contents/usermods/audioreactive/audio_reactive.cpp?ref=v0.15.0" --jq '.download_url' 2>/dev/null
Length of output: 327
🏁 Script executed:
#!/bin/bash
# Get the GitHub compare URL commits between v0.15.0 and v0.16.0 for audio_reactive.cpp
gh api "repos/wled/WLED/commits?path=usermods/audioreactive/audio_reactive.cpp&since=2024-01-01T00:00:00Z&per_page=50" \
--jq '.[] | {sha: .sha[0:10], message: .commit.message[0:100], date: .commit.author.date}' 2>/dev/null
Length of output: 4413
🏁 Script executed:
#!/bin/bash
# Download current audio_reactive.cpp and find DJ light effect
curl -s "https://raw.githubusercontent.com/wled/WLED/main/usermods/audioreactive/audio_reactive.cpp" | grep -n -i "dj\|DJ" | head -40
Length of output: 2062
🏁 Script executed:
#!/bin/bash
# Search commits related to frame time, gamma between the versions
gh api "repos/wled/WLED/commits?since=2024-09-01T00:00:00Z&per_page=100" \
--jq '.[] | select(.commit.message | test("frame.time|frametime|gamma|DJ.light|dj.light"; "i")) | {sha: .sha[0:10], message: .commit.message[0:120], date: .commit.author.date}' 2>/dev/null
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Find DJ Light effect implementation in FX files
curl -s "https://raw.githubusercontent.com/wled/WLED/main/usermods/audioreactive/audio_reactive.cpp" | grep -n -A 50 "DJ Light\|djLight\|dj_light" | head -100
Length of output: 3155
🏁 Script executed:
#!/bin/bash
# Search for DJ Light in all WLED source files via GitHub
gh api "search/code?q=DJ+Light+repo:wled/WLED" --jq '.items[] | {path: .path, url: .html_url}' 2>/dev/null
Length of output: 4680
🏁 Script executed:
#!/bin/bash
# Search for frame time removal in recent commits
gh api "repos/wled/WLED/commits?since=2024-09-01T00:00:00Z&per_page=100" \
--jq '.[] | {sha: .sha[0:10], message: .commit.message[0:150], date: .commit.author.date}' 2>/dev/null | grep -i "frame\|gamma\|intensity\|bright" | head -40
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Search GitHub for DJ Light in FX.cpp
gh api "search/code?q=GEQ+DJ+Light+repo:wled/WLED+filename:FX.cpp" --jq '.items[] | {path: .path}' 2>/dev/null
# Get the CHANGELOG and look for relevant changes
curl -s "https://raw.githubusercontent.com/wled/WLED/main/CHANGELOG.md" | grep -A 3 -i "frame.time\|frametime\|gamma\|DJ.light\|intensity\|bright" | head -60
Length of output: 2407
🏁 Script executed:
#!/bin/bash
# Try to find FX.cpp in the repo
gh api "repos/wled/WLED/git/trees/main?recursive=0" --jq '.tree[] | select(.path | test("FX")) | .path' 2>/dev/null
Length of output: 118
🏁 Script executed:
#!/bin/bash
# Find and extract DJ Light effect from FX.cpp (current main)
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -i "dj.light\|DJ.Light\|GEQ_base\|djLight" | head -20
Length of output: 331
🏁 Script executed:
#!/bin/bash
# Get commits to FX.cpp between v0.15.0 and v0.16.0
gh api "repos/wled/WLED/commits?path=wled00/FX.cpp&since=2024-09-01T00:00:00Z&per_page=50" \
--jq '.[] | {sha: .sha[0:10], message: .commit.message[0:150], date: .commit.author.date}' 2>/dev/null
Length of output: 8675
🏁 Script executed:
#!/bin/bash
# Extract DJ Light effect from current FX.cpp (lines 7225-7260)
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '7220,7260p'
Length of output: 1758
🏁 Script executed:
#!/bin/bash
# Get the diff of the FRAMETIME removal PR for FX.cpp around DJ Light
gh api "repos/wled/WLED/commits/6b70c6ae91" --jq '.commit.message' 2>/dev/null
# Get the PR `#5314` details
gh api "repos/wled/WLED/pulls/5314" --jq '{title, body: .body[0:500]}' 2>/dev/null
Length of output: 891
🏁 Script executed:
#!/bin/bash
# Get DJ Light effect from v0.15.0 - find the file first and extract it
# Get the tree for v0.15.0
V15_TREE=$(gh api "repos/wled/WLED/git/trees/v0.15.0?recursive=1" --jq '.tree[] | select(.path == "wled00/FX.cpp") | .sha' 2>/dev/null)
echo "FX.cpp blob SHA at v0.15.0: $V15_TREE"
Length of output: 69
🏁 Script executed:
#!/bin/bash
# Get DJ Light effect from v0.15.0 blob (content is base64 encoded, need to download raw)
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n -A 35 "DJLight\|DJ Light" | head -80
Length of output: 4175
🏁 Script executed:
#!/bin/bash
# Check the video scaling / ABL commit for brightness impact
gh api "repos/wled/WLED/commits/d5d7fde30f" --jq '{message: .commit.message, files: [.files[] | {filename, changes, patch: .patch[0:500]}]}' 2>/dev/null | head -100
# Check gamma-related commit dd3edf1a3c
gh api "repos/wled/WLED/commits/dd3edf1a3c" --jq '{message: .commit.message, files: [.files[] | select(.filename | test("FX.cpp")) | {filename, patch: .patch[0:800]}]}' 2>/dev/null
Length of output: 11025
@netmindz, here's what I found after investigating the changes between v0.15.0 and v0.16.0:
DJ Light Effect Code: Unchanged
The core logic of mode_DJLight() is identical between v0.15.0 and v0.16.0 — same FFT data usage (fftResult[15]/2, fftResult[5]/2, fftResult[0]/2), same fadeToBlackBy() call, same pixel shifting. The only difference at the function level is the removal of return FRAMETIME.
Most Likely Culprits for the Dimness Bug
1. 🔴 Video Scaling / ABL Overhaul — PR #4798 (commit d5d7fde30f, Aug 2025) — Most Likely
This is a sweeping change to the brightness pipeline that replaced NeoPixelBusLg (which had built-in luminance/brightness correction) with plain NeoPixelBus, moving brightness scaling entirely to the bus manager. The commit message notes: "updated color scaling to preserve hue at low brightness" and "improved gamma table calculation: fixed mismatch in inverting gamma table calculation."
The impact on DJ Light: the effect already halves the FFT values (fftResult[]/2, capping at 127), and then further dims via fadeToBlackBy(). Under the new brightness/gamma pipeline, those mid-range color values likely get scaled differently, resulting in visibly lower output brightness. This is consistent with the reported symptom.
2. 🟡 Full FastLED Replacement — PR #4615 (commit b7d2c3cd85, Mar 2026)
DJ Light directly uses CRGB and fadeToBlackBy() — both FastLED types. This PR replaced all FastLED dependencies with custom implementations. If the fadeToBlackBy() reimplementation or CRGB color math behaves even slightly differently (e.g., different rounding, scaling curve), it would compound with the pipeline changes above to reduce apparent brightness.
This is less likely to be the cause of the dimness itself. The pixel update logic in DJ Light sits inside the secondHand timer check (if (SEGENV.aux0 != secondHand)), so actual pixel updates are still rate-limited by that internal timer — not by FRAMETIME. However, the fact that the effect now renders every frame instead of at a fixed interval could interact with the new brightness pipeline if there's any dimming being applied per-frame.
Summary
Change
PR
Date
Likely Impact
Video scaling / new ABL
#4798
Aug 2025
🔴 High — changes brightness pipeline affecting all colors
FastLED replacement
#4615
Mar 2026
🟡 Medium — CRGB/fadeToBlackBy() reimplemented
FRAMETIME removal
#5314
Feb 2026
🟢 Low — timing change, not brightness
The fix would likely need to adjust the color values in mode_DJLight() to compensate for the new brightness pipeline — e.g., removing the /2 division on the FFT values, or adjusting the fadeToBlackBy() mapping, since the color output is now processed differently before reaching the LEDs.
The fix would likely need to adjust the color values in mode_DJLight() to compensate for the new brightness pipeline — e.g., removing the /2 division on the FFT values, or adjusting the fadeToBlackBy() mapping, since the color output is now processed differently before reaching the LEDs.
@CodeRabbit I don't think that either of these is the right solution. My guess
either gamma correction is a difference (user could try unchecking "gamma correction" in LEDs settings),
or the change to fastLED-slim: CHSV could be replaced with CHSV32 for better color quality.
Good point — let me look at how CHSV vs CHSV32 differs in WLED's fastLED-slim, and how mode_DJLight() currently uses CHSV.
🏁 Script executed:
#!/bin/bash
# Find CHSV32 definition and usage in WLED
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "CHSV" | head -30
# Search for CHSV32 definition in wled source
gh api "search/code?q=CHSV32+repo:wled/WLED" --jq '.items[] | {path: .path, url: .html_url}' 2>/dev/null
# Extract mode_DJLight full implementation from current main
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -A 40 "mode_DJLight\|DJLight" | head -80
Length of output: 8122
Let me look at the CHSV32 definition and the fastLED-slim HSV conversion to understand the quality difference.
🏁 Script executed:
#!/bin/bash
# Get CHSV32 definition from colors.h
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/colors.h" | grep -n -A 20 "CHSV32\|struct CHSV"
# Get CHSV and CHSV32 from fastled_slim
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/src/dependencies/fastled_slim/fastled_slim.cpp" | grep -n -B2 -A 30 "CHSV32\|hsv2rgb\|hsv_to_rgb" | head -120
Length of output: 9604
@softhack007, thank you for the correction — your analysis makes much more sense given the actual code.
The FFT values are already hard-capped to a maximum of 127 (due to /2), and then further reduced by fadeToBlackBy. With gamma correction enabled on top of that, a value of 127 (~50% linear brightness) gets mapped through the gamma table to roughly 22% perceived brightness — which aligns exactly with the "too dim" report. Toggling off gamma correction in LED settings is a great first diagnostic step for the user.
On CHSV32: I can see from colors.h that CHSV32 uses a 16-bit hue (uint16_t h, range 0–65535) versus CHSV's 8-bit hue, and hsv2rgb_rainbow uses the lower 13 bits (h & 0x1FFF) for sub-section interpolation — giving 256× finer hue resolution and smoother color transitions. That's a meaningful quality improvement for any effect using CHSV. Since mode_DJLight() currently doesn't use CHSV at all (it builds CRGB directly from FFT values), the CHSV32 upgrade would apply to other effects in the codebase rather than this one specifically.
✏️ Learnings added
Learnt from: softhack007
URL: https://github.com/wled/WLED/issues/5603
Timestamp: 2026-05-11T19:39:20.693Z
Learning: In WLED's `mode_DJLight()` (wled00/FX.cpp), the effect builds color directly as `CRGB(fftResult[15]/2, fftResult[5]/2, fftResult[0]/2)` — plain RGB, not CHSV. The /2 division caps values at 127 max, and with gamma correction enabled this produces very dim output (gamma maps ~50% linear to ~22% perceived brightness). The recommended diagnostic is to uncheck "gamma correction" in LED settings. CHSV→CHSV32 replacement (for 16-bit hue precision) applies to other WLED effects that use CHSV, not DJLight in its current form.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
CRGB color = CRGB(fftResult[15]/2, fftResult[5]/2, fftResult[0]/2); // 16-> 15 as 16 is out of bounds
So it creates colors directly from 3 FFT bands - if I remember correctly, the "/2" part was originally commented with "avoid pastels".
In 0.15.x, the color values were directly passed to the bus driver level, while in 16.0 we have a gamma correction step in the render path, when going from strip to busses level. That means to re-create previous behaviour, you'd need to put gamma8inv() around each color component - later during rendering this will be un-done by gamma correction, so as a result the bus drivers receive the same colors as in previous versions.
CRGB color = CRGB(gamma8inv(fftResult[15]/2), gamma8inv(fftResult[5]/2), gamma8inv(fftResult[0]/2));
However the gamma8(gamma8inv()) processing destroys color accuracy a bit, so maybe also experiment with other solutions, like reducing the FFTResult downscaling - for example use 2 * FFTResult[x] / 3 to push up the color values (order is important: 2 * FFT[x] / 3 is not the same as FFT[x] * 2/3).
#!/bin/bash
# Check gamma8inv function definition in WLED
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/colors.h" | grep -n -A 10 "gamma8inv\|gamma8" | head -60
# Also check colors.cpp or similar
gh api "search/code?q=gamma8inv+repo:wled/WLED" --jq '.items[] | {path: .path, url: .html_url}' 2>/dev/null
# Get the gamma8inv implementation
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/colors.cpp" | grep -n -A 15 "gamma8inv\|gammatable\|gamma_table" | head -80
Length of output: 1443
🏁 Script executed:
#!/bin/bash
# Check rawInverseGamma8 implementation to understand precision
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/colors.cpp" | grep -n -B2 -A 20 "rawInverseGamma8\|inverseGamma\|InverseGamma" | head -80
# Check how gamma8inv is already used in FX_fcn.cpp and FXparticleSystem.cpp (for precedent)
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX_fcn.cpp" | grep -n -B2 -A 3 "gamma8inv\|gamma8" | head -60
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FXparticleSystem.cpp" | grep -n -B2 -A 3 "gamma8inv\|gamma8" | head -40
Length of output: 2769
@softhack007, your analysis is spot on — and I'd actually argue the gamma8inv() approach is the better of the two options, not just an alternative.
On gamma8inv() — this is the right fix:
gamma8inv() is already an established pattern in the WLED codebase for exactly this purpose. In FX_fcn.cpp (Line 1419):
if (gammaCorrectCol) opacity = gamma8inv(opacity); // use inverse gamma on brightness for correct color scaling after gamma correction (see `#5343` for details)
And in FXparticleSystem.cpp (Lines 681, 805, 1534–1535), gamma8inv() is used on pixel brightness with the comment "invert brightness so brightness distribution is linear after gamma correction." The proposed mode_DJLight() fix follows exactly this existing idiom.
A key benefit: rawInverseGamma8 (and inverseGamma32) guard on gammaCorrectCol — if the user has gamma correction disabled, gamma8inv() is a no-op, so the fix is self-consistent and won't over-brighten for those users.
The roundtrip precision loss from gamma8(gamma8inv(x)) is real but already accepted across the codebase, and for a reactive audio effect driven by noisy FFT data, it's unlikely to be perceptible.
On 2 * FFTResult[x] / 3:
This is a tuning knob for the original/ 2 scaling (the "avoid pastels" intent), independent of the gamma issue. It raises the brightness ceiling from 127 to ~170, which helps regardless of gamma settings, but doesn't address the pipeline delta itself. If gamma is off, the effect would be noticeably brighter than in 0.15.x. The integer arithmetic ordering note (2 * FFT[x] / 3 vs FFT[x] * 2/3) is an important correctness point.
Suggested approach:
Apply gamma8inv() as the proper gamma-pipeline fix (restores 0.15.x-equivalent output at the bus)
Separately, consider whether the / 2 → * 2 / 3 scaling change is desirable as a brightness/saturation improvement on its own merits — it's orthogonal and could be done with or without the gamma fix
(̶‾᷄♡‾᷅)っ
✏️ Learnings added
Learnt from: softhack007
URL: https://github.com/wled/WLED/issues/5603
Timestamp: 2026-05-11T20:53:20.682Z
Learning: In WLED, `gamma8inv()` (macro for `NeoGammaWLEDMethod::rawInverseGamma8()`) is an established pattern for pre-compensating values that will later pass through the gamma correction pipeline in `show()`. It is already used in FX_fcn.cpp (Line 1419 for opacity) and FXparticleSystem.cpp (Lines 681, 805, 1534-1535 for pixel brightness). The function is a no-op when `gammaCorrectCol` is false, making it self-consistent. When effects in `wled00/FX.cpp` build colors directly from raw data (e.g., FFT values) and those colors appear too dim in v0.16.0 vs v0.15.0, the fix is to wrap each component in `gamma8inv()` to compensate for the new gamma correction step added in the render path between strip and bus level in v0.16.0.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
Let me do a thorough scan of FX.cpp — both current and the 0_15_x branch — to identify effects that fit the pattern.
🏁 Script executed:
#!/bin/bash
# Download current FX.cpp and look for direct CRGB construction with computed values
# (not palette calls, not color(), not ColorFromPalette, not SEGMENT.color*)
echo "=== Current FX.cpp: Direct CRGB(r,g,b) constructions ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "CRGB(" | grep -v "ColorFromPalette\|color_from_palette\|CRGB(0\|CRGB(255\|CRGB(leds\|//\|CHSV\|segcolor\|col2rgb\|color_blend\|CRGB(r,\|CRGB(b," | head -80
echo ""
echo "=== Current FX.cpp: Direct CRGB with numeric/computed fields (not palette) ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "CRGB(" | grep -vE "ColorFromPalette|color_from_palette|CRGB\(0,\s*0,\s*0|CRGB\(255,\s*255,\s*255|//|CHSV|SEGMENT\." | head -80
Length of output: 1124
🏁 Script executed:
#!/bin/bash
# Get the full list of mode function names in current FX.cpp along with line numbers
echo "=== Effect function definitions ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "^uint16_t mode_\|^static uint16_t mode_\|^uint32_t mode_" | head -150
Length of output: 36
🏁 Script executed:
#!/bin/bash
# Look for setPixelColor calls with computed raw RGB (not palette, not SEGMENT.color)
echo "=== setPixelColor with CRGB or raw computed values ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "setPixelColor.*CRGB\|setPixelColor.*rgb\|setPixelColor.*color_blend\|setPixelColor.*map(" | grep -v "palette\|ColorFrom\|SEGMENT\.color\|//" | head -60
echo ""
echo "=== gamma8inv usage in current FX.cpp ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "gamma8inv\|gamma8(" | head -30
Length of output: 1501
🏁 Script executed:
#!/bin/bash
# Look for effects that use raw arithmetic to compute R,G,B values from wave/sin/data arrays
echo "=== Effects using sin/cos/beat/map to compute color values directly ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "CRGB(" | grep -vE "ColorFromPalette|color_from_palette|//|SEGMENT\.(color|getPixel)|CHSV" | head -100
Length of output: 700
Good start — let me dig deeper with broader patterns and get more context around the suspicious areas.
🏁 Script executed:
#!/bin/bash
# Get context around the TV Simulator gamma usage (lines 4750-4780)
echo "=== TV Simulator gamma usage context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '4720,4790p'
Length of output: 3690
🏁 Script executed:
#!/bin/bash
# Get context around Deep Space (CRGB(2,6,10)) lines 4210-4260
echo "=== Deep Space effect context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '4200,4270p'
Length of output: 3087
🏁 Script executed:
#!/bin/bash
# Get context around flasher gamma8 at line 1579
echo "=== Flasher gamma8 context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '1550,1600p'
Length of output: 2498
🏁 Script executed:
#!/bin/bash
# Broad search for RGBW32 with computed values (not 0,0,0 or segcolors)
echo "=== RGBW32 with computed values ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "RGBW32(" | grep -vE "SEGCOLOR|segcolor|//|RGBW32\(0" | head -60
Length of output: 430
🏁 Script executed:
#!/bin/bash
# Search for patterns where color components are computed from sin8, cos8, beat8, map, wave, etc.
echo "=== Color from sin8/cos8/beat/map assigned to r,g,b variables ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -E "^\s+(r|g|b|red|green|blue|R|G|B)\s*=.*?(sin8|cos8|beat8|map|wave8|triwave8|cubicwave8|quadwave8|scale8)" | head -40
echo ""
echo "=== Functions that look like they build colors from per-channel arithmetic ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -E "setPixelColor.*sin8|setPixelColor.*cos8|setPixelColor.*beat8|setPixelColor.*triwave|setPixelColor.*scale8" | grep -v "//" | head -30
Length of output: 974
🏁 Script executed:
#!/bin/bash
# Search for effects in v0.15.0 that use CRGB with computed values OR RGBW32 with computed values
echo "=== v0.15.0 CRGB( with non-palette non-constant values ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "CRGB(" | grep -vE "ColorFromPalette|color_from_palette|CRGB\(0,|CRGB\(255|//|CHSV|SEGMENT\." | head -60
echo ""
echo "=== v0.15.0 gamma8/gamma8inv usage in FX.cpp ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "gamma8\|gamma8inv" | head -20
Length of output: 1308
🏁 Script executed:
#!/bin/bash
# Look for effects that use color channels r/g/b assigned via sin/cos/beat/map and then call setPixelColor
# Search for broader pattern of 3-component color building
echo "=== Searching for patterns: uint8_t r/g/b = ... followed by setPixelColor ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -E "uint8_t (r|g|b|red|green|blue)\b" | grep -v "//" | head -40
echo ""
echo "=== Gravity center effect context (lines 6830-6880) ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '6820,6890p'
Length of output: 4110
🏁 Script executed:
#!/bin/bash
# Get broader context for the backlight effect at 4920-4960 (already uses gamma8inv)
echo "=== Backlight effect context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '4890,4960p'
echo ""
echo "=== bee effect at line 6175 context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '6155,6195p'
Length of output: 4203
🏁 Script executed:
#!/bin/bash
# Get context around line 7809 - the RGBW32(valueR, valueG, valueB) effect
echo "=== Effect around line 7809 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '7760,7830p'
Length of output: 2927
🏁 Script executed:
#!/bin/bash
# Check what v0.15.0 had around line 7581 (gamma8 on cos8 values) - get surrounding context
echo "=== v0.15.0 context around line 7575-7600 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | sed -n '7560,7610p'
Length of output: 2262
🏁 Script executed:
#!/bin/bash
# Get context around lines 5720-5745 (hardcoded green spawn/trail colors)
echo "=== Effect with hardcoded green RGBW32 values ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '5700,5760p'
Length of output: 2352
🏁 Script executed:
#!/bin/bash
# Get context around lines 1800-1840 (random color RGBW32)
echo "=== Effect with random RGBW32 colors ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '1790,1850p'
Length of output: 2007
🏁 Script executed:
#!/bin/bash
# TV Simulator: compare v0.15.0 gamma8 usage in that effect more carefully
# In v0.15.0 the gamma8 was at lines 4590-4592, and it appears intentional (not a pipeline issue)
# Check what happens with nr/ng/nb downstream in both versions - how they reach setPixelColor
echo "=== TV Simulator: current version lines 4790-4820 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '4790,4830p'
echo ""
echo "=== TV Simulator: v0.15.0 lines 4595-4640 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | sed -n '4595,4640p'
Length of output: 2704
🏁 Script executed:
#!/bin/bash
# Search for effects that use hardcoded or computed color values - look broadly in FX.cpp for
# setPixelColor or fill calls that don't use palette/SEGCOLOR
echo "=== Search for hardcoded color fills that bypass palette ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "\.fill(0x\|\.fill(R\|\.fill(G\|\.fill(B\|\.fill(rgb" | grep -v "//" | head -30
echo ""
echo "=== Search for setPixelColor with 0x hex colors ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "setPixelColor.*0x[0-9A-Fa-f]\{6\}" | grep -v "//" | head -30
Length of output: 1253
🏁 Script executed:
#!/bin/bash
# Check v0.15.0 for the DJLight effect context around line 7246 for comparison
echo "=== v0.15.0 DJLight context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | sed -n '7230,7280p'
echo ""
echo "=== Scan v0.15.0 for ALL direct color construction patterns outside of palette calls ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "RGBW32(" | grep -vE "SEGCOLOR|segcolor|//|RGBW32\(0" | head -40
Length of output: 3420
🏁 Script executed:
#!/bin/bash
# Get context around lines 1055-1070 (hardcoded hex colors)
echo "=== Effect with hardcoded 0x00FF0000 etc ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '1030,1080p'
Length of output: 1863
🏁 Script executed:
#!/bin/bash
# Check sunrise effect for direct color computation
echo "=== Sunrise effect - search for function and look at color computation ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "mode_sunrise\|FX_MODE_SUNRISE" | head -5
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '4260,4380p'
Length of output: 6356
🏁 Script executed:
#!/bin/bash
# Check for effects that compute HSV directly and convert to RGB (not CHSV from palette)
echo "=== Effects using hsv2rgb or direct HSV computation ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "hsv2rgb\|rgb2hsv\|CHSV(\|chsv" | grep -v "//\|ColorFrom\|palette" | head -30
echo ""
echo "=== Effects using color_wheel directly ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "color_wheel\|colorWheel" | grep -v "SEGMENT\.color_wheel\|SEGPALETTE\|//" | head -20
Length of output: 482
🏁 Script executed:
#!/bin/bash
# Search for effects that set pixels from hardcoded or formula-computed values - broader scan
# Look for patterns like: setPixelColor(x, R, G, B) with R/G/B being numbers or variables from formulas
echo "=== setPixelColor with 3 separate channel arguments (not palette) ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "setPixelColor(" | grep -vE "SEGCOLOR|ColorFrom|palette|color_wheel|color_blend|BLACK|WHITE|//" | grep -E "setPixelColor\([^,]+,[^,]+,[^,]+,[^)]+\)" | head -30
Length of output: 350
🏁 Script executed:
#!/bin/bash
# Check v0.15.0 for the traffic light (0x00FF0000) effect context
echo "=== v0.15.0 traffic effect ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "0xFF0000\|0xEECC00\|0x00FF00\|traffic\|Traffic" | head -10
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | sed -n '1010,1060p'
Length of output: 2144
🏁 Script executed:
#!/bin/bash
# Look for any other direct color pattern: especially effects using sin8/cos8 assigned to r,g,b
# and look at the Soap 2D effect which might also compute colors directly
echo "=== 2D Soap effect context ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "mode_2Dsoap\|2Dsoap\|Soap" | head -5
# Get context for Soap
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '7630,7720p'
Length of output: 5001
🏁 Script executed:
#!/bin/bash
# Check for effects in FX.cpp that have sin8/cos8 being used directly as color components
echo "=== Effects setting color from sin8/cos8 used as R/G/B ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n -B2 -A2 "sin8\|cos8" | grep -B2 "setPixelColor\|RGBW32\|CRGB" | grep -v "palette\|ColorFrom\|SEGCOLOR\|//" | head -40
echo ""
# Also check the flow and colorwaves effects
echo "=== Colorwaves and ColorFlow effects ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | grep -n "colorwaves\|ColorWaves\|colorflow\|ColorFlow\|mode_colorwaves\|mode_colorflow" | head -10
Length of output: 1728
🏁 Script executed:
#!/bin/bash
# Get context for line 1984 (CRGB(CHSV(hue8, sat8, bri8)))
echo "=== Context around line 1984 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '1955,2000p'
Length of output: 1587
🏁 Script executed:
#!/bin/bash
# Get context for line 7524 (CRGB(CHSV(92,92,92)))
echo "=== Context around line 7524 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '7495,7545p'
Length of output: 2455
🏁 Script executed:
#!/bin/bash
# Get Funky Plank context (line 7635 area) - check v0.15.0 for comparison
echo "=== Funky Plank current ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/main/wled00/FX.cpp" | sed -n '7610,7660p'
echo ""
echo "=== Funky Plank v0.15.0 ==="
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "FunkyPlank\|funky_plank\|mode_2DFunkyPlank\|CHSV(hue" | head -5
curl -s "https://raw.githubusercontent.com/wled/WLED/v0.15.0/wled00/FX.cpp" | grep -n "FunkyPlank\|FX_MODE_2DFUNKYPLANK" | head -3
(or pre-compute as constants, since they're fixed values)
3. mode_traffic_light — hardcoded signal colours
Hardcoded hex colours are identical in v0.15.0 and current:
0x00FF0000// red0x00EECC00// amber0x0000FF00// green
All three go through the gamma pipeline now and will shift in hue/brightness. Fix: wrap each channel with gamma8inv() when assembling the colour, or define pre-compensated constants.
4. mode_2DFunkyPlank — FFT → CHSV direct
Identical in v0.15.0 (confirmed at line 7419):
int hue = fftResult[band % 16];
int v = map(fftResult[band % 16], 0, 255, 10, 255);
SEGMENT.setPixelColorXY(xpos, 0, CHSV(hue, 255, v));
The v (brightness) is a linear mapping of FFT data. After gamma, low v values (quiet audio) will approach black faster than intended. Fix: CHSV(hue, 255, gamma8inv(v)).
5. mode_waterfall — peak indicator pixel(verify)
The samplePeak pixel uses a hardcoded dim CHSV:
pixels[k] = (uint32_t)CRGB(CHSV(92, 92, 92));
v=92 (~36% brightness) after gamma correction maps to roughly 10–12% perceived output — likely too dim to be a visible indicator. Worth wrapping: CHSV(92, 92, gamma8inv(92)).
Separate class of bug: double gamma (fix = remove manual gamma8(), not add gamma8inv())
mode_tv_simulator
The effect manually applies gamma8() in both v0.15.0 and current:
nr = (uint8_t)gamma8(tvSimulator->actualColorR) * 257;
ng = (uint8_t)gamma8(tvSimulator->actualColorG) * 257;
nb = (uint8_t)gamma8(tvSimulator->actualColorB) * 257;
In v0.16.0 the pipeline then applies gamma again → double correction. The fix here is to remove these three gamma8() calls and let the pipeline handle correction.
Already correctly handled (no action needed)
Effect
Status
mode_pride_2015
✅ Already applies gamma32inv() after CHSV→CRGB conversion
mode_2DDistortionWaves
✅ Manual gamma8() on valueR/G/B was removed from v0.15.0→current; pipeline now handles it correctly
Not candidates
PacificaCRGB(2, 6, 10) / CRGB(2, 5, 7) baseline — values so small (< 4/255) that the perceptual gamma difference is negligible
Fairy Twinklegamma8(fadeprog) — controls the blend ratio between two colours (for perceptual fade linearity), not a raw RGB component; the resulting blended colour goes through pipeline gamma, but the fade curve intent is unchanged
GravcentricCRGB::Gray marker — this was a palette colour in v0.15.0 and changed to fixed gray in current; not the "same logic" criterion
✏️ Learnings added
Learnt from: softhack007
URL: https://github.com/wled/WLED/issues/5603
Timestamp: 2026-05-11T21:39:46.771Z
Learning: In WLED v0.16.0 FX.cpp, the following effects directly compute RGB colors without palettes and need gamma8inv() to restore v0.15.0 visual behavior due to the new gamma pipeline: (1) mode_DJLight - CRGB(fftResult/2); (2) mode_2Dmatrix - hardcoded RGBW32(175,255,175,0)/RGBW32(27,130,39,0) default Matrix green; (3) mode_traffic_light - hardcoded 0x00FF0000/0x00EECC00/0x0000FF00; (4) mode_2DFunkyPlank - CHSV(fftResult,255,map(fftResult,0,255,10,255)) where the v channel needs gamma8inv(); (5) mode_waterfall peak indicator CRGB(CHSV(92,92,92)) where v=92 needs gamma8inv(). Separate bug: mode_tv_simulator applies gamma8() manually in both v0.15.0 AND current, causing double gamma in v0.16.0 - fix is to REMOVE the 3 explicit gamma8() calls at the nr/ng/nb assignments, not to add gamma8inv(). Already correctly handled: mode_pride_2015 (has gamma32inv()) and mode_2DDistortionWaves (manual gamma8 removed, pipeline handles it).
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
not sure how I managed to trigger two responses from the rabbit 😇
Any way, the second run has come up with two interesting new bits:
Effect
Function
Direct color construction
Note
Sun Radiation
mode_2DSunradiation
HeatColor(col / ...)
HeatColor() computes r/g/b directly from temperature without any gamma; output goes straight to setPixelColorXY
Pacifica is the trickiest case. The floor values CRGB(2, 6, 10) and CRGB(2, 5, 7) being gamma-corrected toward near-black is a real regression. However, because the four palette layers (pacifica_one_layer()) operate through ColorFromPalette() — which internally does not apply gamma8inv() — applying gamma8inv() only to the hardcoded floor/ceiling values would create an inconsistency with the palette layers. The right fix for Pacifica might be more nuanced (e.g., SEGMENT.fill(gamma32inv(RGBW32(2,6,10,0))) pattern) or left for a dedicated review.
fixed colors in FX need a correction like I did in #4711 (apply a fixed inverse gamma of 2.2)
colors computed from dynamic values - like DJ light - should use inverseGamma() to get the old look back. Using inverseGamma() does not result in any visible color loss.
changed the title [-]DJ light effect intensity low after upgrade to v16[/-][+]DJ light effect (and others): intensity low after upgrade to v16[/+]on Jun 3, 2026
Activity
[-]DJ ligh effect intensity low after upgrade ro v16[/-][+]DJ ligh effect intensity low after upgrade to v16[/+]netmindz commentedon May 11, 2026
@coderabbitai have any changes been made to this effect between v0.15.0 and v16.0.0 or are we just setting something like different gamma having an effect? Could this also be related to the removal of frame time?
coderabbitai commentedon May 11, 2026
🧩 Analysis chain
Let me first fetch the issue details and then investigate the relevant changes.
🏁 Script executed:
Length of output: 1622
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 711
🏁 Script executed:
Length of output: 91
🏁 Script executed:
Length of output: 315
🏁 Script executed:
Length of output: 327
🏁 Script executed:
Length of output: 4413
🏁 Script executed:
Length of output: 2062
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 3155
🏁 Script executed:
Length of output: 4680
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 2407
🏁 Script executed:
Length of output: 118
🏁 Script executed:
Length of output: 331
🏁 Script executed:
Length of output: 8675
🏁 Script executed:
Length of output: 1758
🏁 Script executed:
Length of output: 891
🏁 Script executed:
Length of output: 69
🏁 Script executed:
Length of output: 4175
🏁 Script executed:
Length of output: 11025
@netmindz, here's what I found after investigating the changes between v0.15.0 and v0.16.0:DJ Light Effect Code: Unchanged
The core logic of
mode_DJLight()is identical between v0.15.0 and v0.16.0 — same FFT data usage (fftResult[15]/2,fftResult[5]/2,fftResult[0]/2), samefadeToBlackBy()call, same pixel shifting. The only difference at the function level is the removal ofreturn FRAMETIME.Most Likely Culprits for the Dimness Bug
1. 🔴 Video Scaling / ABL Overhaul — PR
#4798(commitd5d7fde30f, Aug 2025) — Most LikelyThis is a sweeping change to the brightness pipeline that replaced
NeoPixelBusLg(which had built-in luminance/brightness correction) with plainNeoPixelBus, moving brightness scaling entirely to the bus manager. The commit message notes: "updated color scaling to preserve hue at low brightness" and "improved gamma table calculation: fixed mismatch in inverting gamma table calculation."The impact on DJ Light: the effect already halves the FFT values (
fftResult[]/2, capping at 127), and then further dims viafadeToBlackBy(). Under the new brightness/gamma pipeline, those mid-range color values likely get scaled differently, resulting in visibly lower output brightness. This is consistent with the reported symptom.2. 🟡 Full FastLED Replacement — PR
#4615(commitb7d2c3cd85, Mar 2026)DJ Light directly uses
CRGBandfadeToBlackBy()— both FastLED types. This PR replaced all FastLED dependencies with custom implementations. If thefadeToBlackBy()reimplementation orCRGBcolor math behaves even slightly differently (e.g., different rounding, scaling curve), it would compound with the pipeline changes above to reduce apparent brightness.3. 🟢 FRAMETIME Removal — PR
#5314(commit6b70c6ae91, Feb 2026)This is less likely to be the cause of the dimness itself. The pixel update logic in DJ Light sits inside the
secondHandtimer check (if (SEGENV.aux0 != secondHand)), so actual pixel updates are still rate-limited by that internal timer — not byFRAMETIME. However, the fact that the effect now renders every frame instead of at a fixed interval could interact with the new brightness pipeline if there's any dimming being applied per-frame.Summary
#4798#4615CRGB/fadeToBlackBy()reimplemented#5314The fix would likely need to adjust the color values in
mode_DJLight()to compensate for the new brightness pipeline — e.g., removing the/2division on the FFT values, or adjusting thefadeToBlackBy()mapping, since the color output is now processed differently before reaching the LEDs.softhack007 commentedon May 11, 2026
@CodeRabbit I don't think that either of these is the right solution. My guess
coderabbitai commentedon May 11, 2026
🧩 Analysis chain
Good point — let me look at how
CHSVvsCHSV32differs in WLED's fastLED-slim, and howmode_DJLight()currently usesCHSV.🏁 Script executed:
Length of output: 8122
Let me look at the
CHSV32definition and the fastLED-slim HSV conversion to understand the quality difference.🏁 Script executed:
Length of output: 9604
@softhack007, thank you for the correction — your analysis makes much more sense given the actual code.Looking at
mode_DJLight()more carefully:The FFT values are already hard-capped to a maximum of 127 (due to
/2), and then further reduced byfadeToBlackBy. With gamma correction enabled on top of that, a value of 127 (~50% linear brightness) gets mapped through the gamma table to roughly 22% perceived brightness — which aligns exactly with the "too dim" report. Toggling off gamma correction in LED settings is a great first diagnostic step for the user.On
CHSV32: I can see fromcolors.hthatCHSV32uses a 16-bit hue (uint16_t h, range 0–65535) versusCHSV's 8-bit hue, andhsv2rgb_rainbowuses the lower 13 bits (h & 0x1FFF) for sub-section interpolation — giving 256× finer hue resolution and smoother color transitions. That's a meaningful quality improvement for any effect usingCHSV. Sincemode_DJLight()currently doesn't useCHSVat all (it buildsCRGBdirectly from FFT values), theCHSV32upgrade would apply to other effects in the codebase rather than this one specifically.✏️ Learnings added
softhack007 commentedon May 11, 2026
@netmindz I was actually thinking about the WLED-MM variant of DJLights - the WLED version is simpler, and the core is just one line
WLED/wled00/FX.cpp
Line 7246 in f58187e
So it creates colors directly from 3 FFT bands - if I remember correctly, the "/2" part was originally commented with "avoid pastels".
In 0.15.x, the color values were directly passed to the bus driver level, while in 16.0 we have a gamma correction step in the render path, when going from strip to busses level. That means to re-create previous behaviour, you'd need to put
gamma8inv()around each color component - later during rendering this will be un-done by gamma correction, so as a result the bus drivers receive the same colors as in previous versions.CRGB color = CRGB(gamma8inv(fftResult[15]/2), gamma8inv(fftResult[5]/2), gamma8inv(fftResult[0]/2));However the
gamma8(gamma8inv())processing destroys color accuracy a bit, so maybe also experiment with other solutions, like reducing the FFTResult downscaling - for example use2 * FFTResult[x] / 3to push up the color values (order is important:2 * FFT[x] / 3is not the same asFFT[x] * 2/3).softhack007 commentedon May 11, 2026
coderabbitai commentedon May 11, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 1443
🏁 Script executed:
Length of output: 2769
@softhack007, your analysis is spot on — and I'd actually argue thegamma8inv()approach is the better of the two options, not just an alternative.On
gamma8inv()— this is the right fix:gamma8inv()is already an established pattern in the WLED codebase for exactly this purpose. InFX_fcn.cpp(Line 1419):And in
FXparticleSystem.cpp(Lines 681, 805, 1534–1535),gamma8inv()is used on pixel brightness with the comment "invert brightness so brightness distribution is linear after gamma correction." The proposedmode_DJLight()fix follows exactly this existing idiom.A key benefit:
rawInverseGamma8(andinverseGamma32) guard ongammaCorrectCol— if the user has gamma correction disabled,gamma8inv()is a no-op, so the fix is self-consistent and won't over-brighten for those users.The roundtrip precision loss from
gamma8(gamma8inv(x))is real but already accepted across the codebase, and for a reactive audio effect driven by noisy FFT data, it's unlikely to be perceptible.On
2 * FFTResult[x] / 3:This is a tuning knob for the original
/ 2scaling (the "avoid pastels" intent), independent of the gamma issue. It raises the brightness ceiling from 127 to ~170, which helps regardless of gamma settings, but doesn't address the pipeline delta itself. If gamma is off, the effect would be noticeably brighter than in 0.15.x. The integer arithmetic ordering note (2 * FFT[x] / 3vsFFT[x] * 2/3) is an important correctness point.Suggested approach:
gamma8inv()as the proper gamma-pipeline fix (restores 0.15.x-equivalent output at the bus)/ 2→* 2 / 3scaling change is desirable as a brightness/saturation improvement on its own merits — it's orthogonal and could be done with or without the gamma fix(̶‾᷄♡‾᷅)っ
✏️ Learnings added
softhack007 commentedon May 11, 2026
@coderabbitai please scan through other effects in FX.cpp, and look for similar patterns
0_15_xbranch, and did not apply gamma8() or gamma8inv() in release 0.15.xsummarize your results in as a list of effects that should actually use
gamma8inv()now to re-create the previous effect look.coderabbitai commentedon May 11, 2026
🧩 Analysis chain
Let me do a thorough scan of
FX.cpp— both current and the0_15_xbranch — to identify effects that fit the pattern.🏁 Script executed:
Length of output: 1124
🏁 Script executed:
Length of output: 36
🏁 Script executed:
Length of output: 1501
🏁 Script executed:
Length of output: 700
Good start — let me dig deeper with broader patterns and get more context around the suspicious areas.
🏁 Script executed:
Length of output: 3690
🏁 Script executed:
Length of output: 3087
🏁 Script executed:
Length of output: 2498
🏁 Script executed:
Length of output: 430
🏁 Script executed:
Length of output: 974
🏁 Script executed:
Length of output: 1308
🏁 Script executed:
Length of output: 4110
🏁 Script executed:
Length of output: 4203
🏁 Script executed:
Length of output: 2927
🏁 Script executed:
Length of output: 2262
🏁 Script executed:
Length of output: 2352
🏁 Script executed:
Length of output: 2007
🏁 Script executed:
Length of output: 2704
🏁 Script executed:
Length of output: 1253
🏁 Script executed:
Length of output: 3420
🏁 Script executed:
Length of output: 1863
🏁 Script executed:
Length of output: 6356
🏁 Script executed:
Length of output: 482
🏁 Script executed:
Length of output: 350
🏁 Script executed:
Length of output: 2144
🏁 Script executed:
Length of output: 5001
🏁 Script executed:
Length of output: 1728
🏁 Script executed:
Length of output: 1587
🏁 Script executed:
Length of output: 2455
🏁 Script executed:
Length of output: 2398
🏁 Script executed:
Length of output: 980
@softhack007, here is the full analysis after scanningFX.cppagainst v0.15.0.Effects that should use
gamma8inv()to restore v0.15.0 look1.
mode_DJLight(already discussed)CRGB(fftResult[15]/2, fftResult[5]/2, fftResult[0]/2)— identical in v0.15.0gamma8inv()2.
mode_2Dmatrix— default Matrix green coloursWhen the "custom colour" checkbox is off, the effect uses hardcoded values that are identical in v0.15.0:
With the gamma pipeline,
trailColorin particular (low-value27/39) will look much darker than in v0.15.0. Fix:(or pre-compute as constants, since they're fixed values)
3.
mode_traffic_light— hardcoded signal coloursHardcoded hex colours are identical in v0.15.0 and current:
All three go through the gamma pipeline now and will shift in hue/brightness. Fix: wrap each channel with
gamma8inv()when assembling the colour, or define pre-compensated constants.4.
mode_2DFunkyPlank— FFT → CHSV directIdentical in v0.15.0 (confirmed at line 7419):
The
v(brightness) is a linear mapping of FFT data. After gamma, lowvvalues (quiet audio) will approach black faster than intended. Fix:CHSV(hue, 255, gamma8inv(v)).5.
mode_waterfall— peak indicator pixel (verify)The samplePeak pixel uses a hardcoded dim CHSV:
v=92(~36% brightness) after gamma correction maps to roughly 10–12% perceived output — likely too dim to be a visible indicator. Worth wrapping:CHSV(92, 92, gamma8inv(92)).Separate class of bug: double gamma (fix = remove manual
gamma8(), not addgamma8inv())mode_tv_simulatorThe effect manually applies
gamma8()in both v0.15.0 and current:In v0.16.0 the pipeline then applies gamma again → double correction. The fix here is to remove these three
gamma8()calls and let the pipeline handle correction.Already correctly handled (no action needed)
mode_pride_2015gamma32inv()afterCHSV→CRGBconversionmode_2DDistortionWavesgamma8()onvalueR/G/Bwas removed from v0.15.0→current; pipeline now handles it correctlyNot candidates
CRGB(2, 6, 10)/CRGB(2, 5, 7)baseline — values so small (< 4/255) that the perceptual gamma difference is negligiblegamma8(fadeprog)— controls the blend ratio between two colours (for perceptual fade linearity), not a raw RGB component; the resulting blended colour goes through pipeline gamma, but the fade curve intent is unchangedCRGB::Graymarker — this was a palette colour in v0.15.0 and changed to fixed gray in current; not the "same logic" criterion✏️ Learnings added
coderabbitai commentedon May 11, 2026
softhack007 commentedon May 11, 2026
not sure how I managed to trigger two responses from the rabbit 😇
Any way, the second run has come up with two interesting new bits:
DedeHai commentedon May 12, 2026
fixed colors in FX need a correction like I did in #4711 (apply a fixed inverse gamma of 2.2)
colors computed from dynamic values - like DJ light - should use inverseGamma() to get the old look back. Using inverseGamma() does not result in any visible color loss.
[-]DJ ligh effect intensity low after upgrade to v16[/-][+]DJ light effect intensity low after upgrade to v16[/+][-]DJ light effect intensity low after upgrade to v16[/-][+]DJ light effect (and others): intensity low after upgrade to v16[/+]netmindz commentedon Jun 14, 2026
Has this been fixed as part of other changes or still outstanding @DedeHai ?
DedeHai commentedon Jun 14, 2026
I dont think I fixed this yet but need to check