3093 Commits
Author SHA1 Message Date
Laurens Valk ea9af98d1f usb/sagas: Drop debug prints.
We don't have these for BLE either, and it makes other debugging harder.
2026-04-02 10:25:39 +02:00
Laurens Valk c49df2b81f scripts/serve: Optionally serve over https.
Allows local testing on mobile devices with Bluetooth, USB, and camera suppport.
2026-04-02 10:25:34 +02:00
Laurens Valk 38a71238f9 app: Replace local/session docs toggle with state.
Having this persist across sessions is not necessary and a bit overly complicated when we add more sideview states such as camera (which should not stay on by default).
2026-03-30 14:37:59 +02:00
Laurens Valk 7e4a9b94d5 app: Move docs button component.
Everything is visually unchanged. This just moves the button logic to the app, since it doesn't conceptually belong to the editor component.

It controls things such as docs which has nothing to do with the editor. This way we don't have to pass states as props around when we add more buttons later.
2026-03-30 14:24:49 +02:00
Laurens Valk c3a703f3b3 app: Drop doc toggle shortkey.
This was an undocumented feature that gets in the way of other shortcuts, and doesn't extend well to the sideview being used for other things in future commits.
2026-03-30 14:24:44 +02:00
Laurens Valk 2884825f4c app: Drop persistent docs position.
This was very complicated, particularly between versions and tabs and windows, for something that offers only a minor convenience.

This also makes it simpler to navigate to a particular page interactively by just setting the iframe URL, which is useful for interactive help from the block editor.
2026-03-30 14:24:24 +02:00
Laurens Valk a09383de68 app: Drop hacks that preserved docs scroll.
The iframe automatically scrolled to 0 when CSS `display: none` is set, so we had several workarounds. Hide it instead.
2026-03-30 14:24:14 +02:00
Laurens Valk 98d2e82240 package.json: Bump firmware. 2026-03-19 15:38:32 +01:00
Laurens Valk 660a796333 hub/reducers: Also match legacy flags against USB actions.
We were already doing something similar for USB firmware revision, but this was missed for software revision.
2026-03-19 10:08:42 +01:00
Laurens Valk f3dc7b55b7 sagas/mpy: Use legacy __main__ on old firmware.
Needed for backwards compatibility. Older firmware always look for __main__.

See https://github.com/pybricks/support/issues/2364
2026-03-19 09:11:02 +01:00
Laurens Valk a18d88dffd sagas/mpy: Use main module name instead of __main__.
This is separate from Python's __main__ mechanism, so we shouldn't be manually renaming things to __main__ here.

This also makes file names show correctly on EV3.

See https://github.com/pybricks/support/issues/2364
2026-03-17 15:14:23 +01:00
Laurens Valk 32f2ece4da firmware/bootloaderInstructions: Add EV3 video.
Also fix:
- incorrect reference to version selection during install
- missing HID device name
2026-02-27 12:35:44 +01:00
Swan JengandDavid Lechner 7f038ec6b6 Fix broken link 2026-02-15 21:04:43 -06:00
David Lechner 529ae9e1bf github: include date in version for labs build
Make labs version a bit easier to identify by also including the build date.
2026-01-25 17:05:21 -06:00
David Lechner d629c225f0 app: update copyright year to 2026 2026-01-25 17:05:21 -06:00
David Lechner 86e08e4c94 alerts/UnexpectedErrorAlert: expand the message
Expand the unexpected error alert message to include instructions on
what information to provide to make a useful bug report.
2026-01-25 16:53:39 -06:00
David Lechner ed886745ff usb/sagas: show unexpected error alerts
Add more error alerts when failing to connect to a Pybricks hub over USB.
We will need user feedback on what triggered the error to be able to
write a helpful error message, so we are using the unexpected error
alert for now.
2026-01-25 16:53:39 -06:00
David Lechner 209b7ef974 usb: show error message if opening device fails
So far, we've just seen this on Linux when the user doesn't have the
correct udev rules installed. We'll have to wait for more user feedback
to see what other situations might cause this.
2026-01-25 16:53:39 -06:00
David Lechner b6cf5e8491 usb: implement AlreadyInUse alert
Add an alert that notifies the user when the USB device is already in
use by another application.

