I have a 62 Neopixels in a chain and is being provided external power with shared ground.
When the printer starts up the LEDs all correctly light up based on the initial_COLOR [neopixel] settings.
Problems start when using SET_LED.
The last 0-20 LEDs do not always change to their correct state. The bug can be replicated but the outcome is not always the same, the number of LEDs not changing state is not always the same.
In some cases the last 10-15 LEDs seem to glitch and change in a group rather than one by one (this is best seen in the videos at the end).
I had to add the rest of this post as separate replies due to the new user limits.
I have a few test macros since I have been trying to debug this myself.
First is ‘led_test_bug’ which loops through all 62 LEDs and immediatly sets the colour which gives the effect of a growing rainbow.
The second ‘led_test_bug2’ loops through a few colours for the whole chain at once.
Since macros are in the log I won’t include them here.
Rather than write out in loads of words I recorded a few videos showing the issues.
Shows the LEDs ‘glitching’ near the end and missing 5 LED updates.
LEDs changing colours at the same time for the chain showing missing LED updates
If you want to try the above, modify the klippy/extras/neopixel.py file and increase the BIT_MAX_TIME parameter to .000030. After any change to the source code you must run a full sudo service klipper restart for that change to take effect.
I was experimenting with the firmware side and did get much more reliable behaviour by commenting out the following in src/neopixel.c
if (neopixel_check_elapsed(last_start, start, bit_max_ticks)) goto fail;
Your solution resolves the error rather than mine just hiding it!
Is this something that could make its way into the main branch to avoid others having the same issue? I appreciate you may not want to break old neopixel setups but maybe exposing this setting in the printer.cfg and documentation may help others tweak.