Skip to content

Commit 6e7462a

Browse files
authored
Merge pull request #1244 from pybricks/dlech
v2.0.0-beta.6
2 parents 49cc0e2 + fcffef3 commit 6e7462a

File tree

11 files changed

+107
-24
lines changed

11 files changed

+107
-24
lines changed

CHANGELOG.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,58 @@
44

55
## [Unreleased]
66

7+
## [2.0.0-beta.6] - 2022-10-21
8+
79
### Added
810
- Added feature to install custom firmware from file ([pybricks-code#1020]).
11+
- Added support for multi-file programs ([support#189]).
12+
13+
### Changed
14+
- Updated dependencies.
15+
- Updated documentation.
16+
- Updated APIs for code completions.
17+
- Update hub firmware to v3.2.0b4:
18+
19+
### Added
20+
- Added hub shutdown status light indication.
21+
- Added boot and shutdown light matrix animations.
22+
- Added new indication for over-charging battery (blinking green light).
23+
- Added iterator protocol support to `geometry.Matrix` class.
24+
- Added support for multi-file projects ([pybricks-micropython#115]).
25+
- Added new `System.storage()` API ([support#85]).
26+
27+
### Changed
28+
- Battery full indication (green light) comes on earlier ([support#647]).
29+
- User program is saved to non-volatile memory at shutdown on all hubs.
30+
- Restored the `Motor.speed()` method and `DriveBase` equivalent to provide
31+
speed as a numerical derivative of the motor position.
32+
- Starting REPL automatically imports all modules ([support#741]).
33+
- Updated Bluetooth to [Pybricks Profile v1.2.0][pp1.2.0].
34+
- Bluetooth now uses random private address instead of static public address
35+
([support#600]).
36+
37+
### Fixed
38+
- Fixed motors going out of sync when starting program ([support#679]).
39+
- Fixed motor torque signal overflowing under load ([support#729]).
40+
- Fixed city hub turning back on after shutdown ([support#692]).
41+
- Fixed IMU I2C bus lockup on SPIKE hubs ([support#232]).
42+
- Fixed REPL history corrupt after soft reset ([support#699]).
43+
- Fixed "ValueError: incompatible .mpy file" when pressing the button when
44+
there is no program yet ([support#599]).
45+
46+
[pp1.2.0]: https://github.com/pybricks/technical-info/blob/master/pybricks-ble-profile.md#profile-v120
47+
[pybricks-micropython#115]: https://github.com/pybricks/pybricks-micropython/pull/115
48+
[support#85]: https://github.com/pybricks/support/issues/85
49+
[support#232]: https://github.com/pybricks/support/issues/232
50+
[support#599]: https://github.com/pybricks/support/issues/599
51+
[support#600]: https://github.com/pybricks/support/issues/600
52+
[support#647]: https://github.com/pybricks/support/issues/647
53+
[support#679]: https://github.com/pybricks/support/issues/679
54+
[support#692]: https://github.com/pybricks/support/issues/692
55+
[support#699]: https://github.com/pybricks/support/issues/699
56+
[support#729]: https://github.com/pybricks/support/issues/729
57+
[support#741]: https://github.com/pybricks/support/issues/741
58+
959

1060
### Fixed
1161
- Fixed run button enabled when no file open ([support#691]).
@@ -16,10 +66,12 @@
1666

1767
### Removed
1868
- Removed feature to include custom `main.py` when flashing firmware.
69+
- Removed support for file names containing `-`.
1970

2071
[pybricks-code#938]: https://github.com/pybricks/pybricks-code/issues/938
2172
[pybricks-code#1011]: https://github.com/pybricks/pybricks-code/issues/1011
2273
[pybricks-code#1020]: https://github.com/pybricks/pybricks-code/issues/1020
74+
[support#189]: https://github.com/pybricks/support/issues/189
2375
[support#691]: https://github.com/pybricks/support/issues/691
2476
[support#694]: https://github.com/pybricks/support/issues/694
2577
[support#717]: https://github.com/pybricks/support/issues/717
@@ -371,7 +423,8 @@ Prerelease changes are documented at [support#48].
371423

372424
<!-- links for version headings -->
373425

374-
[Unreleased]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.5...HEAD
426+
[Unreleased]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.6...HEAD
427+
[2.0.0-beta.6]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.5...v2.0.0-beta.6
375428
[2.0.0-beta.5]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.4...v2.0.0-beta.5
376429
[2.0.0-beta.4]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.3...v2.0.0-beta.4
377430
[2.0.0-beta.3]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.2...v2.0.0-beta.3

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pybricks/pybricks-code",
3-
"version": "2.0.0-beta.5",
3+
"version": "2.0.0-beta.6",
44
"license": "MIT",
55
"author": "The Pybricks Authors",
66
"repository": {

src/alerts/UnexpectedErrorAlert.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,25 @@ const UnexpectedErrorAlert: React.VoidFunctionComponent<UnexpectedErrorAlertProp
2828

2929
return (
3030
<>
31-
<p>{i18n.translate('message', { errorMessage: error.message })}</p>
32-
<span>
33-
<Button
34-
aria-labelledby={labelId}
35-
minimal={true}
36-
small={true}
37-
icon={isExpanded ? 'chevron-down' : 'chevron-right'}
38-
onClick={() => setIsExpanded((v) => !v)}
39-
/>
40-
<span id={labelId}>{i18n.translate('technicalInfo')}</span>
41-
</span>
42-
<Collapse isOpen={isExpanded}>
43-
<Pre className="pb-alerts-stack-trace">{error.stack}</Pre>
44-
</Collapse>
31+
<p>{i18n.translate('message')}</p>
32+
<p>{error.message}</p>
33+
{error.stack && (
34+
<>
35+
<span>
36+
<Button
37+
aria-labelledby={labelId}
38+
minimal={true}
39+
small={true}
40+
icon={isExpanded ? 'chevron-down' : 'chevron-right'}
41+
onClick={() => setIsExpanded((v) => !v)}
42+
/>
43+
<span id={labelId}>{i18n.translate('technicalInfo')}</span>
44+
</span>
45+
<Collapse isOpen={isExpanded}>
46+
<Pre className="pb-alerts-stack-trace">{error.stack}</Pre>
47+
</Collapse>
48+
</>
49+
)}
4550
<div>
4651
<ButtonGroup minimal={true} fill={true}>
4752
<Button

src/alerts/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ import { AlertActions, AlertDomain, AlertProps, AlertSpecific } from '../alerts'
1111
* @param specific The specific alert for the domain.
1212
* @param props Any additional properties required by this specific alert.
1313
* @param key Optional key to use as unique identifier for toast instead `<domain>.<specific>.<props>`.
14+
* @param update Optional boolean flag to update existing alert instead of replacing it.
1415
*/
1516
export const alertsShowAlert = createAction(
1617
<D extends AlertDomain, S extends AlertSpecific<D>>(
1718
domain: D,
1819
specific: S,
1920
...args: AlertProps<D, S> extends never
20-
? [props?: never]
21-
: [props: AlertProps<D, S>, key?: string]
21+
? [args?: never]
22+
: [props: AlertProps<D, S>, key?: string, update?: boolean]
2223
) => ({
2324
type: 'alerts.action.showAlert',
2425
domain,
2526
specific,
2627
// HACK: using varargs to allow props and key to be optional
2728
props: args.at(0),
2829
key: args.at(1),
30+
update: args.at(2),
2931
}),
3032
);
3133

src/alerts/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function* handleShowAlert(action: ReturnType<typeof alertsShowAlert>): Generator
2323

2424
// if a toast with the same parameters is already open, close it so we
2525
// can open it again without duplicates.
26-
if (existing.length > 0) {
26+
if (!action.update && existing.length > 0) {
2727
toaster.dismiss(key);
2828
yield* delay(500);
2929
}

src/ble/sagas.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ async function runConnectUntil(saga: AsyncSaga, point: ConnectRunPoint): Promise
235235
}
236236

237237
await expect(saga.take()).resolves.toEqual(
238-
blePybricksServiceDidNotReceiveHubCapabilities(pnpId, '3.2.0b4'),
238+
blePybricksServiceDidNotReceiveHubCapabilities(pnpId, '3.2.0b2'),
239239
);
240240

241241
if (point === ConnectRunPoint.DidNotReceiveHubCapabilities) {

src/ble/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function* handleBleConnectPybricks(): Generator {
363363
);
364364
} else {
365365
yield* put(
366-
blePybricksServiceDidNotReceiveHubCapabilities(pnpId, firmwareVersion),
366+
blePybricksServiceDidNotReceiveHubCapabilities(pnpId, firmwareRevision),
367367
);
368368
}
369369

src/firmware/sagas.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ describe('flashFirmware', () => {
140140
'flashProgress',
141141
{ action: 'erase', progress: undefined },
142142
'firmware.ble.progress',
143+
true,
143144
),
144145
);
145146

@@ -187,6 +188,7 @@ describe('flashFirmware', () => {
187188
progress: offset / totalFirmwareSize,
188189
},
189190
'firmware.ble.progress',
191+
true,
190192
),
191193
);
192194

@@ -224,6 +226,7 @@ describe('flashFirmware', () => {
224226
progress: 1,
225227
},
226228
'firmware.ble.progress',
229+
true,
227230
),
228231
);
229232

@@ -303,6 +306,7 @@ describe('flashFirmware', () => {
303306
'flashProgress',
304307
{ action: 'erase', progress: undefined },
305308
'firmware.ble.progress',
309+
true,
306310
),
307311
);
308312

@@ -350,6 +354,7 @@ describe('flashFirmware', () => {
350354
progress: offset / totalFirmwareSize,
351355
},
352356
'firmware.ble.progress',
357+
true,
353358
),
354359
);
355360

@@ -387,6 +392,7 @@ describe('flashFirmware', () => {
387392
progress: 1,
388393
},
389394
'firmware.ble.progress',
395+
true,
390396
),
391397
);
392398

@@ -1030,6 +1036,7 @@ describe('flashFirmware', () => {
10301036
'flashProgress',
10311037
{ action: 'erase', progress: undefined },
10321038
'firmware.ble.progress',
1039+
true,
10331040
),
10341041
);
10351042

@@ -1142,6 +1149,7 @@ describe('flashFirmware', () => {
11421149
'flashProgress',
11431150
{ action: 'erase', progress: undefined },
11441151
'firmware.ble.progress',
1152+
true,
11451153
),
11461154
);
11471155

@@ -1263,6 +1271,7 @@ describe('flashFirmware', () => {
12631271
'flashProgress',
12641272
{ action: 'erase', progress: undefined },
12651273
'firmware.ble.progress',
1274+
true,
12661275
),
12671276
);
12681277

@@ -1310,6 +1319,7 @@ describe('flashFirmware', () => {
13101319
progress: offset / totalFirmwareSize,
13111320
},
13121321
'firmware.ble.progress',
1322+
true,
13131323
),
13141324
);
13151325

@@ -1437,6 +1447,7 @@ describe('flashFirmware', () => {
14371447
'flashProgress',
14381448
{ action: 'erase', progress: undefined },
14391449
'firmware.ble.progress',
1450+
true,
14401451
),
14411452
);
14421453

@@ -1484,6 +1495,7 @@ describe('flashFirmware', () => {
14841495
progress: offset / totalFirmwareSize,
14851496
},
14861497
'firmware.ble.progress',
1498+
true,
14871499
),
14881500
);
14891501

@@ -1616,6 +1628,7 @@ describe('flashFirmware', () => {
16161628
'flashProgress',
16171629
{ action: 'erase', progress: undefined },
16181630
'firmware.ble.progress',
1631+
true,
16191632
),
16201633
);
16211634

@@ -1664,6 +1677,7 @@ describe('flashFirmware', () => {
16641677
progress: offset / totalFirmwareSize,
16651678
},
16661679
'firmware.ble.progress',
1680+
true,
16671681
),
16681682
);
16691683

@@ -1701,6 +1715,7 @@ describe('flashFirmware', () => {
17011715
progress: 1,
17021716
},
17031717
'firmware.ble.progress',
1718+
true,
17041719
),
17051720
);
17061721

@@ -2181,6 +2196,7 @@ describe('flashFirmware', () => {
21812196
'flashProgress',
21822197
{ action: 'erase', progress: undefined },
21832198
'firmware.ble.progress',
2199+
true,
21842200
),
21852201
);
21862202

@@ -2227,6 +2243,7 @@ describe('flashFirmware', () => {
22272243
progress: offset / totalFirmwareSize,
22282244
},
22292245
'firmware.ble.progress',
2246+
true,
22302247
),
22312248
);
22322249

@@ -2263,6 +2280,7 @@ describe('flashFirmware', () => {
22632280
progress: 1,
22642281
},
22652282
'firmware.ble.progress',
2283+
true,
22662284
),
22672285
);
22682286

src/firmware/sagas.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
443443
progress: undefined,
444444
},
445445
firmwareBleProgressToastId,
446+
true,
446447
),
447448
);
448449

@@ -508,6 +509,7 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
508509
progress: offset / firmware.length,
509510
},
510511
firmwareBleProgressToastId,
512+
true,
511513
),
512514
);
513515

@@ -593,6 +595,7 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
593595
progress: 1,
594596
},
595597
firmwareBleProgressToastId,
598+
true,
596599
),
597600
);
598601

@@ -632,6 +635,7 @@ function* handleDfuEraseProcess(event: {
632635
progress: event.bytesSent / event.expectedSize,
633636
},
634637
firmwareDfuProgressToastId,
638+
true,
635639
),
636640
);
637641
}
@@ -649,6 +653,7 @@ function* handleDfuWriteProcess(event: {
649653
progress: event.bytesSent / event.expectedSize,
650654
},
651655
firmwareDfuProgressToastId,
656+
true,
652657
),
653658
);
654659
}

src/toolbar/buttons/repl/ReplButton.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ afterEach(() => {
1414

1515
it('should dispatch action when clicked', async () => {
1616
const [user, button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
17-
hub: { runtime: HubRuntimeState.Idle },
17+
hub: { hasRepl: true, runtime: HubRuntimeState.Idle },
1818
});
1919

2020
await user.click(button.getByRole('button', { name: 'REPL' }));

0 commit comments

Comments
 (0)