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).
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.
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.
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.
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
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.
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.
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
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.
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
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)
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.
Add an extra progress between erasing and writing. This makes the
progress not stall for quite as long before progressing when flashing
smaller firmwares.
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.
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.
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.
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.
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.
For some reason, the type checker doesn't catch this, but
FailToFinishReasonType.Unknown requires an error argument, otherwise
we get an unhandled exception.
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.