From 930e9927703eeb8b90c9c951e3a310143379bf9a Mon Sep 17 00:00:00 2001 From: Corey Thompson Date: Fri, 2 Jan 2026 00:22:39 -0600 Subject: [PATCH 1/4] Fix Upload Firmware batch file path to tools subdirectory The build_release.sh script places upload_firmware.ps1 in the tools/ subdirectory, but the batch file was looking for it in the root directory. Updated batch file to reference tools\upload_firmware.ps1. --- Upload Firmware (Windows).bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Upload Firmware (Windows).bat b/Upload Firmware (Windows).bat index 0fcf3d4..f7885df 100644 --- a/Upload Firmware (Windows).bat +++ b/Upload Firmware (Windows).bat @@ -15,8 +15,8 @@ echo. REM Change to the directory where this script is located cd /d "%~dp0" -REM Run the PowerShell script with bypass execution policy -PowerShell -ExecutionPolicy Bypass -File "%~dp0upload_firmware.ps1" +REM Run the PowerShell script from tools subdirectory with bypass execution policy +PowerShell -ExecutionPolicy Bypass -File "%~dp0tools\upload_firmware.ps1" REM If PowerShell failed, show error if %ERRORLEVEL% NEQ 0 ( From d8590ae902033b18b48712bc38e5cfa441cbb209 Mon Sep 17 00:00:00 2001 From: Corey Thompson Date: Fri, 2 Jan 2026 00:27:22 -0600 Subject: [PATCH 2/4] Fix empty device display in PowerShell upload script When multiple USB devices are detected, the device names were not displaying properly, showing empty entries. Now displays the COM port number at minimum, and includes the full device name if available. This fixes the issue where users see empty device listings when connecting multiple USB devices to their computer. --- upload_firmware.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/upload_firmware.ps1 b/upload_firmware.ps1 index e2e3e68..378fb00 100644 --- a/upload_firmware.ps1 +++ b/upload_firmware.ps1 @@ -357,7 +357,12 @@ function Select-Port { if ($ports.Count -eq 1) { $script:SelectedPort = $ports[0].Port - Write-Success "Found device: $($ports[0].Name)" + $displayName = if ($ports[0].Name -and $ports[0].Name -ne $ports[0].Port) { + "$($ports[0].Port) - $($ports[0].Name)" + } else { + $ports[0].Port + } + Write-Success "Found device: $displayName" Write-Host "" if (Ask-YesNo "Use this device?") { return $true @@ -366,7 +371,12 @@ function Select-Port { Write-Host "Multiple devices found:" -ForegroundColor White Write-Host "" for ($i = 0; $i -lt $ports.Count; $i++) { - Write-Host " $($i + 1)) $($ports[$i].Name)" + $displayName = if ($ports[$i].Name -and $ports[$i].Name -ne $ports[$i].Port) { + "$($ports[$i].Port) - $($ports[$i].Name)" + } else { + $ports[$i].Port + } + Write-Host " $($i + 1)) $displayName" } Write-Host "" From 36c7f34338ced2875cfc298c5e6a7826988657ce Mon Sep 17 00:00:00 2001 From: Corey Thompson Date: Fri, 2 Jan 2026 00:28:25 -0600 Subject: [PATCH 3/4] Fix firmware path in PowerShell upload script The script was looking for firmware in tools/arduino instead of source/arduino. Updated to find the source folder relative to the release package root directory. Path now correctly resolves to: release_root/source/arduino/JudgeController --- upload_firmware.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upload_firmware.ps1 b/upload_firmware.ps1 index 378fb00..bd8e606 100644 --- a/upload_firmware.ps1 +++ b/upload_firmware.ps1 @@ -9,7 +9,11 @@ $ErrorActionPreference = "Stop" # Get the directory where this script is located $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path -$ArduinoDir = Join-Path $ScriptDir "arduino" + +# The Arduino source is in the source/ folder at the release root +# Script is in tools/, so go up one level and into source/ +$ReleaseRoot = Split-Path -Parent $ScriptDir +$ArduinoDir = Join-Path $ReleaseRoot "source" "arduino" # Global variables $script:SelectedPort = "" From 14cf7f760382c5a6518ec775f13b1864a3670a3c Mon Sep 17 00:00:00 2001 From: Corey Thompson Date: Fri, 2 Jan 2026 00:32:09 -0600 Subject: [PATCH 4/4] Remove flash firmware support - only support Arduino upload The pre-compiled firmware and flash scripts are untested and unused. Only support the Arduino CLI compile-from-source upload method. Changes: - Remove firmware compilation from build_release.sh - Remove flash_firmware.sh and flash_firmware.ps1 - Remove Flash Firmware (Windows).bat from release package - Update build_release.sh to only include source code and upload tools - Simplify UPLOAD_GUIDE.md to show only Arduino upload method - Update README.txt template to reflect source-only approach --- UPLOAD_GUIDE.md | 56 +++++------------------------------ build_release.sh | 77 +++++++----------------------------------------- 2 files changed, 17 insertions(+), 116 deletions(-) diff --git a/UPLOAD_GUIDE.md b/UPLOAD_GUIDE.md index eb3c962..a202b73 100644 --- a/UPLOAD_GUIDE.md +++ b/UPLOAD_GUIDE.md @@ -9,9 +9,8 @@ The latest SledLink release package is available on GitHub: **[Download Latest Release](https://github.com/thompcd/SledLink/releases/latest)** Each release includes: -- Pre-compiled firmware binaries (ready to flash) -- Upload and flash scripts -- Source code +- Arduino source code for both controllers +- Upload scripts for Windows, Mac, and Linux - This guide --- @@ -21,50 +20,16 @@ Each release includes: 1. **Your SledLink controller** (either the Sled or Judge unit) 2. **A USB cable** (micro-USB, the same type used for many Android phones) 3. **A computer** (Windows, Mac, or Linux) -4. **An internet connection** (only needed the first time to download tools) +4. **An internet connection** (needed to download tools on first use) --- -## Two Options +## Upload Firmware -There are two ways to upload firmware: - -| Method | Best For | What It Does | -|--------|----------|--------------| -| **Flash Pre-Compiled** | Field use, quick updates | Uses ready-to-go firmware files | -| **Compile from Source** | Developers, customization | Builds firmware from source code | - -**For most users, we recommend "Flash Pre-Compiled"** - it's faster and simpler. +The firmware is compiled fresh from source code during the upload process. --- -## Option 1: Flash Pre-Compiled Firmware (Recommended) - -This is the **easiest method**. Use this if you downloaded a release package. - -### Windows - -1. **Download the SledLink release** and unzip it -2. **Double-click** `Flash Firmware (Windows).bat` -3. **Follow the prompts** on screen - -### Mac / Linux - -1. **Download the SledLink release** and unzip it -2. **Open Terminal** in that folder -3. **Run:** - ``` - chmod +x flash_firmware.sh # only needed once - ./flash_firmware.sh - ``` -4. **Follow the prompts** on screen - ---- - -## Option 2: Compile from Source - -Use this if you need to modify the firmware or don't have pre-compiled binaries. - ### Windows 1. **Download the SledLink folder** to your computer @@ -106,20 +71,13 @@ Use this if you need to modify the firmware or don't have pre-compiled binaries. --- -## What the Scripts Do - -### Flash Script (Pre-Compiled) -1. **Checks for esptool** - A simple flashing tool. Installs it if needed. -2. **Asks which controller** - Sled or Judge -3. **Finds your controller** - Detects the connected USB device -4. **Flashes the firmware** - Writes the pre-compiled binary to the controller +## What the Upload Script Does -### Upload Script (From Source) 1. **Checks for Arduino CLI** - The build tool. Installs it if needed. 2. **Sets up ESP32 support** - Downloads ESP32 tools (first time only) 3. **Asks which controller** - Sled or Judge 4. **Finds your controller** - Detects the connected USB device -5. **Compiles and uploads** - Builds from source and writes to controller +5. **Compiles and uploads** - Builds fresh firmware from source and writes to your controller ## Troubleshooting diff --git a/build_release.sh b/build_release.sh index e34e96c..3f9f004 100644 --- a/build_release.sh +++ b/build_release.sh @@ -68,47 +68,13 @@ mkdir -p "$OUTPUT_DIR/firmware" mkdir -p "$OUTPUT_DIR/tools" mkdir -p "$OUTPUT_DIR/source" -# Compile SledController -echo "" -echo "Compiling SledController..." -arduino-cli compile --fqbn esp32:esp32:esp32 \ - --output-dir "$OUTPUT_DIR/firmware/SledController" \ - "$SCRIPT_DIR/arduino/SledController" - -# Compile JudgeController -echo "" -echo "Compiling JudgeController..." -arduino-cli compile --fqbn esp32:esp32:esp32 \ - --output-dir "$OUTPUT_DIR/firmware/JudgeController" \ - "$SCRIPT_DIR/arduino/JudgeController" - -# Copy only the .bin files we need and rename for clarity -echo "" -echo "Organizing firmware files..." -cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.bin" "$OUTPUT_DIR/firmware/SledController.bin" -cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.bootloader.bin" "$OUTPUT_DIR/firmware/SledController.bootloader.bin" -cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.partitions.bin" "$OUTPUT_DIR/firmware/SledController.partitions.bin" - -cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.bin" "$OUTPUT_DIR/firmware/JudgeController.bin" -cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.bootloader.bin" "$OUTPUT_DIR/firmware/JudgeController.bootloader.bin" -cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.partitions.bin" "$OUTPUT_DIR/firmware/JudgeController.partitions.bin" - -# Clean up intermediate build directories -rm -rf "$OUTPUT_DIR/firmware/SledController" -rm -rf "$OUTPUT_DIR/firmware/JudgeController" - -# Copy upload tools +# Copy upload tools for compiling from source echo "Copying upload tools..." cp "$SCRIPT_DIR/upload_firmware.sh" "$OUTPUT_DIR/tools/" cp "$SCRIPT_DIR/upload_firmware.ps1" "$OUTPUT_DIR/tools/" cp "$SCRIPT_DIR/Upload Firmware (Windows).bat" "$OUTPUT_DIR/" chmod +x "$OUTPUT_DIR/tools/upload_firmware.sh" -# Copy flash scripts for pre-compiled binaries -cp "$SCRIPT_DIR/flash_firmware.sh" "$OUTPUT_DIR/" 2>/dev/null || true -cp "$SCRIPT_DIR/flash_firmware.ps1" "$OUTPUT_DIR/tools/" 2>/dev/null || true -cp "$SCRIPT_DIR/Flash Firmware (Windows).bat" "$OUTPUT_DIR/" 2>/dev/null || true - # Copy source code echo "Copying source code..." cp -r "$SCRIPT_DIR/arduino" "$OUTPUT_DIR/source/" @@ -132,47 +98,24 @@ RELEASE INFORMATION Build Date: $(date +%Y-%m-%d) Download: https://github.com/thompcd/SledLink/releases/tag/$VERSION -This release contains pre-compiled firmware and tools for the SledLink system. +This release contains source code and tools to compile and upload firmware to the SledLink system. CONTENTS -------- - firmware/ - Pre-compiled firmware binaries - SledController.bin - Firmware for the sled unit - JudgeController.bin - Firmware for the judge display unit - *.bootloader.bin - ESP32 bootloader files - *.partitions.bin - ESP32 partition tables - - tools/ - Upload utilities - upload_firmware.sh - Mac/Linux upload script (compiles from source) - upload_firmware.ps1 - Windows PowerShell upload script - source/ - Arduino source code arduino/SledController/ - Sled controller source - arduino/JudgeController/- Judge controller source + arduino/JudgeController/ - Judge controller source - Flash Firmware (Windows).bat - Double-click to flash pre-compiled firmware - Upload Firmware (Windows).bat - Double-click to compile & upload from source - - -QUICK START - FLASHING PRE-COMPILED FIRMWARE ---------------------------------------------- -This is the EASIEST method - uses pre-compiled binaries, no compilation needed. - -Windows: - 1. Connect the controller via USB - 2. Double-click "Flash Firmware (Windows).bat" - 3. Follow the prompts + tools/ - Upload utilities + upload_firmware.sh - Mac/Linux upload script + upload_firmware.ps1 - Windows PowerShell upload script -Mac/Linux: - 1. Connect the controller via USB - 2. Open Terminal in this folder - 3. Run: ./flash_firmware.sh - 4. Follow the prompts + Upload Firmware (Windows).bat - Double-click to upload firmware -ALTERNATIVE - COMPILE FROM SOURCE ---------------------------------- -Use this if you've modified the source code or prefer to compile fresh. +QUICK START - UPLOAD FIRMWARE +----------------------------- +The firmware is compiled fresh from source code during upload. Windows: 1. Connect the controller via USB