Skip to content

Commit afe2ace

Browse files
authored
Merge pull request #4 from Aharoni-Lab/feat/led-status-display
feat: add addressable RGB LED status display system
2 parents df53e03 + 5f060a1 commit afe2ace

25 files changed

Lines changed: 2170 additions & 3 deletions

bootstrap/bootstrap_pi.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ else
4444
echo "Run manually: sudo ${SCRIPT_DIR}/install_publisher.sh $REPO_DIR <url> <key>"
4545
fi
4646

47+
"${SCRIPT_DIR}/install_led_service.sh" "$REPO_DIR"
48+
4749
echo ""
4850
echo "=== Bootstrap complete for ${BENCH_NAME} ==="
4951
echo "Config: /etc/hil-bench/config.yaml"

bootstrap/install_led_service.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# Install the LED daemon service.
3+
# Idempotent — safe to re-run.
4+
#
5+
# Usage: sudo ./install_led_service.sh <repo-dir>
6+
set -euo pipefail
7+
8+
REPO_DIR="${1:?Usage: $0 <repo-dir>}"
9+
VENV="/opt/hil-bench/venv"
10+
SYSTEMD_DST="/etc/systemd/system"
11+
12+
echo "--- Installing LED service ---"
13+
14+
# Install rpi_ws281x into venv
15+
if [[ -d "$VENV" ]]; then
16+
echo "Installing rpi_ws281x package..."
17+
"${VENV}/bin/pip" install --quiet "rpi_ws281x>=5.0"
18+
else
19+
echo "WARNING: venv not found at $VENV — run install_python_env.sh first"
20+
fi
21+
22+
# Install systemd unit
23+
UNIT_SRC="${REPO_DIR}/systemd/hil-bench-led.service"
24+
if [[ -f "$UNIT_SRC" ]]; then
25+
cp "$UNIT_SRC" "${SYSTEMD_DST}/hil-bench-led.service"
26+
systemctl daemon-reload
27+
systemctl enable hil-bench-led.service
28+
echo "Installed and enabled: ${SYSTEMD_DST}/hil-bench-led.service"
29+
else
30+
echo "WARNING: Service file not found: $UNIT_SRC"
31+
fi
32+
33+
echo "--- LED service install done ---"
34+
echo "Start with: sudo systemctl start hil-bench-led"

bootstrap/update.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,17 @@ echo "--- Refreshing health timer ---"
5151
echo "--- Refreshing udev rules ---"
5252
"${SCRIPT_DIR}/install_udev_rules.sh" "$REPO_DIR"
5353

54-
# ── 6. Done ──────────────────────────────────────────────────────────────
54+
# ── 6. Refresh LED service ───────────────────────────────────────────
55+
56+
LED_UNIT_SRC="${REPO_DIR}/systemd/hil-bench-led.service"
57+
if [[ -f "$LED_UNIT_SRC" ]]; then
58+
echo "--- Refreshing LED service ---"
59+
cp "$LED_UNIT_SRC" /etc/systemd/system/hil-bench-led.service
60+
systemctl daemon-reload
61+
echo "LED service unit refreshed"
62+
fi
63+
64+
# ── 7. Done ──────────────────────────────────────────────────────────────
5565

5666
echo ""
5767
echo "=== Update complete ==="

configs/bench-config.example.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ paths:
3030

3131
wiki:
3232
canonical_url: https://wiki.aharoni-lab.com/HIL/Bench/aharoni-samd51-bench-01
33+
34+
led:
35+
enabled: true
36+
led_count: 16
37+
gpio_pin: 18
38+
brightness: 128

configs/config.template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ paths:
5858

5959
wiki:
6060
canonical_url: null # optional wiki link
61+
62+
led:
63+
enabled: false # set to true to enable WS2812B LED strip
64+
led_count: 16 # number of LEDs on the strip
65+
gpio_pin: 18 # GPIO pin (PWM0)
66+
brightness: 128 # default brightness (0-255)
67+
fps: 30 # animation frame rate
68+
socket_path: /run/hil-bench/led.sock

0 commit comments

Comments
 (0)