Skip to content

Commit

Permalink
Merge mb 7.0.25
Browse files Browse the repository at this point in the history
  • Loading branch information
Amerlander committed Aug 25, 2024
1 parent 5a3fd9f commit 912d999
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions editor/flash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,7 @@ class DAPWrapper implements pxt.packetio.PacketIOWrapper {

await this.io.reconnectAsync()

// before calling into dapjs, push through a few commands to make sure the responses
// to commands from previous sessions (if any) are flushed. Count of 5 is arbitrary.
for (let i = 0; i < 5; i++) {
try {
await this.getDaplinkVersionAsync();
} catch (e) {}
}
await this.clearCommandsAsync()

// halt before reading from dap
// to avoid interference from data logger
Expand Down Expand Up @@ -356,6 +350,16 @@ class DAPWrapper implements pxt.packetio.PacketIOWrapper {
this.startReadSerial(connectionId)
}

private async clearCommandsAsync() {
// before calling into dapjs, push through a few commands to make sure the responses
// to commands from previous sessions (if any) are flushed. Count of 5 is arbitrary.
for (let i = 0; i < 5; i++) {
try {
await this.getDaplinkVersionAsync();
} catch (e) {}
}
}

private async getDaplinkVersionAsync() {
return await this.dapCmdNums(0x00, 0x04);
}
Expand Down Expand Up @@ -403,6 +407,7 @@ class DAPWrapper implements pxt.packetio.PacketIOWrapper {
await this.io.reconnectAsync();
}

await this.clearCommandsAsync()
await this.stopReadersAsync();
await this.cortexM.init();
await this.cortexM.reset(true);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
},
"dependencies": {
"pxt-common-packages": "12.0.3",
"pxt-core": "10.2.13"
"pxt-core": "10.2.15"
}
}

0 comments on commit 912d999

Please sign in to comment.