Neopixel Integration with PX4
-
Re: Neopixel GPIO control on VOXL2 SPI port
Hello all,
We have been trying to integrate Neopixel on io_0 and io_3 in PX4 to control with "led_control" and, in case not possible, with voxl-send-neopixel-cmd.
However, with voxl-send-neopixel-cmd, we can't define color, just turn the RGB strip on or change the number of LEDs. When trying to use it on PX4 with "voxl-esc led -l 0x001", it does not run, due to the modal_io_bridge priority.system-image 1.7.8-M0054-14.1a-perf
hx platform: M0054 1.0.0
voxl-suite:1.3.2Thank you in advance for any help!
Regards,
Jacob -
The source code of
voxl-send-neopixel-cmd
test tool is here : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-io-server/-/blob/master/tools/voxl-send-neopixel-cmd.cThe function that creates a binary packet (which is forwarded to the ESC via PX4) is here : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-io-server/-/blob/master/lib/modal_io.c#L181 . Basically you need to provide the following information to this function:
- number of LEDs you are controlling
- LED type (RGB or RGBW)
- array of LED colors (3 bytes for each LED in case of RGB, or 4 bytes per LED for RGBW).
- the array should contain all LED values ranging from 0-255, so if you had 3 LEDs and first should be red, second green and third blue (50% power), the LED color array would be : [127, 0, 0, 0, 127, 0, 0,0,127].
- this function will create a packet with checksum and send it to PX4, and PX4 will forward the packet to the ESC.
You can modify the
voxl-send-neopixel-cmd
to do what you need, maybe you can make it accept an array of LED color values via command line.I know the tool could have been more helpful. If you describe your use case, maybe I can help improve the
voxl-send-neopixel-cmd
tool.Alex