Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 7 additions & 49 deletions UPLOAD_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

---
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Upload Firmware (Windows).bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
77 changes: 10 additions & 67 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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
Expand Down
20 changes: 17 additions & 3 deletions upload_firmware.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Join-Path cmdlet with three arguments requires PowerShell 6.0 or later (PowerShell Core). However, Windows PowerShell 5.1 is the default on Windows 10 and earlier, and it only supports two arguments for Join-Path. This will cause the script to fail with an error on systems using Windows PowerShell 5.1.

To fix this for compatibility with Windows PowerShell 5.1, nest the Join-Path calls or use Join-Path twice in sequence. For example:

  • Option 1: Join-Path (Join-Path $ReleaseRoot "source") "arduino"
  • Option 2: Join-Path $ReleaseRoot "source\arduino"
Suggested change
$ArduinoDir = Join-Path $ReleaseRoot "source" "arduino"
$ArduinoDir = Join-Path (Join-Path $ReleaseRoot "source") "arduino"

Copilot uses AI. Check for mistakes.

# Global variables
$script:SelectedPort = ""
Expand Down Expand Up @@ -357,7 +361,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
Expand All @@ -366,7 +375,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 ""

Expand Down