Settings rail: add W Axis entry; deploy scripts (local/hardware/prod)

UX
- The V09 redesign already exposed the W axis in the Control jog grid
  (row 4 when w.enabled) and as a row in the DRO table. The Settings
  shell now also surfaces a dedicated 'W Axis' rail entry that smooth-
  scrolls to the W Axis (auxcnc) section of the main settings page.
  The rail item is marked active only while the user is on Display &
  Units AND the W Axis link was the most recent click.
- The W Axis section in src/svelte-components/src/components/Settings
  View.svelte gets an id="w-axis" anchor so the scroll lands cleanly.

Tested live against onefinity.local. Aux status reports
{enabled: true, present: true, pos_mm: 43.96, homed: false}; the W
axis row appears in the DRO with the right purple styling, and the
jog row 4 shows W- / Home W / W+ / Probe.

Deploy scripts
- deploy.sh dispatches to scripts/deploy/{local,hardware,prod}.sh
  with shorthand wrappers (deploy-local.sh / deploy-hardware.sh /
  deploy-prod.sh).
- local: builds the UI bundle and serves build/http/ via
  python3 -m http.server 8770 in a tmux session 'onefin-local'.
  Useful for visual iteration on macOS — chrome only, no controller.
- hardware: rsyncs the freshly built build/http/ tree onto the Pi at
  onefinity.local and restarts bbctrl. Stages to /tmp on the Pi and
  uses sudo to install into the running egg's bbctrl/http directory,
  so iteration time is ~5 seconds.
- prod: requires a clean working tree, then runs 'make pkg' followed
  by 'make update HOST=onefinity.local PASSWORD=onefinity'.

Defaults can be overridden with environment variables (HOST, PASSWORD,
REMOTE_USER for the hardware path).
This commit is contained in:
2026-04-30 21:45:17 +02:00
parent b8c4f53bb1
commit ea23f94b87
10 changed files with 275 additions and 2 deletions

65
scripts/deploy/hardware.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# --- Hardware iteration (live Pi at onefinity.local) ---
#
# Rsyncs the freshly built static UI tree (build/http/) onto the Pi's
# bbctrl egg directory and restarts bbctrl. This is much faster than
# a full firmware update and is the fastest way to iterate on the V09
# UI changes against real machine state (W axis, jog feedback, etc).
#
# Defaults:
# HOST=onefinity.local
# USER=bbmc
# PASSWORD=onefinity (used for sudo on the Pi)
#
# Override:
# HOST=10.1.10.55 ./deploy.sh hardware
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$SCRIPT_DIR"
HOST="${HOST:-onefinity.local}"
# REMOTE_USER (not USER, which the shell pre-populates with the local
# logged-in account).
REMOTE_USER="${REMOTE_USER:-bbmc}"
PASSWORD="${PASSWORD:-onefinity}"
echo "🛠 Building UI bundle..."
make build/http/index.html >/dev/null
# Discover the on-Pi http path; the bbctrl egg version may change.
echo "🔍 Locating bbctrl http/ directory on $HOST..."
REMOTE_HTTP_DIR="$(ssh -o ConnectTimeout=5 "${REMOTE_USER}@${HOST}" \
"ls -d /usr/local/lib/python*/dist-packages/bbctrl-*-py*.egg/bbctrl/http 2>/dev/null | head -1")"
if [[ -z "$REMOTE_HTTP_DIR" ]]; then
echo "❌ Could not find bbctrl http/ directory on $HOST"
exit 1
fi
echo " $REMOTE_HTTP_DIR"
echo "🚚 Rsyncing build/http/ → $HOST:$REMOTE_HTTP_DIR/"
# Stage to a tmp dir owned by $REMOTE_USER, then sudo-mv into place.
# This avoids needing root over rsync.
REMOTE_TMP="/tmp/onefin_ui_$$"
ssh -o ConnectTimeout=5 "${REMOTE_USER}@${HOST}" "mkdir -p '${REMOTE_TMP}'"
rsync -avz --delete \
--exclude='hostinfo.txt' \
-e "ssh -o ConnectTimeout=5" \
build/http/ "${REMOTE_USER}@${HOST}:${REMOTE_TMP}/"
echo "📦 Installing into ${REMOTE_HTTP_DIR}/ (sudo)..."
ssh -o ConnectTimeout=5 "${REMOTE_USER}@${HOST}" \
"echo '${PASSWORD}' | sudo -S bash -c '
rsync -a --delete --exclude=hostinfo.txt \"${REMOTE_TMP}/\" \"${REMOTE_HTTP_DIR}/\" \
&& rm -rf \"${REMOTE_TMP}\"
'" 2>&1 | tail -3
echo "🔁 Restarting bbctrl service..."
ssh -o ConnectTimeout=5 "${REMOTE_USER}@${HOST}" \
"echo '${PASSWORD}' | sudo -S systemctl restart bbctrl" 2>&1 | tail -3
echo ""
echo "✅ Deployed to http://${HOST}/"
echo " Logs: ssh ${REMOTE_USER}@${HOST} 'journalctl -u bbctrl -f'"
echo " Open: open -a 'Google Chrome' http://${HOST}/"