Commit Graph
934 Commits
Author SHA1 Message Date
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
dependabot[bot]andDavid Lechner de86d78c03 build(deps): bump @types/react from 18.2.21 to 18.2.37 (#2087)
* build(deps): bump @types/react from 18.2.21 to 18.2.37

Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.21 to 18.2.37.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* yarn: update react-splitter-layout

* fix type errors for react-splitter-layout

Upgrading to `@types/react` > 18.2.21 causes the following errors:

```
src/app/App.tsx:202:22 - error TS2786: 'SplitterLayout' cannot be used as a JSX component.
  Its instance type 'SplitterLayout' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'import("/home/david/work/pybricks/pybricks-code/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode' is not assignable to type 'React.ReactNode'.
        Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
          Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

202                     <SplitterLayout
                         ~~~~~~~~~~~~~~

  node_modules/@types/react/ts5.0/index.d.ts:175:9
    175         children: ReactNode;
                ~~~~~~~~
    'children' is declared here.

src/app/App.tsx:212:26 - error TS2786: 'SplitterLayout' cannot be used as a JSX component.
  Its instance type 'SplitterLayout' is not a valid JSX element.

212                         <SplitterLayout
                             ~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: src/app/App.tsx:202
```

https://arethetypeswrong.github.io/?p=react-splitter-layout%404.0.0

provided the hint that we need `export =` instead of `export default`.

---------

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 20:43:23 +00:00
Laurens Valk 595a17ac4a build(deps): Bump firmware, docs, jedi to v3.3.0b9. 2023-10-26 22:19:53 +02:00
David Park 64d489de60 Clarify why bluetooth may not be available
On iOS `getAvailability()` returns false if the app does not have permission to use the bluetooth adapter (which is what the spec says it should do if permission has not been granted), so clarify the reason for it not being available.

Also add a sneaky reference to WebBLE as a supported browser on iOS.
2023-09-14 17:52:41 -05:00
David Lechner 061d22a7aa prettier v3 changes 2023-08-08 08:15:24 -07:00
David Lechner 7bf108087f firmware: disable buttons when DFU in progress
This avoids trying to perform two DFU operations on the same device
at one time. Flashing is so fast, this seems the better option than
trying to support flashing more than one device at a time.

Fixes: https://github.com/pybricks/support/issues/1146
2023-07-12 11:42:53 -05:00
David Lechner 2aea540d23 update to React 18 createRoot()
This was overlooked when we updated to React 18. This fixes console
error about using React 17 behavior.

StrictMode had to be disabled because it broke the editor.
2023-07-12 11:42:53 -05:00
David Lechner 42f96b4ca0 terminal/Terminal: work around xterm cursor style issue
Since updating to Blueprintjs 5.x we can get aliasing artifacts on the
cursor due to bad rendering of box-shadow. This overrides it with
border instead.

https://github.com/xtermjs/xterm.js/issues/4580
2023-07-05 11:06:45 -05:00
dependabot[bot]andDavid Lechner 5b5af67ba9 build(deps): bump jest from 29.5.0 to 29.6.0 (#1882)
* build(deps): bump jest from 29.5.0 to 29.6.0

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 29.5.0 to 29.6.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.6.0/packages/jest)

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

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

* explorer/sagas: fix race in tests

Updating from jest 29.5.0 to 29.6.0 exposed a race condition in the
tests where the mock took effect too late.

---------

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-07-05 14:45:36 +00:00
David Lechner 3ce7003f10 fix terminal not working
Fixes: https://github.com/pybricks/support/issues/1130
2023-07-01 11:09:08 -05:00
David Lechner 65e5627568 update to blueprintjs 5.x 2023-06-28 14:42:55 -05:00
David Lechner df84e41061 status-bar: allow selection version
This is useful for copy/pasting version for support.

Fixes: https://github.com/pybricks/support/issues/1083
2023-05-26 15:25:49 -05:00
David Lechner fc89c7b329 explorer: active file after duplicating
When duplicating a file users expect the file to be opened as in other
applications.

Fixes: https://github.com/pybricks/support/issues/1084
2023-05-26 11:13:31 -05:00
David Lechner 57c2b8a28b editor: add undo stop when switching model
Since we share the same editor instance with multiple models, we need
to ensure undo stack consistency when changing the model, otherwise
we can lose some history, e.g. if a not active model is modified.
2023-05-18 17:06:31 -05:00
David Lechner 7351dfb95c editor: fix replacing file when open in editor
When we import/replace a file that is open in an editor, instead of
modifying the file in storage, we need to modify the file in the editor.
This allows the modification to be pushed on the undo stack so that
the user can undo the change in case it wrote over any of their recent
changes.

Issue: https://github.com/pybricks/support/issues/975
2023-05-18 17:06:31 -05:00
David Lechner 3fc275eaed fix node 18 type resolution error
After updating to @types/node 18.x, we started getting an error when
mocking FileWithHandle. For some reason, the type hints don't allow
for partial implementation anymore.

Hack around the problem by just casting the partial implementation.
2023-05-18 09:42:07 -05:00
David Lechner c733881815 fix some test console errors
The react testing library prints errors to the console about not using
act(). This adds fixes/workarounds for most cases.
2023-05-17 16:33:47 -05:00
David Lechner bf4670b25d update to react 18
We were stuck on react 16.x for a long time but dependencies seem to
have caught up enough that migration is trivial now.
2023-05-17 16:33:47 -05:00