Skip to content

Fix debug build compilation error in BH1750 usermod - #6019

Merged
softhack007 merged 2 commits into
wled:mainfrom
AntonTaranov:patch-1
Dec 4, 2026
Merged

softhack007 merged 2 commits into
wled:mainfrom
AntonTaranov:patch-1

Conversation

@AntonTaranov

@AntonTaranov AntonTaranov commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What it does

Fixes a compilation error in the luminance (BH1750) usermod when building the firmware with debug logging enabled (-D WLED_DEBUG). 

Additional references and context

  • Encountered while compiling a custom debug build locally.

How it works

Direct concatenation of const __FlashStringHelper* (F(...)) with + fails to compile (invalid operands of types 'const __FlashStringHelper*' and 'String' to binary 'operator+'). Splitting the log output into sequential DEBUG_PRINT / DEBUG_PRINTLN calls fixes the build error and avoids creating temporary String objects on the heap. 

AI assistance: yes

  • What the AI drafted: Helped formulate the PR description in English and confirmed the technical explanation of why F() concatenation fails.
  • What I designed/coded myself: Found the compilation error during my own debug build, identified the exact line causing it, and applied the fix.
  • What I verified/tested myself: Verified the code diff and confirmed that the firmware compiles cleanly with -D WLED_DEBUG enabled.
  • Untested / unsure about: None.

Testing and Validation

  • Tested on actual hardware: 

    • Compiled with -D WLED_DEBUG enabled and verified successful build without errors.
  • Open ends, known limitations, breaking changes: 

    • None.
  • Anything you couldn't quite solve? 

    • Nothing.

Checklist

  • I have personally reviewed all changes (incl. source code) before opening this PR.
  • I'm ready to explain my proposed source code changes in detail (without an AI agent answering for me).
  • I agree to follow this project's Code of Conduct.

Summary by CodeRabbit

  • Chores
    • Updated how brightness diagnostic output is written. The displayed text and value remain unchanged, so there is no visible change to the brightness information.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: wled/WLED
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: dc9c645
  • Layers: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f84418e3-fbaf-4981-831c-0e2f42e86b0d
Commits

Reviewing files that changed from the base of the PR and between ee04afb and 431f4f4.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Walkthrough

The BH1750 brightness debug output now uses separate print calls for the label, lux value, and lx suffix. The displayed text and value remain unchanged. Usermod registration is unchanged.

Changes

Brightness logging

Layer / File(s) Summary
Brightness log output
usermods/BH1750_v2/BH1750_v2.cpp
The brightness log uses separate calls for the label, lux value, and lx suffix. The usermod registration remains unchanged.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: netmindz, albarlow

Merge Risk: Minimal · previous review ee04a

This fixes a compile error in debug builds of the BH1750 usermod. The printed text and value are unchanged, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: fixing a debug build compilation error in the BH1750 usermod. The raw summary describes splitting the brightness debug output into three print calls instead of one con…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: fixing a debug build compilation error in the BH1750 usermod. The raw summary describes splitting the brightness debug output into three print calls instead of one concatenated string, which removes the failing F() plus String concatenation. The PR objectives confirm that the error came from concatenating an F(...) flash string with a String under -D WLED_DEBUG. The title matches the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@softhack007 softhack007 added this to the 16.1 milestone Dec 2, 2026

@softhack007 softhack007 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable. OK for me to merge this, and cherry-pick into 16_x.

@softhack007 softhack007 added bug usermod usermod related AI Partly generated by an AI. Make sure that the contributor fully understands the code! labels Dec 2, 2026
@softhack007
softhack007 merged commit 7aeec3e into wled:main Dec 4, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Partly generated by an AI. Make sure that the contributor fully understands the code! bug usermod usermod related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants