Skip to content

Minor optimisation of bit fields and padding - #5857

Open
DedeHai wants to merge 1 commit into
wled:mainfrom
DedeHai:minor_structoptimisations
Open

DedeHai wants to merge 1 commit into
wled:mainfrom
DedeHai:minor_structoptimisations

Conversation

@DedeHai

@DedeHai DedeHai commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Remove some bit fields: they just caused padding to be added and use overhead for access.

result: same RAM footprint as before but saves 300bytes of flash and may speed up some things (not in the hot loop though).

Summary by CodeRabbit

  • Refactor
    • Improved internal data storage and initialization for lighting effects, particle systems, and button state handling.
    • Preserved existing field semantics and behavior while making state management more explicit and consistent.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 70a49f23-a965-4d0d-bf33-e2d3210f4857

📥 Commits

Reviewing files that changed from the base of the PR and between 915565f and b770e9b.

📒 Files selected for processing (3)
  • wled00/FX.h
  • wled00/FXparticleSystem.h
  • wled00/wled.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The changes update member storage and declaration order in WS2812FX, Button, ParticleSystem2D, and ParticleSystem1D. WS2812FX also initializes _currentSegment to nullptr.

Changes

Member layout updates

Layer / File(s) Summary
WS2812FX initialization and member layout
wled00/FX.h
_currentSegment is initialized to nullptr. Selected bit-fields become individual fields, and constructor initializers follow member declaration order.
Button field storage
wled00/wled.h
Button stores type, pressedBefore, and longPressed as separate members instead of packed bit-fields.
Particle system member order
wled00/FXparticleSystem.h
Private members are reordered in ParticleSystem2D and ParticleSystem1D without reported semantic changes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: softhack007

Merge Risk: ⚪ Minimal · up to b770e

The member-layout and initialization updates preserve the identified runtime consumers, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing bit fields and reducing padding. It is concise and specific enough for the changeset.
  • Fix all pre-merge checks with AI

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

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

@DedeHai DedeHai changed the title Minor optimisations Minor optimisation of bit fields and padding Sep 18, 2026
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.

1 participant