Skip to content

Commit

Permalink
Merge pull request #110 from moritzvieli/develop
Browse files Browse the repository at this point in the history
Make it runnable on the Pi 5, minor fixes
  • Loading branch information
moritzvieli authored Jun 3, 2024
2 parents 73c38a9 + ce858d4 commit 0264459
Show file tree
Hide file tree
Showing 19 changed files with 172 additions and 133 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,18 @@ Update apt:
apt-get update
````

Prepare the environment according to [https://github.com/RPi-distro/pi-gen] (e.g. install the required dependencies)
Prepare the environment according to [https://github.com/RPi-distro/pi-gen](pi-gen Readme) (e.g. install the required dependencies)

Run the following script (might take about 45 minutes)
```shell
cd /opt
rm -rf build
mkdir build
cd build

git clone https://github.com/RPi-distro/pi-gen.git
cd pi-gen
git checkout tags/2023-05-03-raspios-bullseye
git checkout tags/2024-03-15-raspios-bookworm-arm64

echo "IMG_NAME='RocketShow'" > config

Expand Down
6 changes: 5 additions & 1 deletion dist/currentversion2.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<versionInfo>
<version>2.3.5</version>
<date>2023-07-31</date>
<date>2024-05-13</date>
<changeNoteList>
<changeNote>
<version>2.3.6</version>
<changes>Support Raspberry Pi 5, bugfix with WLAN AP disable, minor fixes</changes>
</changeNote>
<changeNote>
<version>2.3.5</version>
<changes>Fix logging</changes>
Expand Down
28 changes: 14 additions & 14 deletions dist/install/raspbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
apt-get update
apt-get upgrade -y

apt-get -y install unzip openjdk-17-jdk dnsmasq hostapd fbi ola libnss-mdns iptables alsa-base libasound2 alsa-utils openssh-sftp-server libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-gl
apt-get -y install unzip openjdk-17-jdk dnsmasq hostapd fbi ola libnss-mdns iptables libasound2 alsa-utils openssh-sftp-server libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-gl

# Add the rocketshow user
adduser \
Expand Down Expand Up @@ -172,18 +172,18 @@ chown -R rocketshow:rocketshow /home/rocketshow
# Apply a patch to make seeking videos work on the Raspberry Pi 4
# https://github.com/moritzvieli/rocketshow/issues/7
# See: https://github.com/raspberrypi/linux/issues/3325#issuecomment-684040830
firmware=$(zgrep "firmware as of" \
"/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
uname="$(curl -k -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7l")"
KVER="$(echo ${uname} | grep -Po '\b(Linux version )\K(?<price>[^\ ]+)' | cat)"

cd /lib/modules/${KVER}/kernel/drivers/staging/vc04_services/bcm2835-codec
rm -rf bcm2835-codec.ko
wget https://rocketshow.net/install/patches/bcm2835-codec.ko
mkdir -p /lib/modules/${KVER}/extra
cp bcm2835-codec.ko /lib/modules/${KVER}/extra/bcm2835-codec.ko
#firmware=$(zgrep "firmware as of" \
# "/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
# head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
#uname="$(curl -k -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7l")"
#KVER="$(echo ${uname} | grep -Po '\b(Linux version )\K(?<price>[^\ ]+)' | cat)"
#
#cd /lib/modules/${KVER}/kernel/drivers/staging/vc04_services/bcm2835-codec
#rm -rf bcm2835-codec.ko
#wget https://rocketshow.net/install/patches/bcm2835-codec.ko
#mkdir -p /lib/modules/${KVER}/extra
#cp bcm2835-codec.ko /lib/modules/${KVER}/extra/bcm2835-codec.ko

# Give the setup some time, because umount won't work afterwards if called too fast ("umount: device is busy")
echo "Wait 30 seconds..."
sleep 30s
echo "Wait 5 seconds..."
sleep 5s
1 change: 0 additions & 1 deletion ola-java-client-src/src/main/java/ola/OlaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public OlaClient() throws Exception {
* @return Message result message or null if the call failed.
*/
private Message callRpcMethod(String method, Message inputMessage) {

final Message[] outputMessage = new Message[1];
controller.reset();

Expand Down
102 changes: 48 additions & 54 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ascargon</groupId>
<artifactId>rocketshow</artifactId>
<version>2.3.5</version>
<version>2.3.6</version>
<packaging>jar</packaging>

<name>Rocket Show</name>
Expand Down Expand Up @@ -38,53 +38,53 @@
</plugin>

<!-- Compile the webapp -->
<!-- <plugin>-->
<!-- <groupId>com.github.eirslett</groupId>-->
<!-- <artifactId>frontend-maven-plugin</artifactId>-->
<!-- <version>1.11.0</version>-->
<!-- <configuration>-->
<!-- <workingDirectory>src/main/webapp</workingDirectory>-->
<!-- &lt;!&ndash; where to install npm &ndash;&gt;-->
<!-- <installDirectory>target/npm</installDirectory>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>exec-npm-install</id>-->
<!-- <goals>-->
<!-- <goal>install-node-and-npm</goal>-->
<!-- </goals>-->
<!-- <phase>generate-sources</phase>-->
<!-- <configuration>-->
<!-- <nodeVersion>v10.13.0</nodeVersion>-->
<!-- <npmVersion>6.4.1</npmVersion>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>npm install</id>-->
<!-- <goals>-->
<!-- <goal>npm</goal>-->
<!-- </goals>-->
<!-- &lt;!&ndash; Optional configuration which provides for running any npm command &ndash;&gt;-->
<!-- <configuration>-->
<!-- <arguments>install</arguments>-->
<!-- </configuration>-->
<!-- <phase>generate-sources</phase>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>prod</id>-->
<!-- <goals>-->
<!-- <goal>npm</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- &lt;!&ndash; No caching to make sure, the newest version will always be loaded-->
<!-- (e.g. after an update). Caching anyways only has a small impact, because-->
<!-- the devices are most probably run in an internal network. &ndash;&gt;-->
<!-- <arguments>run prod &#45;&#45; &#45;&#45;output-hashing=all</arguments>-->
<!-- </configuration>-->
<!-- <phase>generate-sources</phase>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.11.0</version>
<configuration>
<workingDirectory>src/main/webapp</workingDirectory>
<!-- where to install npm -->
<installDirectory>target/npm</installDirectory>
</configuration>
<executions>
<execution>
<id>exec-npm-install</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<nodeVersion>v10.13.0</nodeVersion>
<npmVersion>6.4.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<!-- Optional configuration which provides for running any npm command -->
<configuration>
<arguments>install</arguments>
</configuration>
<phase>generate-sources</phase>
</execution>
<execution>
<id>prod</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<!-- No caching to make sure, the newest version will always be loaded
(e.g. after an update). Caching anyways only has a small impact, because
the devices are most probably run in an internal network. -->
<arguments>run prod -- --output-hashing=all</arguments>
</configuration>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -129,12 +129,6 @@
<artifactId>jakarta.activation-api</artifactId>
<version>2.1.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.sun.xml.bind</groupId>-->
<!-- <artifactId>jaxb-impl</artifactId>-->
<!-- <version>4.0.2</version>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->

<!-- HTTP client -->
<dependency>
Expand Down
21 changes: 6 additions & 15 deletions src/main/java/com/ascargon/rocketshow/DefaultSettingsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ private void initDefaultSettings() {
}

if (settings.getAudioOutput() == null) {
if (OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
settings.setAudioOutput(Settings.AudioOutput.DEVICE);
} else if (OperatingSystemInformation.Type.OS_X.equals(operatingSystemInformationService.getOperatingSystemInformation().getType())) {
if (OperatingSystemInformation.Type.OS_X.equals(operatingSystemInformationService.getOperatingSystemInformation().getType())) {
settings.setAudioOutput(Settings.AudioOutput.DEFAULT);
} else if (OperatingSystemInformation.Type.LINUX.equals(operatingSystemInformationService.getOperatingSystemInformation().getType())) {
settings.setAudioOutput(Settings.AudioOutput.DEVICE);
Expand All @@ -198,7 +196,7 @@ private void initDefaultSettings() {
settings.setLoggingLevel(Settings.LoggingLevel.INFO);
}

if (OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
if (OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
// Raspbian-specific settings

if (settings.isEnableRaspberryGpio() == null) {
Expand Down Expand Up @@ -296,10 +294,6 @@ public RemoteDevice getRemoteDeviceByName(String name) {
}

private void setSystemAudioOutput(int id) throws Exception {
if (!OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
return;
}

// TODO Not supported currently
//ShellManager shellManager = new ShellManager(new String[]{"amixer", "cset", "numid=3", String.valueOf(id)});
//shellManager.getProcess().waitFor();
Expand Down Expand Up @@ -404,9 +398,10 @@ private String getAlsaSettings() {
}

private void updateAudioSystem() throws Exception {
if (settings.getAudioOutput() == Settings.AudioOutput.HEADPHONES && OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
// not supported currently
if (settings.getAudioOutput() == Settings.AudioOutput.HEADPHONES && OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
setSystemAudioOutput(1);
} else if (settings.getAudioOutput() == Settings.AudioOutput.HDMI && OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
} else if (settings.getAudioOutput() == Settings.AudioOutput.HDMI && OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
setSystemAudioOutput(2);
} else if (settings.getAudioOutput() == Settings.AudioOutput.DEVICE) {
// Write the audio settings to /home/.asoundrc and use ALSA to
Expand Down Expand Up @@ -487,10 +482,6 @@ private void updateWlanAp() {
String apConfig = "";
String statusCommand;

if (!settings.isWlanApEnable()) {
return;
}

// Update the access point configuration
apConfig += "interface=wlan0\n";
apConfig += "driver=nl80211\n";
Expand Down Expand Up @@ -557,7 +548,7 @@ private void updateSystem() {
logger.error("Could not update the logging level system settings", e);
}

if (OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
if (OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
try {
updateWlanAp();
} catch (Exception e) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/ascargon/rocketshow/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public void setMediaPath(String mediaPath) {

private List<RaspberryGpioControl> raspberryGpioControlList = new ArrayList<>();

// Used to collect all lighting events within a certain amount of time and send them alltogether, not
// one by one as soon as they occur, for performance reasons. The higher, the more events will be "merged",
// the lower, the more CPU it needs.
// To set a delay on lighting events coming from MIDI, use offsetMillisMidi (or the offset on the composition file).
private Integer lightingSendDelayMillis;

// Global play offset on file types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void addVideoToPipelineRaspberry3(CompositionFile compositionFile, int i
pipeline.add(playBin);
}

private void addVideoToPipelineRaspberry4(CompositionFile compositionFile, int index) {
private void addVideoToPipeline(CompositionFile compositionFile, int index) {
URIDecodeBin videoSource = (URIDecodeBin) ElementFactory.make("uridecodebin", "videouridecodebin");
videoSource.set("uri", "file://" + settingsService.getSettings().getBasePath() + settingsService.getSettings().getMediaPath() + File.separator + settingsService.getSettings().getVideoPath() + File.separator + compositionFile.getName());

Expand Down Expand Up @@ -469,12 +469,12 @@ private void createGstreamerPipeline(boolean hasAudioFile) {
// See http://gstreamer-devel.966125.n4.nabble.com/OpenGL-renderer-window-td4686092.html

if (OperatingSystemInformation.Type.LINUX.equals(operatingSystemInformationService.getOperatingSystemInformation().getType())) {
if (OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
if (OperatingSystemInformation.RaspberryVersion.MODEL_3.equals(operatingSystemInformationService.getOperatingSystemInformation().getRaspberryVersion())) {
addVideoToPipelineRaspberry3(compositionFile, i);
} else if (OperatingSystemInformation.RaspberryVersion.MODEL_4.equals(operatingSystemInformationService.getOperatingSystemInformation().getRaspberryVersion())) {
addVideoToPipelineRaspberry4(compositionFile, i);
}
if (OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())
&& OperatingSystemInformation.RaspberryVersion.MODEL_3.equals(operatingSystemInformationService.getOperatingSystemInformation().getRaspberryVersion())) {

addVideoToPipelineRaspberry3(compositionFile, i);
} else {
addVideoToPipeline(compositionFile, i);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DefaultImageDisplayingService(SettingsService settingsService, OperatingS
shellManager = new ShellManager(new String[]{"sh"});

// Display a default black screen on Raspbian
if (OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
if (OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
display(settingsService.getSettings().getBasePath() + "black.jpg");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class DefaultLightingService implements LightingService {

private boolean externalSync = false;

// is OLA initialized and at least one universe prepared?
private boolean olaReady = false;

public DefaultLightingService(SettingsService settingsService, CapabilitiesService capabilitiesService, ActivityNotificationLightingService activityNotificationLightingService) {
this.settingsService = settingsService;
this.capabilitiesService = capabilitiesService;
Expand Down Expand Up @@ -129,7 +132,7 @@ private void sendUniverse() {
mixedUniverse[i] = (short) highestValue;
}

if (olaClient != null) {
if (olaReady) {
olaClient.sendDmx(1, mixedUniverse);
}

Expand Down Expand Up @@ -274,6 +277,7 @@ private void initializeUniverse() {
if (universeInfoReply != null) {
if (universeInfoReply.getUniverseCount() > 0) {
// At least one universe is already initialized
olaReady = true;
return;
}
}
Expand All @@ -285,7 +289,7 @@ private void initializeUniverse() {
try {
portId = getConnectedPort();
} catch (Exception e) {
logger.error("Could not get a output port", e);
logger.error("Could not get an output port", e);
}

if (portId == null || portId.length() == 0) {
Expand All @@ -299,6 +303,7 @@ private void initializeUniverse() {
// Create the port with the device-id, "O" for output and the port
// ID
createOlaUniverse(portId);
olaReady = true;
} catch (Exception e) {
logger.error("Could not create a new universe on OLA", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DefaultFactoryResetService(OperatingSystemInformationService operatingSys

@Override
public void reset() throws Exception {
if (!OperatingSystemInformation.SubType.RASPBIAN.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
if (!OperatingSystemInformation.SubType.RASPBERRYOS.equals(operatingSystemInformationService.getOperatingSystemInformation().getSubType())) {
return;
}

Expand Down
Loading

0 comments on commit 0264459

Please sign in to comment.