Skip to content

fix(lua): LED_STRIP_LENGTH is decorative LEDs only - #7716

Open
davidbitton wants to merge 1 commit into
EdgeTX:mainfrom
davidbitton:feat/lua-bling-led-strip-length
Open

fix(lua): LED_STRIP_LENGTH is decorative LEDs only#7716
davidbitton wants to merge 1 commit into
EdgeTX:mainfrom
davidbitton:feat/lua-bling-led-strip-length

Conversation

@davidbitton

Copy link
Copy Markdown

Summary of changes:

Lua setRGBLedColor(0, ...) is already the first decorative ("bling") LED, not hardware index 0. LED_STRIP_LENGTH was still bling + CFS, so strip scripts that loop 0 .. LED_STRIP_LENGTH-1 also walked function-switch LEDs. On TX16S Mk3 / GX15 / TX15 that is 26 instead of 20, and dual-ring math (HALF = N/2) splits at 13 instead of 10. Configured CFS LEDs are already rejected by setRGBLedColor(); they belong to setCFSLedColor() / model on-off colours.

  • LED_STRIP_LENGTH is now the decorative count (BLING_LED_STRIP_LENGTH)
  • Export BLING_LED_STRIP_LENGTH and CFS_LED_STRIP_LENGTH so scripts can see both ranges
  • Export FUNC_RGB_LED so tools do not have to hardcode enum value 25
  • Document the index space on setRGBLedColor()

This matches the index mapping from #7304. Existing scripts that iterate LED_STRIP_LENGTH will now paint only the gimbal/bling LEDs, which is what they intend. Function-switch LEDs are unchanged for configured switches.

Companion change: no

Radio: TX16S Mk3 / GX15 / TX15 (20 bling + 6 CFS); also radios that only have one of the two ranges

Related: https://github.com/pigd0g/EdgeTx-RGB-Toolbox

Lua index 0 is already the first bling LED. Reporting bling+CFS as
LED_STRIP_LENGTH made strip scripts walk function-switch LEDs and split
dual-ring patterns at the wrong index.

Export BLING_LED_STRIP_LENGTH, CFS_LED_STRIP_LENGTH, and FUNC_RGB_LED
so scripts can address each range and install the RGB LED special
function without hardcoding the enum value.
@philmoz

philmoz commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

May break existing scripts that use LED_STRIP_LENGTH.
The LEDs for function switches that are disabled can be set with setRGBLedColor.
Reducing the value of LED_STRIP_LENGTH breaks this.

@pfeerick pfeerick 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.

Thanks... it looks like FUNC_RGB_LED was missing right from the start in #3909.

You can't just change what existing API calls do as it will break all the pre-existing scripts... so doing what you did will not only not get merged in it's current form, but is wasteful... every entry in the lua table costs memory regardless if you use the feature or not, so there is no point having duplicated entires doing the same thing.

// LED_STRIP_LENGTH matches the Lua index space of setRGBLedColor() for
// decorative LEDs (index 0 is the first bling LED). CFS LEDs are separate
// and should be driven with setCFSLedColor().
LROT_NUMENTRY( LED_STRIP_LENGTH, BLING_LED_STRIP_LENGTH )

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.

Revert this to it's prior form.

@pfeerick pfeerick added bug 🪲 Something isn't working lua-api Lua API related labels Aug 27, 2026
@philmoz

philmoz commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

CFS_LED_STRIP_LENGTH can be calculated so probably does not need to explicitly defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working lua-api Lua API related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants