Skip to content

0.7.1

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 May 21:56
· 873 commits to main since this release
0222723

CANShift Studio 0.7.1 — hotfix: USB port race during firmware flash from the Update route.

Why this patch

In 0.7.0, flashing a new firmware from Update → Flash would silently time out partway through writeFlash. Flashes triggered from the FirmwareDialog (no firmware / outdated) worked, but the Update route did not.

User report — log truncates partway:

Compressed 1351744 bytes to 705480...
[long pause]
[Auto-connected to /dev/tty.usbserial-XX]   ← wrong moment
[esptool timeout]

Root cause

useAutoConnect short-circuited on three conditions:

if (connected || simulationMode || flashDialogVisible) return

flashDialogVisible is set by FirmwareDialog. The Update route calls useFirmwareFlash.flash() directly without ever opening the dialog — so the predicate stayed false and the 2-second poll kept calling usbService.connect(). Once the renderer-side Web Serial port was open for esptool-js, the Node-side connect attempt collided with it, the port closed, and the next writeFlash chunk had nowhere to land.

Fix

New flashing: boolean slice on the device store. useFirmwareFlash.flash() sets it true immediately on entry and clears it in every exit path (success, mid-flash error, requestPort failure, simulation). useAutoConnect now also short-circuits on this flag, so its 2-second poll cannot grab the serial port back from esptool-js mid-flash regardless of which entry point started the flash.

Test plan covered before release

  • Lint / format / typecheck / vitest (49 tests) — all green
  • Manual: real flash from Update → no Auto-connected log during writeFlash → device reboots cleanly
  • Manual: real flash from FirmwareDialog → still works (dialog visibility + flashing both true)
  • Manual: simulation flash → flashing flag toggles, no auto-connect interference

Note on hardware testing

If a 0.7.0 → 0.7.1 upgrade still times out for you, the device may be in a corrupt state from a previous 0.7.0 flash that aborted partway. Symptoms include:

  • LCD top bar USB icon stays gray when the studio is connected (heartbeat not reaching the firmware)
  • SD config never loads on connect

Recovery: flash the firmware once with the manual esptool CLI (or via the Update route now that the race is gone), then power-cycle. Subsequent burns from Studio should be smooth.

Full PR list since 0.7.0

  • #187feat(firmware): LCD overlay during CMD_PUT_CONFIG (merged after 0.7.0 cut, ships in 0.7.1)
  • #192fix(studio): pause auto-connect during firmware flash

Plus the 6 follow-up issues filed after the v0.7.0 dust settled (#188 hot-reload Burn, #189 LCD feedback on SD write failure, #190 first-run onboarding, #191 optional bespoke per-widget colours, #193 bundle visualizer + size budget, #194 firmware native tests).