Skip to content

Commit 58b8829

Browse files
microbit-sammicrobit-carlos
authored andcommitted
WebUSB: Disconnect, connect, reset REPL (#284)
1 parent 0d456e1 commit 58b8829

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python-main.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,11 @@ function web_editor(config) {
14551455

14561456
p.finally(function() {
14571457
console.log('Disconnection Complete');
1458+
document.dispatchEvent(new CustomEvent('webusb', { 'detail': {
1459+
'flash-type': 'webusb',
1460+
'event-type': 'info',
1461+
'message': 'disconnected'
1462+
}}));
14581463
});
14591464

14601465
return p;
@@ -1492,10 +1497,12 @@ function web_editor(config) {
14921497
$("#flashing-overlay-container").css("display", "flex");
14931498

14941499
if (usePartialFlashing) {
1495-
// Push binary to board
1496-
p = doDisconnect()
1500+
REPL = null;
1501+
$("#repl").empty();
1502+
1503+
p = window.dapwrapper.disconnectAsync()
14971504
.then(function() {
1498-
return doConnect();
1505+
return PartialFlashing.connectDapAsync();
14991506
})
15001507
.then(function() {
15011508
var output = generateFullHex("bytes");

0 commit comments

Comments
 (0)