Commit Graph
361 Commits
Author SHA1 Message Date
David Lechner b7b3522f78 Merge remote-tracking branch 'origin/master' into dlech 2021-08-13 10:46:01 -05:00
David Lechner 7ddeed58b7 firmware: validate checksum while flashing
Since we are using the checksum message for throttling flash speed
anyway, we can validate the checksum during the flash process to
catch errors earlier.

Issue: https://github.com/pybricks/support/issues/433
2021-08-13 10:40:49 -05:00
David Lechner ce8f59e0c2 firmware: fix flashing on Android
Hubs that don't use the minimum chunk size will fail on Android since
it defaults to the smallest possible MTU.

Issue: https://github.com/pybricks/support/issues/403
2021-08-12 15:55:24 -05:00
David Lechner 56c739fa08 os: add isAndroid() function
This will be used to test if the app is running on Android.
2021-08-12 15:55:24 -05:00
David Lechner 2ba6d88c49 editor: remove gutter background override
This was carried over from the Ace editor, but doesn't work well with
the Monaco editor.

Fixes: https://github.com/pybricks/pybricks-code/issues/472
2021-07-08 15:57:16 -05:00
David Lechner 9ee2d1f102 editor: clean up keywords and builtins
- remove python 2 stuff
- separate builtins from keywords
2021-07-08 15:56:27 -05:00
David Lechner ad948dc152 editor: copy python language configuration
This copies the language configuration from https://github.com/microsoft/monaco-languages/blob/d7cc098c481059f63d51ce3753975c8ca8ab6030/src/python/python.ts

This fixes a number of editor features, like auto-indent.

Fixes: https://github.com/pybricks/pybricks-code/issues/470
2021-07-08 15:55:50 -05:00
David Lechner 4b0dc90e8d editor: improve template snippets
- fix always being suggested
- add more imports
- reduce duplicated code

Fixes https://github.com/pybricks/pybricks-code/issues/471
2021-07-08 15:55:03 -05:00
David Lechner 4e2902730a hub: fix buttons not enabled after connection
A previous commit broke buttons after connecting since state all state
transitions were changed to be ignored if the current state was
"disconnected". This made it impossible to get into any other state.

This brings back use of the "unknown" state upon initial connection
to provide a path out of the "disconnected" state.

Fixes: 7a5aa75894
2021-07-06 10:53:56 -05:00
David Lechner d95c550248 editor: change from ace to monaco
This replaces the ace editor with the monaco editor. It fixes quite a
few small paper-cut bugs and should be easier to add code completion
to in the future.

Many of the snippets are omitted but can be added back later if needed.
Otherwise, we have tried to preserve the existing look and feel as much
as possible.
2021-07-02 20:59:09 -05:00
David Lechner c3851e7139 tests: use matchMedia polyfill
This makes testing code that uses window.matchMedia() work better since
it mocks it globally.
2021-07-02 20:59:09 -05:00
David Lechner 7a5aa75894 hub: fix bad hub runtime state when disconnected
This fixes a bad hub runtime state when the hub disconnects during a
download. This caused the run button in the UI to be enabled when the
hub was disconnected.

Issue: https://github.com/pybricks/support/issues/378
2021-07-01 11:58:04 -05:00
David Lechner ab0ddd04b5 about/AboutDialog: fix failing test when $REACT_APP_NAME set
When the `REACT_APP_NAME` environment variable is set to something other
that "Pybricks Code", it caused the test to fail.
2021-06-23 15:12:07 -05:00
David Lechner 10148fa9cf ble-uart: decode PnP ID if it exists 2021-06-23 12:31:19 -05:00
David Lechner 9fca17fbac update projects URL to point to Pybricks website 2021-06-08 16:21:48 -05:00
David Lechner 6c692a7e95 fix wrapping on external link buttons 2021-06-08 14:52:44 -05:00
David Lechner 205937fdc3 add changelog link to about dialog 2021-06-08 14:52:44 -05:00
David Lechner deee6578f7 improved bluetooth adapter error message
Issue: https://github.com/pybricks/support/issues/338
2021-05-17 13:24:57 -05:00
David Lechner 12f3f40e36 use spinner when bluetooth is connecting
It can take a while (especially on Windows) before the connection is
ready and the other buttons become enabled. So use a spinner to let
the user know that we are working on it.

Issue: https://github.com/pybricks/support/issues/315
2021-05-17 13:03:32 -05:00
David Lechner 1279370fc8 Fix firmware flash button not disabled while connecting
We were using the wrong state variable to detect when BLE is disconnected.
We care about the BLE connection state, not the hub runtime state here.

Issue: https://github.com/pybricks/support/issues/315#issuecomment-841486591
2021-05-17 12:44:30 -05:00
David Lechner 956b6f3c96 firmware: add windows BLE hacks
This works around some issues that have been observed on a specific
Windows computer.

Issue: https://github.com/pybricks/support/issues/256
2021-05-16 16:18:34 -05:00
David Lechner 4da6f7e368 use overflow: hidden on splitter panes
This fixes problems with double scroll bars showing up.

