inav icon indicating copy to clipboard operation
inav copied to clipboard

Increase the number of controlled LEDs ws2811 strip to 96

Open TrueMuMa opened this issue 3 years ago • 12 comments

The iNAV firmware currently allows up to 32 ws2811 controllable LEDs. Since many people use this iNAV firmware on aircraft. To make a beautiful backlight, 32 LEDs are not enough. I suggest increasing the number to 96. I'm not good at programming, I may have missed important aspects. If this improvement is possible, I would be happy with these changes. Thanks!

TrueMuMa avatar Dec 12 '22 14:12 TrueMuMa

Have you tested this with more than 32 leds?

mmosca avatar Dec 12 '22 15:12 mmosca

Unfortunately, I do not know how to compile firmware from source. If you can build a firmware for me for Matek H743 with these changes, I will be happy to test and let you know.

TrueMuMa avatar Dec 12 '22 15:12 TrueMuMa

Here's a hex you can test with:

https://drive.google.com/file/d/1vhjrdq4k-fncDSBmzar3UKX83oADl7-f/view?usp=share_link

sensei-hacker avatar Dec 12 '22 17:12 sensei-hacker

Here's a hex you can test with:

https://drive.google.com/file/d/1vhjrdq4k-fncDSBmzar3UKX83oADl7-f/view?usp=share_link

I flashed the firmware, unfortunately the configurator does not allow you to assign more than 32 LEDs. I tried entering the CLI command manually, example: "led 32 0,0::CO:9", but the configurator told me: "### ERROR: index must be between 0 and 31". Perhaps, deeper changes in the code are needed. I don't know where else to look...

TrueMuMa avatar Dec 12 '22 18:12 TrueMuMa

If someone decides to pick this up and implement the code, it may be a good a idea to make it target dependent.

The flight controller may not be able to directly power that many leds and there is also an impact on configuration size on the flash.

Each led takes around 5bytes of flash space to store its configuration, so this change will take at least an extra 320 bytes of flash space. Not an issue on the H743, but may be something to keep in mind as F722s are running low on flash.

mmosca avatar Dec 13 '22 09:12 mmosca

If someone decides to pick this up and implement the code, it may be a good a idea to make it target dependent.

The flight controller may not be able to directly power that many leds and there is also an impact on configuration size on the flash.

Each led takes around 5bytes of flash space to store its configuration, so this change will take at least an extra 320 bytes of flash space. Not an issue on the H743, but may be something to keep in mind as F722s are running low on flash.

Of course, a large number of LEDs are pursued by individual power, I power it from 5A 5V UBEC. I think anyone who wants to install more than 32 LEDs understands what he is doing. I would be very happy if this change was in the release version. 320 bytes looks like a very small amount of memory.

TrueMuMa avatar Dec 13 '22 11:12 TrueMuMa

Yeah, as landing lights (full white), they'll draw about 5.5 amps.

320 bytes looks like a very small amount of memory.

The 722 and 411 are already full. Features have been already been removed from the 411 and 722 builds because not everything will fit. So the question would be "which features do you want to remove next in order to make room for more LEDs?"

That's why it needs defines to limit the change to MCUs with enough flash. 320 bytes doesn't seem like much until until you have to remove two other features to free up those bytes.

sensei-hacker avatar Dec 13 '22 17:12 sensei-hacker

I agree with @sensei-hacker. I'd even go further to say that if you are wanting lots of LEDs, there are much better solutions than using the basic LED system in INAV. For example MUD LED. That is highly configurable and you can use 12v LEDs.

MrD-RC avatar Dec 13 '22 17:12 MrD-RC

I understand, that this feature is far from being the most requested. If you really have problems with memory, then it is better not to implement it.

TrueMuMa avatar Dec 13 '22 17:12 TrueMuMa

Yeah, as landing lights (full white), they'll draw about 5.5 amps.

320 bytes looks like a very small amount of memory.

The 722 and 411 are already full. Features have been already been removed from the 411 and 722 builds because not everything will fit. So the question would be "which features do you want to remove next in order to make room for more LEDs?"

That's why it needs defines to limit the change to MCUs with enough flash. 320 bytes doesn't seem like much until until you have to remove two other features to free up those bytes.

At full power (white), the LEDs usually never light up. The function of LEDs in Inav is good, because the backlight can be controlled from the remote control.

TrueMuMa avatar Dec 13 '22 17:12 TrueMuMa

It may be possible to use the 64 LED code option as added in Betaflight?

https://github.com/betaflight/betaflight/pull/12064

TrueMuMa avatar Dec 27 '22 13:12 TrueMuMa

See #9701 for possibly implementing this.

sensei-hacker avatar Feb 06 '24 18:02 sensei-hacker