Commit Graph
12 Commits
Author SHA1 Message Date
David Lechner 861ea34d86 settings: convert flashCurrentProgram to react hook 2022-03-15 16:54:49 -05:00
David Lechner 569217d5dc editor: don't put editor in redux store
The redux store should not have non-serializable objects like the editor
in it.
2022-03-02 18:56:47 -06:00
David Lechner a9f4eaa32d actions: simplify usage of Matchable
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
2022-02-26 12:43:10 -06:00
David Lechner 9641898a75 actions: refactor actions
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].

[1]: https://phryneas.de/redux-typescript-no-discriminating-union
2022-02-25 17:58:30 -06:00
David Lechner ae40c2f540 firmware: flash custom hub name
This adds support for customizing the hub name when flashing firmware.

Fixes: https://github.com/pybricks/support/issues/52
2021-11-19 20:48:06 -06:00
David Lechner e7d44ea9a9 src/utils: add ensureError() function
Typescript v4.4 no longer assumes that the error in catch is an Error
object [1]. This adds a helper function to ensure that caught errors
at least match the Error interface. If not, it creates a new Error
object with the value as the message.

[1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#using-unknown-in-catch-variables
2021-08-30 13:06:01 -05:00
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 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 0c20e52a45 don't allow optional args in actions
This can lead to subtle bugs.

Fixes firmware flash button not working.
2021-02-01 10:26:05 -06:00
David Lechner 6f204a65f6 reorganize src/ directory
Makes for much less scrolling/jumping around.

https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00