Commit Graph
715 Commits
Author SHA1 Message Date
David Lechner 6f91c57743 firmware/sagas: add delay after connecting
This adds a delay after connecting to a hub when flashing firmware via
BLE before sending any commands. This gives the OS Bluetooth stack time
to finish enumerating the Bluetooth device before we start trying to
interact with the device. Hopefully this fixes issues for some people
who are seeing problems while flashing firmware.

Issue: https://github.com/orgs/pybricks/discussions/792
2022-11-11 13:00:40 -06:00
David Lechner b2e098f2dd app: catch error when checking for updates
ServiceWorkerRegistration.update() can raise exceptions, so we need to
catch and handle them, otherwise it will crash redux sagas and the app
will stop responding.

Fixes: https://github.com/pybricks/pybricks-code/issues/1299
2022-11-11 13:00:40 -06:00
David Lechner 992923bf15 SponsorDialog: make team link inline
Also buttons cannot be inside of `<p>` tags.
2022-11-10 13:47:16 -06:00
David Lechner 3e50e58206 mpy/sagas: use "new" webpack asset URL
Jest added support for wasm imports which broke our tests. In the mean
time, Webpack 5 added a new asset inclusion mechanism that can work
around this and removes the need for our existing webpack workaround.
2022-11-10 13:47:16 -06:00
Laurens Valk 6ca0c49557 sponsor: Add an introduction. 2022-11-10 13:06:38 -06:00
Laurens Valk 4e64347870 sponsor: Add Paypal link.
Provide some more convenience options.

Also add an ENS domain while we are at it.
2022-11-10 13:06:38 -06:00
David Lechner 072358036a explorer/newFileWizard: update layout
- move switch under template title
- add description text
- style changes
2022-11-08 13:56:38 -06:00
Laurens Valk 68810f071a explorer/newFileWizard: Invert template inclusion UI.
Instead of having the option to delete the template after selecting it, it is more intuitive to have a toggle for including it.
2022-11-08 13:56:38 -06:00
David Lechner e2f448c12b index: make checked:disabled radio buttons appear unchecked 2022-11-08 13:56:38 -06:00
David Lechner 3974613738 activities: fix not scrolling on overflow
This adds css needed to make the activities tab view contents scroll
appropriately when the contents don't fit vertically.

Fixes: https://github.com/pybricks/support/issues/782
2022-11-08 13:56:38 -06:00
David Lechner d8b8672793 pybricksMicropython/python-worker: consolidate loadPackage
The pyodide.loadPackage() method can take an array arg, so we don't
have to call it multiple times.
2022-11-08 13:56:38 -06:00
David Lechner cb5101282b firmware/sagas: fix checksum validation
The checksum can be 0, so we can't be lazy and use `!checksum` to test
for undefined.

Issue: https://github.com/pybricks/support/issues/724#issuecomment-1295929316
2022-10-29 14:05:31 -05:00
David Lechner 2d9a0ca39e terminal: focus when repl is requested 2022-10-28 18:01:39 -05:00
David Lechner 03f6c004db sponsor: add new button and dialog
Issue: https://github.com/pybricks/support/issues/719
2022-10-28 18:01:39 -05:00
David Lechner ede6f80f49 explorer/newFileWizard: add empty file option
Fixes: https://github.com/pybricks/pybricks-code/issues/771
2022-10-28 18:01:39 -05:00
David Lechner 7810a8ee87 components/hubPicker: use images instead of text 2022-10-28 18:01:39 -05:00
David Lechner 90b04f85b3 webpack: add hack to remove unused icons
This follows the suggestions from [1] to reduce the package size by
only including the icons we are actually using. This gets the main
module small enough to avoid the CRA "The bundle size is significantly
larger than recommended." warning (gzipped size is < 512KB).

[1]: https://github.com/palantir/blueprint/issues/2193
2022-10-27 13:17:51 -05:00
David Lechner 694b064683 remove unnecessary {} 2022-10-27 13:17:51 -05:00
David Lechner 0725203d66 app: lazy-load terminal
This changes the terminal sagas and components to be lazy loaded to
improve time until first render.
2022-10-27 13:17:51 -05:00
David Lechner c49f37f5e4 editor: lazy load
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.