Closes: https://github.com/pybricks/support/issues/2373
2026-01-25 16:53:39 -06:00
David Lechner 457fa8b6b2 usb/sagas: Fix command response race condition
Fix a race condition where a response to a USB command could be missed
if it arrives before the USB transferOut() call returns. This is done
by using a channel to buffer incoming responses.

Fixes: https://github.com/pybricks/support/issues/2467
2026-01-25 14:30:05 -06:00
David Lechner fa275b8000 github: upload build artifact
Add a step to upload the build artifact after building the project.

This will make it easy for people to test it without having to build it
themselves.
2026-01-25 14:30:05 -06:00
David Lechner 368ab7cb96 usb/sagas: Retry USB device open on Linux if SecurityError occurs
On slow machines, udev rules may not have finished processing by the time
we try to open the USB device. This causes a SecurityError, so we add a
retry loop to handle this case.

Closes: https://github.com/pybricks/support/issues/2372
2026-01-25 14:30:05 -06:00
Laurens ValkandDavid Lechner 3abc3f3b52 usb/sagas: Don't reset USB device.
This operation does not work on Windows, and does not appear to be
crucial on other platforms either. The browser seems to already handle
resetting the endpoints as needed when connecting or closing the browser
(at least on Linux)
2026-01-24 16:16:02 -06:00
David Lechner 7a415e7c85 firmware/ev3: pad firmware to avoid bugs
Add a function to pad EV3 firmware size to avoid potentially triggering
bugs in the EV3 bootloader. When we do a download command with too small
of a payload, the bootloader can send a bad response. We can work around
this by ensuring that the firmware size is such that the last chunk is
the maximum size. This way we never send a small chunk that could
trigger the bug.
2026-01-24 16:16:02 -06:00
David Lechner 38bb4f3092 firmware/ev3: add extra progress report
Add an extra progress between erasing and writing. This makes the
progress not stall for quite as long before progressing when flashing
smaller firmwares.
2026-01-24 16:16:02 -06:00
David Lechner 055d2c8ca8 firmware/ev3: erase 2 sectors at one time
Change from erasing 1 sector at a time to erasing 2 sectors at a time.
This works around a USB issue where commands that don't take long to
execute can receive an incorrect response.

The point of erasing 2 sectors at a time is that when we write the data
to the sectors that we just erased, the last (partial) chunk of data is
now twice as large, which makes it take twice as long to write. This
seems to be long enough to avoid the USB issue.
2026-01-24 16:16:02 -06:00
David Lechner 04697e9afa firmware/ev3: allow buggy replies from EV3 bootloader
Add a hack to not fail if the EV3 bootloader sends an echo of the request
instead of the expected response. There is a known compatibility issue
with the EV3 bootloader USB and, e.g. Windows with USB 3.0 ports. This
apparently causes a race condition where commands that don't take long
to process before sending a response will have the request echoed back
instead of receiving the actual response. If this happens, we can
ignore it and assume the command was successful. It just won't work, e.g.
for the version command since that has a payload in the response.
2026-01-24 16:16:02 -06:00
Laurens Valk c8d7f6090b toolbar/buttons/usb: Add connected icon.
Fixes https://github.com/pybricks/support/issues/2371
2026-01-23 14:13:18 +01:00
Laurens Valk 8ef3e85c45 ble/sagas: Don't read NUS for new firmware.
This hasn't been used for a long time in Pybricks Code. We're only keeping it in the firmware because Pybricks Code raises an error otherwise.

Disabling it saves about +400 bytes on Move Hub and Technic Hub and helps simplify the firmware. By removing it we don't run untested code if someone connects to the advertised NUS service.
2026-01-23 11:06:21 +01:00
Laurens Valk e5e2d303dd firmware/installPybricksDialog/hooks: Include EV3 zip.
Otherwise EV3 installation cannot proceed even when it
is included in the firmware NPM package.
2026-01-23 10:33:54 +01:00
Laurens Valk 1aa1d40410 package.json: Bump firmware package.
This includes EV3.
2026-01-23 10:33:54 +01:00
David Lechner a4aade5a29 firmware/actions: remove didStart and didFinish actions
Remove didStart and didFinish actions from firmware flashing sagas as
they are not used for anything.

