Repository navigation
Improves Setup / Flashing When Multiple USB Devices - #4
Merged
Merged
Conversation
find_port() returns a bare /dev path and gives up when there's more than one. To let someone choose between boards, each port needs a name a person recognizes and an identity that survives a reset renaming its /dev node. usb_ports() returns both, for the same /dev/cu.usbmodem* ports find_port() considers. Nothing uses it yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With more than one USB serial device attached, flashing gave up: setup printed "Heads up: several boards found" and then "no board found", which isn't true and leaves no way forward. Before it's flashed, a dashtouch is just some board, so nothing can tell it apart from the others. The person has to choose. find_and_flash now lists the ports by name and asks which one to flash: - The board the helper already has open is the default, so a reflash is one keypress. Otherwise Enter skips flashing. - A bad answer asks again; running out of input skips. - A single device keeps today's yes/no prompt, now showing its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Releasing the port drops DTR, which can reset the board onto a new /dev node, so find_and_flash looks the port up again before uploading. It did that with find_port(), which gives up when more than one usbmodem port is present, and the flash then went to the stale name. Match the chosen board's USB identity instead, which works however many other boards are plugged in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For scripts, or anyone who'd rather name the board than be asked: `--port <device>` skips the question and flashes that port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`arduino-cli board list | grep … | head -1` flashes whichever usbmodem port happens to be listed first. With another board plugged in, that can overwrite its firmware. Have the reader find their board's port and say why it matters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Looks clean, and good catch on this — thanks for it! |
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.
Problem
With more than one USB serial device plugged in, flashing doesn't work.
setupprints "Heads up: several boards found", then "no board found", which isn't true, and there's no way to go on from there. The README's hand-flash command has the opposite problem:arduino-cli board list | grep … | head -1flashes whichever port comes first, which can overwrite another board's firmware.I ran into this with a second ESP32-S3 board plugged in alongside my dashtouch.
Solution
Before it's flashed, a dashtouch is just another board, so we cannot tell it apart from the others, the user has to choose. With several devices plugged in,
setupandpairingnow show:If the helper is already connected to one of the devices, that one is suggested (
[1]) and marked in the list. If there is only one device, it has the same yes/no prompt as today (now showing the device's name).If the user knows the USB port, they can skip the question by providing the
--portflag.