Speeding things up


Project maintained by profezzorn Hosted on GitHub Pages — Theme by mattgraham

Sometimes, ProffieOS will run slowly, because it has too many things to do and too little time to do it. Here is a list of possible things you can do about it.

Use the "top" command to identify what is using up all the CPU time. 🔗

Note that "top" will not be available if you have #define DISABLE_DIAGNOSTICS_COMMANDS active in your config file. Also note that "top" produces very different numbers when the saber is on and when it's off. Finally, "top" shows the CPU statistics since the last time you ran it, so generally you will want to turn the saber on, run "top", wait a few seconds, then run "top" again.

Turn on Optimization 🔗

There are 4 levels to choose from under Arduino menu Tools>Optimize, however, the labels are a bit misleading.

For a better description, check out actual documentation:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Lots of things gets faster when you turn on optimization. However, they also get bigger, so you may run out of flash memory.
See the Saving Memory page for how to reduce flash memory usage.

Use ProffieOS 5.x or later 🔗

ProffieOS 5.x has a better WS281X driver which is both faster and uses less RAM. In addition, if you set maxLedsPerStrip to a number a little higher than it needs to be, ProffieOS 5.x will be able to run styles and feed out data more effectively in parallel.

Overclock pixel strips 🔗

While nearly all WS281X are specified to run at 800kHz, most of them can run faster than that, so you can get things to run a little faster and smoother by feeding out bits faster. To do so, you would change a typical blade definition from:

 WS281XBladePtr<529, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()

to:

 WS281XBladePtr<529, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>, DefaultPinClass, 1000000>()

Speed up the SD card 🔗

A slow SD card can slow down ProffieOS a lot. So make sure that your SD card is fast enough. In addition, there are things you can do to make it easier for ProffieOS to find files on the SD card, which is a small, but helpful speedup:

Finally, sometimes SD cards become slow as they get older. Doing the format-and-replace-all-the-files maneuver might fix such problems, but at some point, you may need to just replace the SD card even if it was working fine in the past.