didFailToFinish is not so easily removed as it is used to trigger error
toasts.
2026-01-04 17:27:08 -06:00
David Lechner 7fe080bf1a firmware/reducers: remove 'flashing' state
The 'flashing' state variable in the firmware reducer is not used
anymore so can be removed.
2026-01-04 17:27:08 -06:00
David Lechner 6911bdd3da firmware/sagas: fix duplicate error alerts for ev3 flashing
Remove alertsShowAlert() calls. didFailToFinish() already triggers
an error toast.
2026-01-04 17:27:08 -06:00
David Lechner 71a6727a8f firmware/actions: reuse isError from utils
Remove duplicate isError function.
2026-01-04 17:27:08 -06:00
James AguilarandGitHub d19ded5908 firmware/ev3: Don't request hardware version.
This feature doesn't seem to work when it is issued from a USB3 bus.
See https://github.com/pybricks/support/issues/2515. Since we don't
use the version, removing the command is harmless.
2026-01-04 03:06:42 +00:00
David Lechner 0d0e366cba firmware/sagas: fix progress toasts not being removed on error
Add some calls to hide the progress toasts when an error occurs during
firmware flashing. Without this, the toasts would remain visible even
after the error alert was shown.
2026-01-03 21:01:53 -06:00
David Lechner 830855e428 firmware: remove progress/didProgress
Remove the didProgress action and progress state, as they were not being used.
2026-01-03 21:01:53 -06:00
David Lechner 4469e173cd firmware/sagas: add check for new SPIKE Prime bootloader version 2026-01-03 21:01:53 -06:00
James AguilarandDavid Lechner 8db1a27486 firmware: Don't add checksums when not needed.
This fixes an issue where the EV3 firmware had checksums appended to
it that made its size not align to the sector size, causing flashing
to fail.
2026-01-02 17:34:46 -06:00
David Lechner 4516cc8764 yarn: Bump @types/w3c-web-usb from 1.0.10 to 1.0.11
Patch got merged upstream, so we no longer need it.
2025-09-06 12:51:33 -04:00
David Lechner fa21abc7ec firmware/sagas: fix missing error arg when unknown reason
For some reason, the type checker doesn't catch this, but
FailToFinishReasonType.Unknown requires an error argument, otherwise
we get an unhandled exception.
2025-08-30 19:12:53 -04:00
Attila FaragoandDavid Lechner 00516f2a39 firmware/installPybricksDialog: finish EV3 implementation
Add missing bits to get firmware flashing on EV3 working. Currently
requires custom firmware since we don't have a packaged one yet.
2025-08-30 19:12:53 -04:00
David Lechner 84cca9d8e6 firmware/sagas: finish EV3 message ID TODO
Implement unique message ID for EV3 firmware messages.
2025-08-30 19:12:53 -04:00
Attila FaragoandDavid Lechner 7ef6c02198 firmware/sagas: fix race condition in EV3 sendCommand()
Start listening for reply before sending command to avoid race condition
of reply being received and action dispatched before we call take().
2025-08-30 19:12:53 -04:00
David Lechner 426305116b firmware/sagas: handle case of checksum-type == 'none'
The v2.1 spec allows this, but up to now, Pybricks code didn't handle it.
2025-08-30 19:12:53 -04:00
Attila FaragoandDavid Lechner fadc3bc8c7 firmware/installPybricksDialog/hooks: dispatch error if no url
Dispatch an error in case there is no firmware URL. Normally this should
never happen, but currently it does because we don't have EV3 firmware
yet. The error is more useful than just spinning forever.
2025-08-30 19:12:53 -04:00
Attila FaragoandDavid Lechner c6302232e3 usb/sagas: always set configuration
On some OSes, like macOS, the configuration may not be selected, so we
need to make sure it is always set.
2025-08-30 19:12:53 -04:00
David Lechner 6fc327a917 yarn: patch @types/w3c-web-usb
Fix issues with null vs. undefined.

Based on https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73568
2025-08-30 19:12:53 -04:00
David Lechner 1f81fbb8c7 webpack: bump precache size to 16MiB for EV3 firmware 2025-08-09 21:51:47 -05:00