This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.

This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
2022-10-27 13:17:51 -05:00
David Lechner 0f56bb7174 app/actions: drop didStart
This action is no longer used.
2022-10-27 13:17:51 -05:00
David Lechner 509c635a07 ble/sagas: add workaround for BlueZ quirk
The 'gattserverdisconnected' event is called before the device is
actually disconnected, so if the user tries to connect again
immediately, the web browser will show a still "paired" device, but
selecting this devices results in an infinite wait. This is a bug in
Chromium, but we can work around it by adding a delay to give BlueZ
time to actually disconnect the device.

Closes: https://github.com/pybricks/support/issues/600
2022-10-26 16:20:08 -05:00
David Lechner 57c87da464 editor: disable word-based suggestions
This turns off the default word-based suggestions. This was useful when
we didn't have proper code completion but now can be distracting.

Fixes: https://github.com/pybricks/support/issues/757
2022-10-25 13:48:02 -05:00
David Lechner e41a297922 editor: close tab on middle-click
Fixes: https://github.com/pybricks/support/issues/758
2022-10-25 12:57:07 -05:00
David Lechner ed8394bf84 pybricksMicropython/lib: handle exceptions when parsing
The new code parsing library raises exceptions when there are syntax
errors, so this needs to be handled.

Fixes: https://github.com/pybricks/support/issues/755
2022-10-25 11:50:06 -05:00
David Lechner cc37548e36 pybricksMicropython/lib: replace parser
This replaces the Python parsing library. The python-ast package has
really poor performance (many seconds to parse a 500 line file). The
new package can parse a file about 100 times faster.
2022-10-24 15:29:17 -05:00
laurensvalkandDavid Lechner a673a45b03 text: Don't say that dashes are allowed. (#1247)
* text: Don't say that dashes are allowed.

This was missed in https://github.com/pybricks/pybricks-code/commit/8b19ad58662186d2295a6241e8c3f84fbfd45809

* explorer/fileNameForGroup: remove dash from translaction dict

Co-authored-by: David Lechner <david@lechnology.com>
2022-10-24 20:07:35 +00:00
David Lechner 397ea60354 ReplButton: disable when hub doesn't support it
Fixes: https://github.com/pybricks/support/issues/743
2022-10-21 16:26:43 -05:00
David Lechner 964c18f12e ble/sagas: fix blePybricksServiceDidNotReceiveHubCapabilities firmware version
We were using the version from the @pybricks/firmware package but we
really want the version from the connected device.
2022-10-21 16:26:43 -05:00
David Lechner fa00c0aea6 firmware/sagas: fix progress alerts
These were being replaced (dismissed then new alert) instead of updated.
2022-10-21 16:26:43 -05:00
David Lechner 4400c0663e alerts/UnexpectedErrorAlert: fix not showing message
This was not showing the actual error message.

