Skip to content

Commit f8dd39e

Browse files
WebUSB: Focus the serial termianl when REPL button is pressed. (#314)
This saves the user having to then click on the terminal panel.
1 parent 3b27fe8 commit f8dd39e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

python-main.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,10 +1813,19 @@ function web_editor(config) {
18131813
});
18141814
$("#command-disconnect").click(function () {
18151815
doDisconnect();
1816-
});
1816+
});
18171817
$("#command-serial").click(function () {
18181818
doSerial();
1819-
});
1819+
});
1820+
$("#request-repl").click(function () {
1821+
var daplink = usePartialFlashing && window.dapwrapper ? window.dapwrapper.daplink : window.daplink;
1822+
daplink.serialWrite('\x03');
1823+
REPL.focus();
1824+
});
1825+
$("#request-serial").click(function () {
1826+
var daplink = usePartialFlashing && window.dapwrapper ? window.dapwrapper.daplink : window.daplink;
1827+
daplink.serialWrite('\x04');
1828+
});
18201829
} else {
18211830
var WebUSBUnavailable = function() {
18221831
var links = {};
@@ -1833,14 +1842,6 @@ function web_editor(config) {
18331842
e.stopPropagation();
18341843
});
18351844
}
1836-
$("#request-repl").click(function () {
1837-
var daplink = usePartialFlashing && window.dapwrapper ? window.dapwrapper.daplink : window.daplink;
1838-
daplink.serialWrite("\x03");
1839-
});
1840-
$("#request-serial").click(function () {
1841-
var daplink = usePartialFlashing && window.dapwrapper ? window.dapwrapper.daplink : window.daplink;
1842-
daplink.serialWrite("\x04");
1843-
});
18441845
$("#command-options").click(function (e) {
18451846
// Hide any other open menus and show/hide options menu
18461847
$('#helpsupport_container').addClass('hidden');

0 commit comments

Comments
 (0)