Conversation
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.
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.
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
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
Join-Path only accepts 2 positional arguments. Nested the calls to properly construct the path to the Arduino source directory. Old: Join-Path $ReleaseRoot "source" "arduino" New: Join-Path (Join-Path $ReleaseRoot "source") "arduino"
The batch file now checks for upload_firmware.ps1 in two locations: 1. tools/upload_firmware.ps1 (release package structure) 2. upload_firmware.ps1 (local repository structure) This allows the batch file to work whether you're testing locally or using the release package, and provides helpful error messages if the script can't be found.
Changed port detection method to be more reliable: 1. Primary method: Use .NET SerialPort.GetPortNames() to reliably get COM ports 2. Friendly names: Query WMI for device descriptions when available 3. Fallback: Use WMI-only search if primary method fails This ensures COM port numbers are always displayed, even if device names are unavailable, fixing the empty device listing issue.
The previous inline if statement in Write-Host was causing the display to show empty values. Changed to assign port/name to variables first, then use them in Write-Host calls. Also removed debug output now that we've verified port detection works.
Added defensive programming to handle different data structure types and ensure port numbers are always displayed even if properties are empty or missing. Falls back to 'COM?' if port is not found.
Simplified the function to: 1. Use .NET GetPortNames() as primary method (most reliable) 2. Build a map of port->device name from WMI for friendly names 3. Explicitly create port objects ensuring Port is always set 4. Use 'return , $ports' to properly return array without unwrapping 5. Fall back to WMI-only if GetPortNames fails This should fix the empty Port values issue.
The path resolution now checks if source/arduino exists relative to the script location to determine context: - Local repo: upload_firmware.ps1 at root, arduino in source/arduino - Release package: upload_firmware.ps1 in tools/, arduino in ../source/arduino This fixes the 'Firmware folder not found' error when running from the repo.
Resolves merge conflicts by keeping improved path detection and device handling logic from fix/join-path-error branch: - Fixed Join-Path 3-argument syntax error - Added intelligent path detection for repo vs release contexts - Improved device property access safety checks - Better support for both hashtable and object returns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PowerShell's Join-Path cmdlet only accepts 2 positional arguments (Path and ChildPath).
The script was attempting to pass 3 positional arguments which caused a syntax error.
Fixed by nesting the Join-Path calls:
This resolves the error users encountered when running the upload script in v1.0.2.