Repository navigation
fix(serial): let users pick the laser's port instead of silently using ttyS0 - #3
Conversation
The desktop build answered Electron's select-serial-port event itself, taking the first port whose name contained "tty". On Linux that is often the motherboard UART (/dev/ttyS0), so the app reported "connected" while GCode went nowhere, and the user never saw which port was used. - Forward the port list to a renderer dialog that shows OS port names, preselects the USB adapter and flags built-in UARTs. - Show the chosen port name in the Laser panel and the port dropdown. - Disconnect now cancels the pending read so the port actually closes. - Serialize writes so a status poll overlapping a command no longer fails on the locked writer and drops the connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @pkkid, merged! 🎉 The default was a real trap: the app said "connected" while nothing reached the laser, and the locked-writer race on a status poll could drop the connection mid-job. Both are fixed now. I reviewed the change locally (typecheck, the full suite and the desktop e2e smoke) and brought it in together with #4. now has it via #7 (merge commit One conflict on the way: I also credited you in |
|
Thanks @pkkid, merged! 🎉 The I reviewed the change locally (typecheck, the full suite and the desktop e2e smoke) and brought it in together with #4. One conflict on the way: I also credited you in |
Brings pkkid's feat/xtool-firmware (d0af971) on top of PR SJLS27#3. xTool's controllers answer GRBL commands but differ in ways that left the D1 connected yet unable to move: '?' corrupts the next line, '$J=' jogs are ignored until M2, status reports carry no state word and 'ok:IDLE' chatter is not an acknowledgement. - New src/serial/dialect.ts (poll, jog, chatter, identification). - On connect the machine sends $I and switches to the xTool command set only when the controller answers '[XTool ...]'; 1.5 s fallback. - New Firmware device setting (Auto-detect / GRBL / xTool). Conflict resolution: src/serial/machine.ts keeps the port-name argument from PR SJLS27#3 and adds the firmware assignment from PR SJLS27#4; TODO.md keeps the xTool limitation note and drops the 'auto-selects the first port' note that PR SJLS27#3 already fixes. Verified: typecheck clean, 289/289 tests in 41 files.
First of all, thank you so much for starting a project like this. I am very excited to have a new app to control my laser. ❤️
On Linux, clicking Connect reported success but the laser never responded for the non-pro "xTool D1". The desktop app picked a port silently, taking the first one whose name contained
tty, which on most PCs is the motherboard UART/dev/ttyS0rather than the USB laser at/dev/ttyUSB0. Nothing in the UI showed which port was in use, so there was no way to tell or fix it.Connect now opens a small port chooser instead. It lists USB serial ports with a description of the chip (e.g.
/dev/ttyUSB0 · CH340 USB serial (QinHeng) · 1a86:7523), preselects the likely laser, and tucks the 32 built-inttyS*ports behind a "Show N built-in ports" button. The chosen port name is then shown in the Laser panel and the port dropdown.Two related bugs surfaced while debugging and are fixed here too:
reader.read()that only returns when data arrives, so other apps (e.g. LightBurn) stayed locked out until OpenBurn quit. It now cancels the reader first.Testing
main).npm run typecheck,npm run buildand the touched test files pass locally.src/gcode/job.test.tsandsrc/workspace/textStyle.test.tsfail in my environment onmaintoo (no 2D canvas), so they're unrelated./dev/ttyUSB0, connecting works, and LightBurn can take the port after Disconnect.Independent of #4 (xTool firmware support); whichever merges second has a one-line conflict in
Machine.connectSerial.Created with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code