Is there a simple way to mod the library to loop the same pixels x amount of times?
The reason for this is to test more pixels without the need of more memory.
You see, I have this problem with led’s lagging more and more the further out you get.
My setup is an RFduino, 3 meters of 144-leds-per-meter strip and a 24 amp 5V. I’ve also added some extra power wires to make up for the strips internal voltage so I don’t think it’s caused by power problems. I rather think it’s a timing issue.
It looks like the lag starts somewhere around led #150. I have also tried running with a regular Arduino. The memory limit can only get me so far as 200 led’s but it looks like there’s no lag. So, it would be neat to be able to redraw the same pixels multiple times to get past the memory limit of my Arduino to finally see if the lag is a hardware of software issue.
The video shows the issue quite sell, but interestingly some if the patterns are animated smoothly?
Ok, after testing this example that doesn’t have a memory limit:
The pixels are animated smooth as can be! So what now? There’s a timing issue in the RFduino? Is this something that can be calibrated or is it a problem inherent to the way the ARM Cortex M0 it’s based on works?
I found yet another code directly controlling the strip but from an RFduino. Perfect! So I modified the above code with the bit writing code here: http://thomasolson.com/PROJECTS/MIDI/MIDI_WS2812
The timing used in this code does wonders! It animates beautifully with no stuttering at all towards the end of the strip.
So there is clearly some issue in the timing in FastLED for RFduino. I really want to use the awesome features of FastLED so I might look into what needs to be modified. It’s gonna be a daunting task to try to understand the lib, if anyone have better understanding and can do this more quickly than a novice, give me a heads up
Yeah - I should change the default to disallow interrupts on the rfduino. The problem is that some of Nordic’s Bluetooth soft devices will crash the device if interrupts are disabled for too long - but I don’t know specifics of what rfduino is using (the rfduino port is based on some work that I did on a project that was based on the nrf51822 chip that the rfduino uses as well)
So are the RFDuino hardware also causing interrupts by default? While I did have interrupts enabled, I can’t think of anything that would cause interrupts, if not the bluetooth module.
The systick timer, fires once a millisecond, 1000 times a second. If the timing of it firing happens to mean prolonging the gap between writing individual led data beyond the threshold (5-10us I believe) then the library stops writing the frame out. Also if you’ve done anything to turn the Bluetooth hardware on, then yes it will also start throwing interrupts.
5us is only 80 clock cycles - dispatching an interrupt eats some number of those and the enter/exit of an interrupt function can quickly turn into another 20-30 cycles - the Arduino library interrupt for the systick timer is pretty expensive. And we haven’t even touched on the interrupt handlers for Nordic’s Bluetooth soft devices, which I have clocked at as high as 1ms. (This is why I should just disable allowing interrupts by default for the rfduino - it’s only a 16mhz clock)