From 1279370fc821fd68ac9a2244f1d63d431ef398a6 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 17 May 2021 12:43:05 -0500 Subject: [PATCH 1/4] 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 --- src/firmware/FlashButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firmware/FlashButton.tsx b/src/firmware/FlashButton.tsx index c8d5d4b0..79f5b5a7 100644 --- a/src/firmware/FlashButton.tsx +++ b/src/firmware/FlashButton.tsx @@ -2,7 +2,7 @@ // Copyright (c) 2020-2021 The Pybricks Authors import { connect } from 'react-redux'; -import { HubRuntimeState } from '../hub/reducers'; +import { BleConnectionState } from '../ble/reducers'; import { BootloaderConnectionState } from '../lwp3-bootloader/reducers'; import * as notification from '../notifications/actions'; import { RootState } from '../reducers'; @@ -22,7 +22,7 @@ const mapStateToProps = (state: RootState): StateProps => ({ tooltip: state.firmware.flashing ? TooltipId.FlashProgress : TooltipId.Flash, enabled: state.bootloader.connection === BootloaderConnectionState.Disconnected && - state.hub.runtime === HubRuntimeState.Disconnected, + state.ble.connection === BleConnectionState.Disconnected, showProgress: state.firmware.flashing, progress: state.firmware.progress === null ? undefined : state.firmware.progress, }); From 12f3f40e3695e9032bc0275a2460e8af88c54239 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 17 May 2021 13:01:10 -0500 Subject: [PATCH 2/4] 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 --- src/hub/BluetoothButton.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hub/BluetoothButton.tsx b/src/hub/BluetoothButton.tsx index 2f301f37..572bd5fa 100644 --- a/src/hub/BluetoothButton.tsx +++ b/src/hub/BluetoothButton.tsx @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// Copyright (c) 2020 The Pybricks Authors +// Copyright (c) 2020-2021 The Pybricks Authors import { connect } from 'react-redux'; import { toggleBluetooth } from '../ble/actions'; @@ -11,7 +11,10 @@ import { TooltipId } from '../toolbar/i18n'; import btConnectedIcon from './bt-connected.svg'; import btDisconnectedIcon from './bt-disconnected.svg'; -type StateProps = Pick; +type StateProps = Pick< + ActionButtonProps, + 'tooltip' | 'icon' | 'enabled' | 'showProgress' +>; type DispatchProps = Pick; const mapStateToProps = (state: RootState): StateProps => { @@ -29,6 +32,7 @@ const mapStateToProps = (state: RootState): StateProps => { tooltip: TooltipId.BluetoothDisconnect, icon: btConnectedIcon, enabled: state.ble.connection === BleConnectionState.Connected, + showProgress: state.ble.connection === BleConnectionState.Connecting, }; } }; From deee6578f72f8c2d9618c8b845d799bea5aba358 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 17 May 2021 13:24:57 -0500 Subject: [PATCH 3/4] improved bluetooth adapter error message Issue: https://github.com/pybricks/support/issues/338 --- src/notifications/i18n.en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notifications/i18n.en.json b/src/notifications/i18n.en.json index d20fb9f5..0ed65d37 100644 --- a/src/notifications/i18n.en.json +++ b/src/notifications/i18n.en.json @@ -8,7 +8,7 @@ "gattPermission": "The web browser did not give permission to use Bluetooth Low Energy", "gattServiceNotFound": "Connected to hub but failed to get {serviceName} service.\nEnsure that you are using the most recent firmware.\nIf the problem persists, try removing the \"{hubName}\" device in your OS Bluetooth settings, then try connecting again.", "noWebBluetooth": "This web browser does not support Web Bluetooth or it is not enabled.", - "noBluetooth": "No Bluetooth adapter could be found. Bluetooth won't work.", + "noBluetooth": "No Bluetooth adapter could be found. Please connect or enable a Bluetooth Low Energy adapter and restart the browser.", "unexpectedError": "Unexpected error while trying to connect: {errorMessage}" }, "editor": { From a47dbc10b2c9794bf1e5db8fd58d4249f5beba93 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 17 May 2021 14:16:16 -0500 Subject: [PATCH 4/4] v1.0.0-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bdbffe7f..293fa25b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pybricks/pybricks-code", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "license": "MIT", "author": "The Pybricks Authors", "repository": {