Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

Fix gamma correction not enabled on fresh install

  • Understand the issue: gammaCorrectCol initialized as true but gets overwritten to false on fresh install
  • Analyze config loading code in cfg.cpp
  • Fix the config loading to use proper defaults when config file doesn't exist
    • Added default value using gammaCorrectVal for light_gc_col (matches gammaCorrectCol = true default)
    • Added default value 1.0f for light_gc_bri (matches gammaCorrectBri = false default)
  • Test the fix to ensure gamma correction is enabled on fresh install
  • Run build and test suite to validate changes
    • npm test - All 16 tests passed ✓
    • pio run -e esp32dev - Build successful ✓
  • Code review completed - No issues found ✓
  • Security scan completed - No vulnerabilities ✓
  • Address PR feedback
    • Use gammaCorrectVal instead of hardcoded 2.2f for better maintainability ✓
    • Remove _codeql_detected_source_root file ✓
    • Revert changes to .gitignore

Summary:
Fixed the gamma correction initialization bug by adding proper default values in the configuration loading code. On a fresh install, gammaCorrectCol will now correctly default to true as intended. Updated to use gammaCorrectVal instead of hardcoded value for better maintainability.

Original prompt

This section details on the original issue you should resolve

<issue_title>"Use Gamma correction for color" not enabled on fresh install</issue_title>
<issue_description>### What happened?

on fresh installs, color gamma correction is not enabled, even though the variable gammaCorrectCol is initialized as true.

To Reproduce Bug

Expected Behavior

Should be enabled on a fresh install.

Install Method

Self-Compiled

What version of WLED?

0.16

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

<agent_instructions>please check the first-boot logic when no config file exists and determine why the init value is not used.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits December 23, 2025 10:29
Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix gamma correction not enabled on fresh install Fix gamma correction for color not enabled on fresh install Dec 23, 2025
Copilot AI requested a review from DedeHai December 23, 2025 10:31
wled00/cfg.cpp Outdated
float light_gc_bri = light["gc"]["bri"];
float light_gc_col = light["gc"]["col"];
float light_gc_bri = light["gc"]["bri"] | 1.0f; // default to 1.0 (false)
float light_gc_col = light["gc"]["col"] | 2.2f; // default to 2.2 (true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not initialize to gammaCorrectVal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Changed to use gammaCorrectVal instead of hardcoded 2.2f for better maintainability. Fixed in b68a9e0.

@@ -0,0 +1 @@
. No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

File removed and added to .gitignore to prevent it from being committed again. Fixed in b68a9e0.

@DedeHai
Copy link
Collaborator

DedeHai commented Dec 23, 2025

@copilot please address comments

Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot please address comments

Both comments have been addressed in commit b68a9e0:

  1. Line 510 now uses gammaCorrectVal instead of hardcoded 2.2f
  2. _codeql_detected_source_root file removed and added to .gitignore

.gitignore Outdated
/wled00/html_*.h

# CodeQL
_codeql_detected_source_root
Copy link
Collaborator

Choose a reason for hiding this comment

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

revert changes to itignore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 48fab36.

@DedeHai
Copy link
Collaborator

DedeHai commented Dec 23, 2025

@copilot revert changes to itignore

Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot revert changes to itignore

Changes to .gitignore reverted in 48fab36.

Copilot AI requested a review from DedeHai December 23, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Use Gamma correction for color" not enabled on fresh install

2 participants