Skip to content

Commit ed4ae06

Browse files
committed
Proper clean-up if serial download fail
1 parent 29d2ec8 commit ed4ae06

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

public/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<script src="js/ble.js?v=b435283f"></script>
106106
<script src="js/mqtt.js?v=199a15fa"></script>
107107
<script src="js/PythonSerial.js?v=bfae6bc5"></script>
108-
<script src="js/serial.js?v=3e7e1e21"></script>
108+
<script src="js/serial.js?v=31353e71"></script>
109109
<script src="js/extensions.js?v=0bf6809e"></script>
110110

111111
<script src="js/main.js?v=8c39fb9d"></script>

public/js/serial.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ var serial = new function() {
302302
self.writeEnable = false;
303303
if (await self.pythonSerial.enterRawMode() != 'success') {
304304
await self.pythonSerial.exitRawMode(500);
305+
self.pythonSerial.setReadToHandler();
305306
$downloadWindow.$body.text('Connection timed out. Press the reset button on your device and try again.');
306307
$downloadWindow.$buttonsRow.removeClass('hide');
307308
return;
@@ -317,6 +318,8 @@ var serial = new function() {
317318
let fileBuf = e.encode(filesManager.files[filename]);
318319
let result = await self.pythonSerial.copyFileToDevice(filename, fileBuf);
319320
if (result != 'success') {
321+
await self.pythonSerial.exitRawMode();
322+
self.pythonSerial.setReadToHandler();
320323
$downloadWindow.$body.text('Error downloading files');
321324
$downloadWindow.$buttonsRow.removeClass('hide');
322325
return;

0 commit comments

Comments
 (0)