mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
@@ -4,14 +4,16 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- 'v1.*'
|
||||
- '!v1.*-beta.*'
|
||||
- '!v1.*-rc.*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set env to beta
|
||||
if: contains(github.ref, '-beta.') || contains(github.ref, '-rc.')
|
||||
run: |
|
||||
echo "REACT_APP_NAME=Pybricks Code (Beta)" >> $GITHUB_ENV
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
@@ -23,17 +25,14 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build
|
||||
if: ${{ success() }}
|
||||
run: yarn build
|
||||
- name: Install lftp
|
||||
if: ${{ success() }}
|
||||
run: sudo apt-get update && sudo apt-get install --yes lftp
|
||||
- name: Publish
|
||||
if: ${{ success() }}
|
||||
shell: bash
|
||||
env:
|
||||
LFTP_USER: ${{ secrets.lftpUser }}
|
||||
LFTP_PASSWORD: ${{ secrets.lftpPassword }}
|
||||
LFTP_SITE: ${{ secrets.lftpSite }}
|
||||
run: |
|
||||
lftp -e "open --user $LFTP_USER --env-password $LFTP_SITE && mirror --verbose --reverse --delete --exclude=.htaccess --exclude=.well-known build code; exit"
|
||||
lftp -e "open --user $LFTP_USER --env-password $LFTP_SITE && mirror --verbose --reverse --delete --exclude=.htaccess --exclude=.well-known build beta; exit"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
### Changed
|
||||
- Updated projects URL.
|
||||
- Updated hub firmware to [v3.1.0a1].
|
||||
- Updated docs.
|
||||
|
||||
## [1.0.0] - 2021-06-08
|
||||
|
||||
@@ -24,6 +26,7 @@ Prerelease changes are documented at [support#48].
|
||||
<!-- let's try to keep this list sorted -->
|
||||
[support#48]: https://github.com/pybricks/support/issues/48
|
||||
[v3.0.0]: https://github.com/pybricks/pybricks-micropython/blob/master/CHANGELOG.md#300---2021-06-08
|
||||
[v3.1.0a1]: https://github.com/pybricks/pybricks-micropython/blob/master/CHANGELOG.md#310a1---2021-06-23
|
||||
|
||||
[Unreleased]: https://github.com/pybricks/pybricks-code/compare/v1.0.0...HEAD
|
||||
[1.0.0]: https://github.com/pybricks/pybricks-code/compare/v1.0.0-rc.2...v1.0.0
|
||||
|
||||
+17
-1
@@ -188,6 +188,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`,
|
||||
module.exports = {
|
||||
webpack: {
|
||||
plugins: [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: 'public/manifest.json',
|
||||
transform(content, path) {
|
||||
return content
|
||||
.toString()
|
||||
.replace(
|
||||
/%\w+%/g,
|
||||
(m) => process.env[m.slice(1, m.length - 1)],
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
@@ -248,7 +263,8 @@ module.exports = {
|
||||
webpackConfig,
|
||||
loaderByName('babel-loader'),
|
||||
);
|
||||
babelLoaders.matches[0].loader.test = /\.(esnext|js|mjs|jsx|ts|tsx)$/;
|
||||
babelLoaders.matches[0].loader.test =
|
||||
/\.(esnext|js|mjs|jsx|ts|tsx)$/;
|
||||
babelLoaders.matches[1].loader.test = /\.(esnext|js|mjs)$/;
|
||||
|
||||
const fileLoader = getLoader(
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/pybricks-code",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0-beta.1",
|
||||
"license": "MIT",
|
||||
"author": "The Pybricks Authors",
|
||||
"repository": {
|
||||
@@ -10,8 +10,8 @@
|
||||
"dependencies": {
|
||||
"@blueprintjs/core": "^3.41.0",
|
||||
"@craco/craco": "^6.1.1",
|
||||
"@pybricks/firmware": "4.12.0",
|
||||
"@pybricks/ide-docs": "1.3.3",
|
||||
"@pybricks/firmware": "4.13.0-alpha.1",
|
||||
"@pybricks/ide-docs": "1.4.0",
|
||||
"@pybricks/mpy-cross-v5": "^2.0.0",
|
||||
"@shopify/react-i18n": "^5.3.0",
|
||||
"@testing-library/dom": "^7.30.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"short_name": "Pybricks Code",
|
||||
"name": "Pybricks Code",
|
||||
"short_name": "%REACT_APP_NAME%",
|
||||
"name": "%REACT_APP_NAME%",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
|
||||
@@ -13,3 +13,40 @@ export const firmwareRevisionStringUUID = 0x2a26;
|
||||
|
||||
/** Software Revision String characteristic UUID. */
|
||||
export const softwareRevisionStringUUID = 0x2a28;
|
||||
|
||||
/** PnP ID characteristic UUID. */
|
||||
export const pnpIdUUID = 0x2a50;
|
||||
|
||||
/**
|
||||
* Parameters for the PnP ID characteristic vendor ID source field.
|
||||
*/
|
||||
export enum PnpIdVendorIdSource {
|
||||
/** The vendor ID was assigned by the Bluetooth SIG. */
|
||||
BluetoothSig = 1,
|
||||
/** The vendor and product IDs were assigned by the USB implementors forum. */
|
||||
UsbImpForum = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoded data from the PnP ID characteristic.
|
||||
*/
|
||||
export type PnpId = {
|
||||
vendorIdSource: PnpIdVendorIdSource;
|
||||
vendorId: number;
|
||||
productId: number;
|
||||
productVersion: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes data read from the PnP ID characteristics.
|
||||
* @param data The data read from the characteristic.
|
||||
* @returns The decoded data.
|
||||
*/
|
||||
export function decodePnpId(data: DataView): PnpId {
|
||||
return {
|
||||
vendorIdSource: data.getUint8(0),
|
||||
vendorId: data.getUint16(1, true),
|
||||
productId: data.getUint16(3, true),
|
||||
productVersion: data.getUint16(5, true),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@ import {
|
||||
takeMaybe,
|
||||
} from 'typed-redux-saga/macro';
|
||||
import {
|
||||
PnpId,
|
||||
decodePnpId,
|
||||
serviceUUID as deviceInfoServiceUUID,
|
||||
firmwareRevisionStringUUID,
|
||||
pnpIdUUID,
|
||||
softwareRevisionStringUUID,
|
||||
} from '../ble-device-info-service/protocol';
|
||||
import {
|
||||
@@ -45,6 +48,7 @@ import {
|
||||
} from '../ble/actions';
|
||||
import { BleConnectionState } from '../ble/reducers';
|
||||
import { RootState } from '../reducers';
|
||||
import { hex } from '../utils';
|
||||
import {
|
||||
BleUartActionType,
|
||||
BleUartWriteAction,
|
||||
@@ -229,6 +233,34 @@ function* connect(_action: BleDeviceConnectAction): Generator {
|
||||
// TODO: verify that minimum protocol version is met
|
||||
console.log(`Pybricks protocol version: ${protocolVersion}`);
|
||||
|
||||
let pnpIdChar: BluetoothRemoteGATTCharacteristic | undefined = undefined;
|
||||
try {
|
||||
pnpIdChar = yield* call([deviceInfoService, 'getCharacteristic'], pnpIdUUID);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
'PnP ID characteristic requires Pybricks firmware v3.1.0a1 or later',
|
||||
);
|
||||
}
|
||||
|
||||
if (pnpIdChar) {
|
||||
let pnpId: PnpId;
|
||||
try {
|
||||
pnpId = decodePnpId(yield* call([pnpIdChar, 'readValue']));
|
||||
} catch (err) {
|
||||
server.disconnect();
|
||||
yield* takeMaybe(disconnectChannel);
|
||||
yield* put(didFailToConnect({ reason: Reason.Unknown, err }));
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Vendor: ${hex(pnpId.vendorId, 4)}, Product: ${hex(
|
||||
pnpId.productId,
|
||||
4,
|
||||
)}, Version: ${hex(pnpId.productVersion, 4)}`,
|
||||
);
|
||||
}
|
||||
|
||||
let pybricksService: BluetoothRemoteGATTService;
|
||||
try {
|
||||
pybricksService = yield* call(
|
||||
|
||||
Reference in New Issue
Block a user