Also hide the technical details when no stack trace is available.
2022-10-21 16:26:43 -05:00
dependabot[bot]andDavid Lechner 49cc0e2126 build(deps): bump @pybricks/firmware from 6.0.1 to 6.1.0 (#1243)
* build(deps): bump @pybricks/firmware from 6.0.1 to 6.1.0

Bumps [@pybricks/firmware](https://github.com/pybricks/pybricks-micropython/tree/HEAD/npm/firmware) from 6.0.1 to 6.1.0.
- [Release notes](https://github.com/pybricks/pybricks-micropython/releases)
- [Changelog](https://github.com/pybricks/pybricks-micropython/blob/master/npm/firmware/CHANGELOG.md)
- [Commits](https://github.com/pybricks/pybricks-micropython/commits/HEAD/npm/firmware)

---
updated-dependencies:
- dependency-name: "@pybricks/firmware"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* update firmware version in test

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@lechnology.com>
2022-10-21 20:05:10 +00:00
David Lechner 7e726fffaf mpy/alerts: implement compiler error
This shows the output from mpy-cross and has a button to go to the
error.
2022-10-19 18:26:37 -05:00
David Lechner e5ab52b250 explorer/fileNameFormGroup: fix fix-it for dash in file name 2022-10-19 18:26:37 -05:00
David Lechner fc4cb8eb78 alerts: add alertsHideAlert actions
This is used instead of using toaster.dismiss() directly.
2022-10-19 18:26:37 -05:00
David Lechner 28cf87c356 alerts: allow overriding key
This adds an optional key parameter to alertsShowAlert() to allow
overriding the key. This allows us to call flashProgress using that
action instead of having to use the toaster directly.
2022-10-19 18:26:37 -05:00
David Lechner fa27649fe3 toasterTypes: change toaster to ref
Instead of rendering the toaster separate from the main index, add it
there so we can inherit all of the context providers. This requires
passing the ref object instead of the toaster instance itself, so
sagas have to be updated.
2022-10-19 18:26:37 -05:00
David Lechner be9272ca9c pybricksMicropython: implement appending imports
This implements appending compiled imported modules for the multi-mpy6
file format.
2022-10-19 18:26:37 -05:00
David Lechner 8b19ad5866 pybricksMicropython: don't allow files with dash
Since we are adding user imports, we need to make sure all file names
are valid module names, so this means we can't use a dash.
2022-10-19 18:26:37 -05:00
David Lechner 5948952174 hub: fix tooltip when download complete
The tooltip was still showing "Downloading... 100%" after downloading
was complete instead of returning to the normal tooltip.
2022-10-17 13:44:21 -05:00
David Lechner bd0b276ea5 hub/sagas: fix scaling of download progress
This was missed in 06b204dd53.

Fixes: https://github.com/pybricks/pybricks-code/issues/1219
2022-10-17 13:44:21 -05:00
David Lechner e67ae1c52b use "error" when type is Error
This renames "err" to "error" when the type is Error for consistency
(fixes redux complaints about non-serializable err).
2022-10-17 13:44:21 -05:00
David Lechner 06b204dd53 hub/sagas: fix handleDownloadAndRun slicing
Some of the math was assuming i was incremented with ++ instead += chunkSize.
2022-10-17 11:16:28 -05:00
David Lechner 960a3163ed add support for Pybricks Profile v1.2.0
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.

Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
2022-10-14 16:21:18 -05:00
David Lechner db43cb3e99 remove use of deprecated DomException code property 2022-10-14 16:21:18 -05:00
David Lechner eb26bfcf1b index: ignore value action properties
This was making noise in the browser console log.
2022-10-14 16:21:18 -05:00
David Lechner 6675310390 spelling 2022-10-14 16:21:18 -05:00
189cda94b1 build(deps): bump xterm and xterm-addon-fit (#1146)
* build(deps): bump xterm and xterm-addon-fit

Bumps [xterm](https://github.com/xtermjs/xterm.js) and [xterm-addon-fit](https://github.com/xtermjs/xterm.js). These dependencies needed to be updated together.

Updates `xterm` from 4.19.0 to 5.0.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/4.19.0...5.0.0)

Updates `xterm-addon-fit` from 0.5.0 to 0.6.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.5...0.6)

---
updated-dependencies:
- dependency-name: xterm
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: xterm-addon-fit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* [dependabot skip] Fix yarn.lock

* fix breaking changes for xterm.js 5.x

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-17 18:14:24 +00:00
6c373c302c build(deps): bump pyodide from 0.21.2 to 0.21.3 (#1144)
* build(deps): bump pyodide from 0.21.2 to 0.21.3

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

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

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

* [dependabot skip] Fix yarn.lock

* update patch for pyodide 0.21.3

* make use of new pyodide version export

* fix breaking change in loadPyodide indexURL

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-17 18:05:44 +00:00
David Lechner 56630ef2cf firmware/installPybricksDialog: drop support for including custom main.py
This removes the UI and internal support for selecting a file to include
as the main.py when flashing firmware. This feature was removed in the
firmware starting with firmware metadata v2.0.0 so the firmware that
ships with Pybricks code won't be able to do this in the near future.
So, it doesn't make sense to keep this feature only for old firmware.

It is still possible to replace the main.py in old firmware.zip files
and flash that way.
2022-09-14 18:12:34 -05:00