Skip to content

Commit ff85094

Browse files
committed
feat(ci): add build workflows for satellite1-v1.0
Add new build jobs for Satellite-1 1.0 and its Linux Voice Assistant variant to the build-all workflow. This includes the addition of the `02-stage-audiodriver-satellite1-v1.0` stage.
1 parent a71b63f commit ff85094

7 files changed

Lines changed: 189 additions & 0 deletions

File tree

.github/workflows/build-all.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ jobs:
7070
compression-level: 6
7171
custom-hostname: picompose
7272

73+
# Satellite-1 1.0
74+
build-satellite1-v1dot0:
75+
uses: ./.github/workflows/build-image-template.yml
76+
with:
77+
image-name: PiCompose_Satellite1-v1.0
78+
stage-list: stage0 stage1 stage2 ./01-stage-picompose ./02-stage-audiodriver-satellite1-v1.0 ./04-stage-finish
79+
compression: xz
80+
compression-level: 6
81+
custom-hostname: picompose
82+
83+
build-satellite1-v1dot0-lva:
84+
uses: ./.github/workflows/build-image-template.yml
85+
with:
86+
image-name: PiCompose_Satellite1-v1.0_Linux-Voice-Assistant
87+
stage-list: stage0 stage1 stage2 ./01-stage-picompose ./02-stage-audiodriver-satellite1-v1.0 ./03-stage-linux-voice-assistant ./04-stage-finish
88+
compression: xz
89+
compression-level: 6
90+
custom-hostname: picompose
91+
7392
# RPI IMAGER JSON
7493
generate-rpi-imager-json:
7594
needs: [build, build-2michat, build-respeaker_lite, build-2michat-lva, build-respeaker_lite-lva]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
git
2+
dkms
3+
curl
4+
wget
5+
dkms
6+
i2c-tools
7+
libasound2-plugins
8+
alsa-utils
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash -e
2+
3+
# Installs drivers for the ReSpeaker 2mic and 4mic HATs on Raspberry Pi OS.
4+
# Must be run with sudo.
5+
# Requires: curl raspberrypi-kernel-headers dkms i2c-tools libasound2-plugins alsa-utils
6+
7+
echo "Starting satellite1 driver installation..."
8+
9+
# 1. Install the Custom Kernel
10+
echo "Download and install Custom Kernel"
11+
# wget https://github.com/florian-asche/Satellite1-RPi/releases/download/develop/linux-headers-6.18.29-fusb302-rpi-v8_2_arm64.deb
12+
wget https://github.com/florian-asche/Satellite1-RPi/releases/download/develop/linux-image-6.18.29-fusb302-rpi-v8_2_arm64.deb
13+
dpkg -i linux-image-*-fusb302-rpi-v8_*_arm64.deb
14+
15+
16+
# 2. Install System Configuration
17+
echo "Download and install System configuration"
18+
wget https://github.com/florian-asche/Satellite1-RPi/releases/download/develop/satellite1-rpi-setup_1.0-1_arm64.deb
19+
dpkg -i satellite1-rpi-setup_*_arm64.deb
20+
21+
22+
# 3. Install the Python SDK
23+
echo "Download and install Python SDK"
24+
wget https://github.com/florian-asche/Satellite1-RPi/releases/download/develop/satellite1-rpi-sdk_0.1.5_arm64.deb
25+
dpkg -i satellite1-rpi-sdk_*_arm64.deb
26+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash -e
2+
3+
# Install the compose-manager script
4+
install -v -m 755 files/configure_audio.sh "${ROOTFS_DIR}/usr/bin/configure_audio.sh"
5+
6+
# Copy the systemd service
7+
install -v -m 644 files/configure_audio.service "${ROOTFS_DIR}/etc/systemd/system/configure_audio.service"
8+
9+
on_chroot << EOF
10+
# Enable services
11+
echo "Enable audio services"
12+
systemctl daemon-reload
13+
systemctl enable configure_audio.service
14+
EOF
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=PiCompose - Configure Audio volume setting
3+
After=user@1000.service sound.target alsa-restore.service seeed-voicecard.service
4+
Wants=user@1000.service sound.target alsa-restore.service seeed-voicecard.service
5+
6+
[Service]
7+
Type=oneshot
8+
Environment=XDG_RUNTIME_DIR=/run/user/1000
9+
ExecStart=/usr/bin/configure_audio.sh
10+
RemainAfterExit=yes
11+
Restart=on-failure
12+
RestartSec=30s
13+
14+
[Install]
15+
WantedBy=multi-user.target
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
set -u
3+
4+
5+
set_volume_safe() {
6+
local volume="${1:-1.0}"
7+
8+
if wpctl get-volume @DEFAULT_AUDIO_SINK@ >/dev/null 2>&1; then
9+
wpctl set-volume @DEFAULT_AUDIO_SINK@ "$volume"
10+
echo "Volume set to $volume"
11+
return 0
12+
else
13+
echo "No default audio sink available"
14+
exit 1
15+
fi
16+
}
17+
18+
wait_for_audio() {
19+
local max_tries="${1:-30}"
20+
local sleep_time="${2:-1}"
21+
22+
local i=0
23+
while [ $i -lt $max_tries ]; do
24+
if wpctl get-volume @DEFAULT_AUDIO_SINK@ >/dev/null 2>&1; then
25+
echo "Audio ready"
26+
return 0
27+
fi
28+
29+
echo "Waiting for audio... ($i/$max_tries)"
30+
sleep "$sleep_time"
31+
i=$((i+1))
32+
done
33+
34+
echo "Timeout: Audio not ready"
35+
exit 1
36+
}
37+
38+
wait_for_card_and_control() {
39+
local card="$1"
40+
local control="$2"
41+
local max_tries=30
42+
local sleep_sec=1
43+
local count=0
44+
45+
while [ "$count" -lt "$max_tries" ]; do
46+
count=$((count + 1))
47+
48+
if amixer -c "$card" info >/dev/null 2>&1; then
49+
if amixer -c "$card" scontrols | grep -Fq "'$control'"; then
50+
echo "Card $card with control '$control' is ready ($count/$max_tries)"
51+
return 0
52+
fi
53+
echo "Card $card found, but control '$control' not ready yet ($count/$max_tries)"
54+
else
55+
echo "Card $card not ready yet ($count/$max_tries)"
56+
fi
57+
58+
sleep "$sleep_sec"
59+
done
60+
61+
echo "Card $card with control '$control' did not become ready"
62+
return 1
63+
}
64+
65+
set_control_if_exists() {
66+
local card="$1"
67+
local control="$2"
68+
local value="$3"
69+
70+
if amixer -c "$card" scontrols | grep -Fq "'$control'"; then
71+
echo "Setting $control on $card to $value"
72+
amixer -c "$card" set "$control" "$value"
73+
return 0
74+
fi
75+
76+
echo "Control '$control' not found on $card, skipping"
77+
return 0
78+
}
79+
80+
# Wait for audio system to be ready
81+
wait_for_audio 30 1
82+
83+
# Check if the card is ok
84+
if wait_for_card_and_control seeed2micvoicec Headphone; then
85+
CARD="seeed2micvoicec"
86+
echo "seeed2micvoicec found"
87+
else
88+
echo "No supported sound card became ready"
89+
exit 1
90+
fi
91+
92+
# Set volume
93+
set_control_if_exists "$CARD" Headphone 100%
94+
set_control_if_exists "$CARD" Speaker 100%
95+
set_control_if_exists "$CARD" Master 100%
96+
set_control_if_exists "$CARD" PCM 100%
97+
98+
# Set pipewire sink volume
99+
set_volume_safe 1.0
100+
101+
# Alsa save
102+
alsactl store
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
if [ ! -d "${ROOTFS_DIR}" ]; then
4+
copy_previous
5+
fi

0 commit comments

Comments
 (0)