- Move docs/AUX_W_AXIS.md to docs/AUX_A_AXIS.md and rebadge W -> A throughout, with a header note pointing at ExternalAxis as the current implementation. - README: A-axis fork heading, link to AUX_A_AXIS.md, /api/aux/status in verify-flash, small comment in scripts/deploy/local.sh.
76 lines
2.7 KiB
Bash
Executable File
76 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
||
# --- Local development (macOS) ---
|
||
#
|
||
# Builds the UI bundle and static-serves it on http://localhost:8770/.
|
||
# Runs in a named tmux session so we can iterate (re-running this script
|
||
# rebuilds and restarts the server in-place, you keep your browser tab).
|
||
#
|
||
# What you'll see:
|
||
# * The full V09 chrome (header tabs, settings rail, jog grid, DRO
|
||
# skeleton, status strip).
|
||
# * A "DISCONNECTED" overlay because there's no controller backend.
|
||
# * The A axis row in jog/DRO is hidden (correct: it appears only when
|
||
# the controller reports `aux_enabled = true`). To exercise the A
|
||
# axis end-to-end, deploy to the Pi (`./deploy.sh hardware`).
|
||
|
||
set -euo pipefail
|
||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||
cd "$SCRIPT_DIR"
|
||
|
||
echo "🛠 Building UI bundle..."
|
||
make build/http/index.html >/dev/null
|
||
|
||
PORT="${PORT:-8770}"
|
||
SESSION="onefin-local"
|
||
|
||
ensure_tmux_window() {
|
||
local session="$1"
|
||
local window="${2:-}"
|
||
local target="${session}${window:+:$window}"
|
||
if tmux has-session -t "$session" 2>/dev/null; then
|
||
if tmux send-keys -t "$target" "" 2>/dev/null; then
|
||
echo "🔁 Reusing tmux session '$session'..."
|
||
tmux send-keys -t "$target" C-c
|
||
sleep 1
|
||
return
|
||
fi
|
||
echo "⚠️ Dead pane in '$session', recreating..."
|
||
tmux kill-session -t "$session" 2>/dev/null
|
||
fi
|
||
echo "🆕 Creating tmux session '$session'..."
|
||
tmux new-session -d -s "$session"
|
||
}
|
||
|
||
ensure_tmux_window "$SESSION"
|
||
|
||
# Free the port if a previous run is still listening.
|
||
if lsof -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
|
||
echo "⚠️ Port $PORT is busy; killing previous server..."
|
||
lsof -tiTCP:"$PORT" -sTCP:LISTEN | xargs -r kill 2>/dev/null || true
|
||
sleep 1
|
||
fi
|
||
|
||
tmux send-keys -t "$SESSION" \
|
||
"cd '$SCRIPT_DIR' && python3 -m http.server --directory build/http $PORT" \
|
||
C-m
|
||
|
||
echo ""
|
||
echo "✅ Static UI server started on http://localhost:$PORT/"
|
||
echo ""
|
||
echo " Routes to try:"
|
||
echo " http://localhost:$PORT/#control"
|
||
echo " http://localhost:$PORT/#program"
|
||
echo " http://localhost:$PORT/#console"
|
||
echo " http://localhost:$PORT/#settings (Display & Units)"
|
||
echo " http://localhost:$PORT/#admin-network (WiFi / IP)"
|
||
echo " http://localhost:$PORT/#motor:0 (Motor 0 settings)"
|
||
echo ""
|
||
echo " tmux: tmux attach -t $SESSION"
|
||
echo " stop: tmux kill-session -t $SESSION"
|
||
echo ""
|
||
echo "ℹ️ No controller is running, so the page shows DISCONNECTED and"
|
||
echo " axis values stay empty. For live data + W axis, run:"
|
||
echo " ./deploy.sh hardware (fast: rsync build/http -> Pi)"
|
||
echo " ./deploy.sh prod (full firmware update)"
|