Servers by jDrones

Using two neopixel lines in one Lua Script

I try to implement a small Position Lights LUA Script. It should use two neopixel LED strips. 8 LEDs should light red, another 8 LEDs should light green. If the plane / copter is armed, they should flash white twice or stay red or green. I decide to use two neopixel outputs at the flight controller because the lights should be mounted at the wingtips and this will reduce the cables needed (go straight from the flight controller to each wingtip).
You can look into my first test script here:

The flight controller is configured with SERVOx_FUNCTION 94 and 95 for pins in one group.

The problem is, I only get neopixel signals out of one RC pin. I checked that with an LA, there are no signals on the other pin.

Any ideas? Should it work this way?

serialLED:send(chan) sends for one DMA group not per channel. So your sending the first strip and then clearing it when you sent the second. Put the send at the end of the update_LEDs loop and only do it for one channel.

Sorry, its not documented anywhere.

Thanks for the fast reply! Unfortunately I still have this issue. When I only call serialLED:set_num_neopixel(chan_right, num_leds) to initialize the LEDs, then I get signals on the other line, but not on both.

Hum, what AP version? LEDs were broken for a bit in master recently.

The other thing you can do is use serialLED:set_RGB(chan, -1, r, g, b) to set all LEDs in the strip to the same color rather than having to do them individually.

I have pushed my updates and rebased it to master. Same issue, but when i split it to two dma groups it is working.

I suspect it might just broken in master, lots of DMA changes recently.

It may work if you only set the number of LEDs on the first channel.

It will look into the code, maybe I can find the issue.

A small follow up, I just grabbed an earlier version from January 2021 Master and that is working without the issue. I will check when this issue was introduced.

1 Like

Should be fixed with https://github.com/ArduPilot/ardupilot/pull/16877

Servers by jDrones