Fixes: https://github.com/pybricks/pybricks-code/issues/406
Fixes: https://github.com/pybricks/pybricks-code/issues/407
2021-05-11 14:38:04 -05:00
David Lechner ec6753c314 yarn lint
rules seem to have changed a bit after upgrading packages
2021-05-11 12:45:43 -05:00
David Lechner e8c4472e50 Add progress bar for user program download. 2021-04-12 16:24:36 -05:00
David Lechner 1964c9c485 Add timeout while waiting for checksum
This adds a timeout while waiting for the checksum from the hub when
downloading and running a program. Without this, we can get stuck in
the "loading" state if the hub doesn't respond as expected. This can
happen, for example, if a program is started with the hub button at the
same time as the start button in Pybricks Code is pressed.

Issue: https://github.com/pybricks/support/issues/301
2021-04-12 13:24:10 -05:00
David Lechner 0d89f8daad Disable flash button when hub is connected.
Fixes: https://github.com/pybricks/support/issues/299
2021-04-12 10:34:59 -05:00
David Lechner f39dea36fe Fix <p> element on notification action
55e724e8d8 introduced <p> elements on
notifications. however this is undesirable on the notification action
text. This splits the Notification component into one that is pre change
and one that is post change.

Fixes #394
2021-04-07 13:19:52 -05:00
David Lechner 7f9e6bd4db Fix download and run race condition
It was possible for a program to start and finish running before the
final checksum message was received, which resulted in a bad state
(run button disabled).

This fixes it by using proper didStart/didFinish/didFailToFinish
actions for the download saga and updates the reducer to handle all
cases.
2021-04-07 12:28:36 -05:00
David Lechner a081c4a798 Fix download and run race condition
This fixes a race condition where the hub program running status flag
is received before the last checksum from the download process.

Issue: https://github.com/pybricks/support/issues/290
2021-04-07 11:27:40 -05:00
David Lechner 605a910746 Fix failing download and run
The firmware was changed to send status updates at a regular interval
which caused the hub state to change back to idle prematurely during
download and run. This caused any program more than one or two lines
long to fail.

Issue: https://github.com/pybricks/support/issues/290
2021-04-06 13:48:38 -05:00
David Lechner 76a5f8fe26 drop HubRuntimeStatusType Idle and Running
These are no longer used
2021-04-06 13:42:26 -05:00
David Lechner 829e47c75a Wrap long lines in compiler error
This way we don't overflow the toast.
2021-04-01 14:24:31 -05:00
David Lechner 09ba8bb035 Increase toast max-width
This makes it big enough to fit the compiler error message

    IndentationError: unindent doesn't match any outer indent level

If we still have problems with overflow we should probably look at
ways to wrap <pre> text instead of making this wider.
2021-04-01 14:13:25 -05:00
David Lechner 55e724e8d8 Allow splitting long notifications
This adds the ability to split notification messages in to multiple paragraphs.
2021-04-01 13:58:01 -05:00
David Lechner ca1ec0a64e Add Device Information Service support
The Pybricks firmware now includes the BLE Device Information Service
to provide firmware and Pybricks protocol versions.

For now, checking that the service is present is enough to know that the
firmware is up to date. But we will need to add additional checks as
soon as the protocol is changed.
2021-04-01 13:29:10 -05:00
David Lechner 64c75640ba ble-pybricks-service: add some tests 2021-03-12 08:54:20 -06:00
David Lechner 56829a502c ble-pybricks-service/sagas: fix filtering of command send completions
Since didSend and didFailToSend are part of the same enum as the command
send actions types, we have to filter them out when subscribing to the
send actions.
2021-03-10 11:19:06 -06:00
David Lechner 684df491e0 ble-uart/sagas: use array to managed forked tasks
This simplifies keeping track of which tasks need to be canceled in the
error paths.
2021-03-10 11:00:54 -06:00
David Lechner 4b3a6fea5e hub: fix missed notification when connecting
This fixes the first notification being missed due to the notification
handler not being started until after notifications are enabled.

It also fixes the DidConnect action changing the state to Unknown after
a notification was received that set the state to a known value.
2021-03-10 10:30:15 -06:00
David Lechner 430147487e implement Pybricks service stop command 2021-03-10 10:30:15 -06:00
David Lechner 61c34fc4b1 implement BLE Pybricks service status notifications
This is the beginning of the BLE Pybricks service implementation, so
changes are made to get a handle to the Pybricks control characteristic
and enable notifications.

Currently, only one event (the status report event) and no commands are
implemented on this characteristic.

The new status report event replaces monitoring the UART for >>>>
strings to get the current hub state.

Also includes some minor cleanup in the ble-uart/actions for consistency.
2021-03-10 10:30:15 -06:00
David Lechner cdd74706c5 toolbar is not a navbar
This adds custom styling for the toolbar (inspired by blueprintsjs
navbar). But this lets us use the correct role and not fight the
navbar styling so much.
2021-02-01 13:02:07 -06:00
David Lechner 1e5d25086b move app version to constants 2021-02-01 13:02:06 -06:00
David Lechner a8b3f5dcf7 use env for app name 2021-02-01 13:02:06 -06:00
David Lechner 9005e909ba refactor common context menu code 2021-02-01 10:26:06 -06:00
David Lechner 714cf8b8cb remove use of ContextMenuTarget from Terminal 2021-02-01 10:26:06 -06:00
David Lechner af964c04b4 use fake redux store in component tests 2021-02-01 10:26:06 -06:00
David Lechner 4b6817d9ad drop use of decorator for editor context menu 2021-02-01 10:26:06 -06:00
David Lechner 6ccb77a5ad add test for snippets 2021-02-01 10:26:06 -06:00
David Lechner 4c5adc20e7 add tests for AboutDialog 2021-02-01 10:26:06 -06:00