mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
+11
-1
@@ -4,6 +4,15 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.0.1] - 2022-12-21
|
||||
|
||||
### Fixed
|
||||
- Fixed terminal scroll not working ([support#866]).
|
||||
- Fixed terminal breaks if input is given before hub is connected ([support#865]).
|
||||
|
||||
[support#865]: https://github.com/pybricks/support/issues/865
|
||||
[support#866]: https://github.com/pybricks/support/issues/866
|
||||
|
||||
## [2.0.0] - 2022-12-20
|
||||
|
||||
### Added
|
||||
@@ -620,7 +629,8 @@ Prerelease changes are documented at [support#48].
|
||||
|
||||
<!-- links for version headings -->
|
||||
|
||||
[Unreleased]: https://github.com/pybricks/pybricks-code/compare/v2.0.0...HEAD
|
||||
[Unreleased]: https://github.com/pybricks/pybricks-code/compare/v2.0.1...HEAD
|
||||
[2.0.1]: https://github.com/pybricks/pybricks-code/compare/v2.0.0...v2.0.1
|
||||
[2.0.0]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-rc.1...v2.0.0
|
||||
[2.0.0-rc.1]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.12...v2.0.0-rc.1
|
||||
[2.0.0-beta.12]: https://github.com/pybricks/pybricks-code/compare/v2.0.0-beta.11...v2.0.0-beta.12
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/pybricks-code",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
"author": "The Pybricks Authors",
|
||||
"repository": {
|
||||
@@ -123,7 +123,7 @@
|
||||
"webpack-dev-server": "^4.11.1",
|
||||
"webpack-manifest-plugin": "^5.0.0",
|
||||
"workbox-webpack-plugin": "^6.5.4",
|
||||
"xterm": "^5.1.0",
|
||||
"xterm": "5.0.0",
|
||||
"xterm-addon-fit": "^0.6.0",
|
||||
"zen-push": "^0.3.1"
|
||||
},
|
||||
|
||||
@@ -71,6 +71,7 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
|
||||
test('basic function works', async () => {
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Running } });
|
||||
|
||||
saga.put(receiveData('test1234'));
|
||||
|
||||
@@ -82,6 +83,7 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
|
||||
test('messages are queued until previous has completed', async () => {
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Running } });
|
||||
|
||||
saga.put(receiveData('test1234'));
|
||||
await delay(50); // without delay, messages are combined
|
||||
@@ -108,6 +110,7 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
|
||||
test('messages are queued until previous has failed', async () => {
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Running } });
|
||||
|
||||
saga.put(receiveData('test1234'));
|
||||
await delay(50); // without delay, messages are combined
|
||||
@@ -134,6 +137,7 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
|
||||
test('small messages are combined', async () => {
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Running } });
|
||||
|
||||
saga.put(receiveData('test1234'));
|
||||
saga.put(receiveData('test1234'));
|
||||
@@ -148,6 +152,7 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
const testData = '012345678901234567890123456789';
|
||||
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Running } });
|
||||
|
||||
saga.put(receiveData(testData));
|
||||
|
||||
@@ -163,4 +168,14 @@ describe('Terminal data source responds to receive data actions', () => {
|
||||
|
||||
await saga.end();
|
||||
});
|
||||
|
||||
test('if user program is not running, do not dispatch write', async () => {
|
||||
const saga = new AsyncSaga(terminal, { nextMessageId: createCountFunc() });
|
||||
saga.updateState({ hub: { runtime: HubRuntimeState.Disconnected } });
|
||||
|
||||
saga.put(receiveData('test1234'));
|
||||
|
||||
// line below will fail with unhandled pending dispatches if not working correctly
|
||||
await saga.end();
|
||||
});
|
||||
});
|
||||
|
||||
+15
-2
@@ -49,8 +49,10 @@ function* receiveUartData(action: ReturnType<typeof didNotify>): Generator {
|
||||
}
|
||||
|
||||
function* receiveTerminalData(): Generator {
|
||||
const nextMessageId = yield* getContext<() => number>('nextMessageId');
|
||||
const channel = yield* actionChannel(receiveData);
|
||||
while (true) {
|
||||
|
||||
for (;;) {
|
||||
// wait for input from terminal
|
||||
const action = yield* take(channel);
|
||||
let value = action.value;
|
||||
@@ -68,10 +70,21 @@ function* receiveTerminalData(): Generator {
|
||||
value += action.value;
|
||||
}
|
||||
|
||||
const nextMessageId = yield* getContext<() => number>('nextMessageId');
|
||||
const isUserProgramRunning = yield* select(
|
||||
(s: RootState) => s.hub.runtime === HubRuntimeState.Running,
|
||||
);
|
||||
|
||||
// REVISIT: this test is a bit dangerous since it is not actually
|
||||
// testing that handleWriteUart in ble/sagas is running. In theory
|
||||
// it should be fine as long a the logic for the state doesn't change.
|
||||
if (!isUserProgramRunning) {
|
||||
// if no user program is running, input goes to /dev/null
|
||||
continue;
|
||||
}
|
||||
|
||||
// stdin gets piped to BLE connection
|
||||
const data = encoder.encode(value);
|
||||
|
||||
for (let i = 0; i < data.length; i += nordicUartSafeTxCharLength) {
|
||||
const { id } = yield* put(
|
||||
write(nextMessageId(), data.slice(i, i + nordicUartSafeTxCharLength)),
|
||||
|
||||
@@ -2535,7 +2535,7 @@ __metadata:
|
||||
webpack-dev-server: ^4.11.1
|
||||
webpack-manifest-plugin: ^5.0.0
|
||||
workbox-webpack-plugin: ^6.5.4
|
||||
xterm: ^5.1.0
|
||||
xterm: 5.0.0
|
||||
xterm-addon-fit: ^0.6.0
|
||||
zen-push: ^0.3.1
|
||||
languageName: unknown
|
||||
@@ -15902,10 +15902,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"xterm@npm:^5.1.0":
|
||||
version: 5.1.0
|
||||
resolution: "xterm@npm:5.1.0"
|
||||
checksum: cbacbc9dc1bbcf21dabecff46856b43f2d5854b42c1bec4ea03a5720000f2a88d79b0da45b6c38213d6607474a1fbe66d5ff25fa120b7e9e60eeed964dd840a1
|
||||
"xterm@npm:5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "xterm@npm:5.0.0"
|
||||
checksum: c2f1d02a708d3d02bebf052dfdf54ecd1b619386bed8f27ed42483d398a3e0bc3595fc855c600db99fd3a91f6d3e8feabe118f1f8f14bbed92d8b3d77277ab92
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user