summaryrefslogtreecommitdiff
path: root/ControllerFirmware/flash-controller.sh
diff options
context:
space:
mode:
authorBEAST <macbook@Macbooks-MacBook-Pro-2.local>2026-11-16 19:23:09 +0530
committerBEAST <macbook@Macbooks-MacBook-Pro-2.local>2026-11-16 19:23:09 +0530
commit7764125350e66e464dded24ca8cf69a7e1ecef8d (patch)
treee01f8b3a15fe905d6e5ccc3da6822df238b49030 /ControllerFirmware/flash-controller.sh
Add local project files
Diffstat (limited to 'ControllerFirmware/flash-controller.sh')
-rw-r--r--ControllerFirmware/flash-controller.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/ControllerFirmware/flash-controller.sh b/ControllerFirmware/flash-controller.sh
new file mode 100644
index 0000000..eda9b5a
--- /dev/null
+++ b/ControllerFirmware/flash-controller.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+# ===================================================================
+# NRL - Flash the Controller (launcher, macOS / Linux)
+# Writes the prebuilt controller firmware to a plugged-in controller.
+# Usage: bash flash-controller.sh (or chmod +x and run it)
+# ===================================================================
+set -euo pipefail
+
+here="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
+script="$here/flash_controller.py"
+
+# Find a usable Python 3 via the kit's installer helper (in ../tools/);
+# if this ControllerFirmware folder was copied without tools/, fall back
+# to whatever python3 is already on this machine.
+pyexe=""
+if [ -f "$here/../tools/ensure-python.sh" ]; then
+ pyexe="$(bash "$here/../tools/ensure-python.sh")" || pyexe=""
+fi
+if [ -z "$pyexe" ] && command -v python3 >/dev/null 2>&1; then
+ pyexe="python3"
+fi
+if [ -z "$pyexe" ]; then
+ echo "[error] Python 3 was not found and could not be installed automatically." >&2
+ echo " Install Python 3 from https://www.python.org/downloads/ and re-run." >&2
+ exit 1
+fi
+exec "$pyexe" "$script" "$@"