diff --git a/package.json b/package.json index a1a36d0f..3cad70bd 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "Leaphy Webbased", "author": "Leaphy Robotics", "description": "Build Leaphy Arduino programs", - "version": "2.0.3", + "version": "2.0.4", "license": "GPLv3", "main": "src/main.ts", "scripts": { diff --git a/src/app/services/arduino-uploader/ArduinoUploader.ts b/src/app/services/arduino-uploader/ArduinoUploader.ts index 0f7de877..b147bb67 100644 --- a/src/app/services/arduino-uploader/ArduinoUploader.ts +++ b/src/app/services/arduino-uploader/ArduinoUploader.ts @@ -50,6 +50,12 @@ class Arduino { * @param callback A callback function to call when the upload status changes. */ async upload(program: string, callback = (message: string) => {}) { + if (this.robotWiredState.getAbortController() != null) { + this.robotWiredState.getAbortController().abort("Upload started"); + this.robotWiredState.setAbortController(null); + await delay(1000); + } + if (this.isUploading) throw new Error('Arduino is already uploading') this.robotWiredState.clearUploadLog()