Skip to content

Commit a49fa5a

Browse files
authored
Fix Upload Firmware batch file path to tools subdirectory (#2)
* 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. * 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. * 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 * 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
1 parent 6a4ffd4 commit a49fa5a

4 files changed

Lines changed: 36 additions & 121 deletions

File tree

UPLOAD_GUIDE.md

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ The latest SledLink release package is available on GitHub:
99
**[Download Latest Release](https://github.com/thompcd/SledLink/releases/latest)**
1010

1111
Each release includes:
12-
- Pre-compiled firmware binaries (ready to flash)
13-
- Upload and flash scripts
14-
- Source code
12+
- Arduino source code for both controllers
13+
- Upload scripts for Windows, Mac, and Linux
1514
- This guide
1615

1716
---
@@ -21,50 +20,16 @@ Each release includes:
2120
1. **Your SledLink controller** (either the Sled or Judge unit)
2221
2. **A USB cable** (micro-USB, the same type used for many Android phones)
2322
3. **A computer** (Windows, Mac, or Linux)
24-
4. **An internet connection** (only needed the first time to download tools)
23+
4. **An internet connection** (needed to download tools on first use)
2524

2625
---
2726

28-
## Two Options
27+
## Upload Firmware
2928

30-
There are two ways to upload firmware:
31-
32-
| Method | Best For | What It Does |
33-
|--------|----------|--------------|
34-
| **Flash Pre-Compiled** | Field use, quick updates | Uses ready-to-go firmware files |
35-
| **Compile from Source** | Developers, customization | Builds firmware from source code |
36-
37-
**For most users, we recommend "Flash Pre-Compiled"** - it's faster and simpler.
29+
The firmware is compiled fresh from source code during the upload process.
3830

3931
---
4032

41-
## Option 1: Flash Pre-Compiled Firmware (Recommended)
42-
43-
This is the **easiest method**. Use this if you downloaded a release package.
44-
45-
### Windows
46-
47-
1. **Download the SledLink release** and unzip it
48-
2. **Double-click** `Flash Firmware (Windows).bat`
49-
3. **Follow the prompts** on screen
50-
51-
### Mac / Linux
52-
53-
1. **Download the SledLink release** and unzip it
54-
2. **Open Terminal** in that folder
55-
3. **Run:**
56-
```
57-
chmod +x flash_firmware.sh # only needed once
58-
./flash_firmware.sh
59-
```
60-
4. **Follow the prompts** on screen
61-
62-
---
63-
64-
## Option 2: Compile from Source
65-
66-
Use this if you need to modify the firmware or don't have pre-compiled binaries.
67-
6833
### Windows
6934

7035
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.
10671

10772
---
10873

109-
## What the Scripts Do
110-
111-
### Flash Script (Pre-Compiled)
112-
1. **Checks for esptool** - A simple flashing tool. Installs it if needed.
113-
2. **Asks which controller** - Sled or Judge
114-
3. **Finds your controller** - Detects the connected USB device
115-
4. **Flashes the firmware** - Writes the pre-compiled binary to the controller
74+
## What the Upload Script Does
11675

117-
### Upload Script (From Source)
11876
1. **Checks for Arduino CLI** - The build tool. Installs it if needed.
11977
2. **Sets up ESP32 support** - Downloads ESP32 tools (first time only)
12078
3. **Asks which controller** - Sled or Judge
12179
4. **Finds your controller** - Detects the connected USB device
122-
5. **Compiles and uploads** - Builds from source and writes to controller
80+
5. **Compiles and uploads** - Builds fresh firmware from source and writes to your controller
12381

12482
## Troubleshooting
12583

Upload Firmware (Windows).bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ echo.
1515
REM Change to the directory where this script is located
1616
cd /d "%~dp0"
1717

18-
REM Run the PowerShell script with bypass execution policy
19-
PowerShell -ExecutionPolicy Bypass -File "%~dp0upload_firmware.ps1"
18+
REM Run the PowerShell script from tools subdirectory with bypass execution policy
19+
PowerShell -ExecutionPolicy Bypass -File "%~dp0tools\upload_firmware.ps1"
2020

2121
REM If PowerShell failed, show error
2222
if %ERRORLEVEL% NEQ 0 (

build_release.sh

Lines changed: 10 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -68,47 +68,13 @@ mkdir -p "$OUTPUT_DIR/firmware"
6868
mkdir -p "$OUTPUT_DIR/tools"
6969
mkdir -p "$OUTPUT_DIR/source"
7070

71-
# Compile SledController
72-
echo ""
73-
echo "Compiling SledController..."
74-
arduino-cli compile --fqbn esp32:esp32:esp32 \
75-
--output-dir "$OUTPUT_DIR/firmware/SledController" \
76-
"$SCRIPT_DIR/arduino/SledController"
77-
78-
# Compile JudgeController
79-
echo ""
80-
echo "Compiling JudgeController..."
81-
arduino-cli compile --fqbn esp32:esp32:esp32 \
82-
--output-dir "$OUTPUT_DIR/firmware/JudgeController" \
83-
"$SCRIPT_DIR/arduino/JudgeController"
84-
85-
# Copy only the .bin files we need and rename for clarity
86-
echo ""
87-
echo "Organizing firmware files..."
88-
cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.bin" "$OUTPUT_DIR/firmware/SledController.bin"
89-
cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.bootloader.bin" "$OUTPUT_DIR/firmware/SledController.bootloader.bin"
90-
cp "$OUTPUT_DIR/firmware/SledController/SledController.ino.partitions.bin" "$OUTPUT_DIR/firmware/SledController.partitions.bin"
91-
92-
cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.bin" "$OUTPUT_DIR/firmware/JudgeController.bin"
93-
cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.bootloader.bin" "$OUTPUT_DIR/firmware/JudgeController.bootloader.bin"
94-
cp "$OUTPUT_DIR/firmware/JudgeController/JudgeController.ino.partitions.bin" "$OUTPUT_DIR/firmware/JudgeController.partitions.bin"
95-
96-
# Clean up intermediate build directories
97-
rm -rf "$OUTPUT_DIR/firmware/SledController"
98-
rm -rf "$OUTPUT_DIR/firmware/JudgeController"
99-
100-
# Copy upload tools
71+
# Copy upload tools for compiling from source
10172
echo "Copying upload tools..."
10273
cp "$SCRIPT_DIR/upload_firmware.sh" "$OUTPUT_DIR/tools/"
10374
cp "$SCRIPT_DIR/upload_firmware.ps1" "$OUTPUT_DIR/tools/"
10475
cp "$SCRIPT_DIR/Upload Firmware (Windows).bat" "$OUTPUT_DIR/"
10576
chmod +x "$OUTPUT_DIR/tools/upload_firmware.sh"
10677

107-
# Copy flash scripts for pre-compiled binaries
108-
cp "$SCRIPT_DIR/flash_firmware.sh" "$OUTPUT_DIR/" 2>/dev/null || true
109-
cp "$SCRIPT_DIR/flash_firmware.ps1" "$OUTPUT_DIR/tools/" 2>/dev/null || true
110-
cp "$SCRIPT_DIR/Flash Firmware (Windows).bat" "$OUTPUT_DIR/" 2>/dev/null || true
111-
11278
# Copy source code
11379
echo "Copying source code..."
11480
cp -r "$SCRIPT_DIR/arduino" "$OUTPUT_DIR/source/"
@@ -132,47 +98,24 @@ RELEASE INFORMATION
13298
Build Date: $(date +%Y-%m-%d)
13399
Download: https://github.com/thompcd/SledLink/releases/tag/$VERSION
134100
135-
This release contains pre-compiled firmware and tools for the SledLink system.
101+
This release contains source code and tools to compile and upload firmware to the SledLink system.
136102
137103
CONTENTS
138104
--------
139-
firmware/ - Pre-compiled firmware binaries
140-
SledController.bin - Firmware for the sled unit
141-
JudgeController.bin - Firmware for the judge display unit
142-
*.bootloader.bin - ESP32 bootloader files
143-
*.partitions.bin - ESP32 partition tables
144-
145-
tools/ - Upload utilities
146-
upload_firmware.sh - Mac/Linux upload script (compiles from source)
147-
upload_firmware.ps1 - Windows PowerShell upload script
148-
149105
source/ - Arduino source code
150106
arduino/SledController/ - Sled controller source
151-
arduino/JudgeController/- Judge controller source
107+
arduino/JudgeController/ - Judge controller source
152108
153-
Flash Firmware (Windows).bat - Double-click to flash pre-compiled firmware
154-
Upload Firmware (Windows).bat - Double-click to compile & upload from source
155-
156-
157-
QUICK START - FLASHING PRE-COMPILED FIRMWARE
158-
---------------------------------------------
159-
This is the EASIEST method - uses pre-compiled binaries, no compilation needed.
160-
161-
Windows:
162-
1. Connect the controller via USB
163-
2. Double-click "Flash Firmware (Windows).bat"
164-
3. Follow the prompts
109+
tools/ - Upload utilities
110+
upload_firmware.sh - Mac/Linux upload script
111+
upload_firmware.ps1 - Windows PowerShell upload script
165112
166-
Mac/Linux:
167-
1. Connect the controller via USB
168-
2. Open Terminal in this folder
169-
3. Run: ./flash_firmware.sh
170-
4. Follow the prompts
113+
Upload Firmware (Windows).bat - Double-click to upload firmware
171114
172115
173-
ALTERNATIVE - COMPILE FROM SOURCE
174-
---------------------------------
175-
Use this if you've modified the source code or prefer to compile fresh.
116+
QUICK START - UPLOAD FIRMWARE
117+
-----------------------------
118+
The firmware is compiled fresh from source code during upload.
176119
177120
Windows:
178121
1. Connect the controller via USB

upload_firmware.ps1

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ $ErrorActionPreference = "Stop"
99

1010
# Get the directory where this script is located
1111
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
12-
$ArduinoDir = Join-Path $ScriptDir "arduino"
12+
13+
# The Arduino source is in the source/ folder at the release root
14+
# Script is in tools/, so go up one level and into source/
15+
$ReleaseRoot = Split-Path -Parent $ScriptDir
16+
$ArduinoDir = Join-Path $ReleaseRoot "source" "arduino"
1317

1418
# Global variables
1519
$script:SelectedPort = ""
@@ -357,7 +361,12 @@ function Select-Port {
357361

358362
if ($ports.Count -eq 1) {
359363
$script:SelectedPort = $ports[0].Port
360-
Write-Success "Found device: $($ports[0].Name)"
364+
$displayName = if ($ports[0].Name -and $ports[0].Name -ne $ports[0].Port) {
365+
"$($ports[0].Port) - $($ports[0].Name)"
366+
} else {
367+
$ports[0].Port
368+
}
369+
Write-Success "Found device: $displayName"
361370
Write-Host ""
362371
if (Ask-YesNo "Use this device?") {
363372
return $true
@@ -366,7 +375,12 @@ function Select-Port {
366375
Write-Host "Multiple devices found:" -ForegroundColor White
367376
Write-Host ""
368377
for ($i = 0; $i -lt $ports.Count; $i++) {
369-
Write-Host " $($i + 1)) $($ports[$i].Name)"
378+
$displayName = if ($ports[$i].Name -and $ports[$i].Name -ne $ports[$i].Port) {
379+
"$($ports[$i].Port) - $($ports[$i].Name)"
380+
} else {
381+
$ports[$i].Port
382+
}
383+
Write-Host " $($i + 1)) $displayName"
370384
}
371385
Write-Host ""
372386

0 commit comments

Comments
 (0)