Commit Graph
951 Commits
Author SHA1 Message Date
Laurens Valk 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
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 Aguilar 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 Aguilar 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 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 Farago 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 Farago 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 Farago 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 Farago 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 70bedecb83 firmware: implement EV3 official firmware restore
Basic support for restoring the official EV3 firmware. Is missing a video
and needs a bunch of helpful error messages, but basic functionality
is working.
2025-08-09 21:51:47 -05:00
David Lechner 007640c7b6 firmware: add UI for EV3 firmware flashing
This is just the UI bits (new file template, Pybricks firmware install,
official firmware restore).

The Pybricks firmware flashing hangs because we don't have a EV3 firmware
yet in @pybricks/firmware. Official firmware restore has an alert()
placeholder so at least it does something.
2025-08-09 21:51:47 -05:00
David Lechner 8b5cab4760 s/Web USB/WebUSB/g 2025-08-09 21:51:47 -05:00
David Lechner 5e8c8b8743 firmware: installPybricksDialog: add exception for Technic Move hub
The Technic Move hub requires signed firmware, so we cannot install
Pybricks on it.
2025-08-09 21:51:47 -05:00
David Lechner a546109273 usb: add USB support
Initial working USB support.
2025-08-08 21:36:18 -05:00
David Lechner 38db0d016c hub: move hub info reducers to hub
Most of the hub state doesn't depend on the connection type. To make it
generic, move it out of ble and into hub so that we can share it with
usb.
2025-08-08 21:36:18 -05:00
David Lechner 1fe01b5719 status-bar: make visibility depend on runtime state
Change dependency on Bluetooth connection state to runtime state. This
way it works for USB connection as well.
2025-08-08 21:36:18 -05:00
David Lechner 3c4cc20c53 ble-pybricks-service: add support for slots
The firmware has added some additional info for hubs that support slots
for user programs. Add these additional parameters accordingly.
2025-07-26 16:14:40 -05:00
David Lechner 1a7663a383 ble-pybricks-service: rename slot to progId
Rename the requested program ID from slot to progId and the running
program ID to runningProgId. These can also have the value of built-in
programs, not just slot numbers, so it doesn't make sense to call them
slots.
2025-07-26 16:14:40 -05:00
David Lechner 0472978e50 ble-pybricks-service/sagas: simplify test
I meant to change this before merging the previous commit, but missed it.

The mismatch test was hard to understand and didn't increase coverage,
so let's leave it out.
2024-10-27 18:12:24 -05:00
Attila FaragoandDavid Lechner 14f4716dbc Implemented pybricks protocol v1.4.0 (#2317)
* Update for changed StartUserProgram command semantics
* Added new capability flags and fixed-purpose slot definitions
* Update for new start REPL command
* Updated StartUserProgram command and Status event for slots
* Added new AppData command and event

---------

Co-authored-by: David Lechner <david@pybricks.com>
2024-10-27 17:59:04 -05:00
David Lechner baaa9a7920 terminal/sagas: fix handling multibyte unicode
Enable the stream option on the text decode for the stdout and uart
stream handlers that pipe data to the terminal. This fixes improperly
printing multibyte unicode characters that get split across multiple
data packets.

A new decode is added for each different stream in case both are used
at the same time.

Fixes: https://github.com/pybricks/support/issues/1743
2024-09-08 17:52:12 -05:00
David Lechner a308303f07 firmware/sagas: revert debug changes
This was missed in the last commit.
2024-09-08 17:19:39 -05:00
David Lechner 236ad56148 firmware/sagas: reduce BLE firmware burst size
Mac users have recently been reporting failed firmware updates due to
the hub disconnecting during the update process. This is likely due to
the Mac sending packets faster than the hub can handle. This changes
the arbitrary BLE firmware burst size from 10 to 8 to reduce the chance
of the hub getting overwhelmed.

Fixes: https://github.com/pybricks/support/issues/1787
2024-09-08 17:10:14 -05:00
Laurens Valk 5c3af1c3da sponsor: Fix <ul> nested under <p>. 2023-12-18 13:13:45 +01:00
David Lechner 8710cd9c46 editor: fix change in type in monaco-editor 0.45.0 2023-12-16 11:08:49 +01:00
David Lechner 5cd0873148 fix centering of logo
For some reason, two is now using the last item in the svg group for
centering, which was one of the eyes. The changes the order so that the
body is not the last item and centering works again.
2023-11-18 17:21:44 -06:00
David Lechner c021a77334 add fix for fake-indexeddb v5
https://github.com/dumbmatter/fakeIndexedDB/issues/88
2023-11-18 14:40:16 -06:00
David Lechner 5389d59842 fix missing FocusScope in button tests 2023-11-15 17:48:17 -06:00
David Lechner 2d968381c4 add assert to work around react-aria typing changes 2023-11-15 17:48:17 -06:00
David Lechner 17aaaa7959 fix type error from react-joyride upgrade 2023-11-15 17:00:37 -06:00
dependabot[bot]andDavid Lechner 1a57e4396c build(deps-dev): bump prettier from 3.0.3 to 3.1.0 (#2114)
* build(deps-dev): bump prettier from 3.0.3 to 3.1.0

Bumps [prettier](https://github.com/prettier/prettier) from 3.0.3 to 3.1.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.3...3.1.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* auto formatting for prettier 3.1.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Lechner <david@pybricks.com>
2023-11-15 22:55:10 +00:00
David Lechner 9644fb483c revert overlay size hack
This broke other stuff by making the overlay present even when there
was no content.
2023-11-12 14:44:00 -06:00
David Lechner 7924810b23 fix dialogs on android
Dialogs were off of the screen due to the overlays being bigger than
the view port. This is fixed by adding some style to limit the size.

Also multi-step dialogs are hard-coded to have min-width of 800px in
blueprints.js, so we need to override this on smaller screens.

Fixes: https://github.com/pybricks/support/issues/1271
2023-11-11 18:01:33 -06:00
dependabot[bot]andDavid Lechner 9b574720d9 build(deps): bump pyodide from 0.23.4 to 0.24.1 (#2094)
* build(deps): bump pyodide from 0.23.4 to 0.24.1

Bumps [pyodide](https://github.com/pyodide/pyodide) from 0.23.4 to 0.24.1.
- [Release notes](https://github.com/pyodide/pyodide/releases)
- [Commits](https://github.com/pyodide/pyodide/compare/0.23.4...0.24.1)

---
updated-dependencies:
- dependency-name: pyodide
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* updates for pyodide 0.24.0

- fix breaking file rename
- replace use of deprecated type

* use @pyodide/webpack-plugin

Pyodide 0.24 made some breaking changes that broke the way we were
integrating it with webpack manually. We can use the official webpack
plugin instead.

* webpack: add hack for pyodide

This works around "Critical dependency: the request of a dependency is an expression"

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Lechner <david@pybricks.com>
2023-11-11 22:46:28 +00:00
David Lechner c03e5782f8 setupTests: fix import for jest-dom v6
Fixes breaking change: https://github.com/testing-library/jest-dom/releases/tag/v6.0.0
2023-11-11 15:12:55 -06:00