Skip to content

Instantly share code, notes, and snippets.

@magdesign
Last active November 5, 2020 11:48
Show Gist options
  • Save magdesign/a7face5be864c947a3573ecc6bde858a to your computer and use it in GitHub Desktop.
Save magdesign/a7face5be864c947a3573ecc6bde858a to your computer and use it in GitHub Desktop.
Since there is a massive DMX lag, here some approaches to fix it:
*****************************************************************
There is a discussion on this thread:
https://github.com/OpenLightingProject/ola/issues/1677
Latency testing see here:
https://github.com/lemariva/rPI-Tests
1.Use a realtime kernel and do some tests:
******************************************
cd /
wget http://fps.io/raspberrypi4-linux-4.19.65-rt24-v7l+-usb-lowlatency.tar.gz
sudo tar xzf raspberrypi4-linux-4.19.65-rt24-v7l+-usb-lowlatency.tar.gz
sudo reboot
#make performance tests
#test if usb, ftp, hdmi audio, openframeworks is still working
2.Compile newest version of OLA including the patch from @shenghaoyang, create a *.deb file for easy update
currently installed is version 0.10.3 without any patches
***********************************************************************************************************
#make sure you run as a user and not as root!
#completely remove ola and olad version 10.3, proceed with caution since this must be done destructive:
sudo apt-get purge ola -y
sudo rm -rf /usr/local/bin/ola*
sudo rm -rf /etc/ola
sudo rm -rf /usr/share/ola*
sudo rm -rf /usr/local/share/ola*
sudo rm -rf /usr/local/bin/ola*
sudo rm -rf /usr/local/include/ola*
sudo rm -rf /etc/init.d/olad
sudo rm -rf /usr/local/lib/libola*
sudo rm -rf /usr/local/lib/pkgconfig/libola*
sudo rm -rf /var/lib/ola*
sudo apt-get clean -y
sudo apt-get autoclean -y
#sudo apt-get autoremove -y
#then grab the newest version from git
#git clone https://github.com/OpenLightingProject/ola.git
#get the patched version from henghaoyang,
git clone https://github.com/shenghaoyang/ola.git
cd ola
git checkout mitigate-drift
autoreconf -i
make clean
./configure
make -j 4 all
sudo make install
sudo ldconfig
#create the olad service file:
#not needed when later installed via .deb package
sudo nano /etc/systemd/system/olad.service
#content of the file: https://gist.github.com/magdesign/8525b4cda58d5862b80e1098bd1f2547
#create a *.deb file (worls only when wifi is turned off and network to dhcp and unplugged!):
autoreconf -i
./configure
make dist
cp ola-0.X.Y.tar.gz /tmp
cd /tmp
tar -zxf ola-0.X.Y.tar.gz
mv /tmp/ola-0.10.7.tar.gz /tmp/ola_0.10.7.orig.tar.gz
cd ola-0.X.Y
debuild
3.Stop all tasks which are not essential for dmx playback
**********************************************************
#kill samba
sudo kill $(pgrep 'smbd')
#kill shellinabox
service shellinabox stop
#shut down webserver: lighttpd, hostapd
#
#shut down php-cgi, php
#
4.Reserve 2 threads on boot and the use them only for dmx playback
******************************************************************
sudo nano /boot/cmdline.txt
#and add this:
isolcpus=3,4
#which frees core 3 + 4
#then run ola on this free core
taskset -c 3 ./ola_record
5. run the audio player on thread 4
***********************************
#instead of omxplayer use a more lightweight one: aplay or mpg123 (check with htop)
5.Use usb stick to store dmx data
*********************************
check if this will be more performant
6.create ramdisk and copy dmx file to ram
*****************************************
check if this will be more performant (size will be limited!!)
7. Add turbo mode to boot overlay
*********************************
# turbo mode will never throttle the cpu down and generates more heat!
sudo nano /boot/config.txt
#add
force_turbo=1
#if it will not boot anymore, hold down shift key while booting!
8. increase swap to 1024
************************
sudo nano /etc/dphys-swapfile
# replace CONF_SWAPSIZE=100
# with CONF_SWAPSIZE=1024
# reload swap with:
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
# this takes some minute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment