Skip to content

Commit d6419c1

Browse files
authored
Enable ESP8266 OTA (#17, #70) (#74)
1 parent ed3bf53 commit d6419c1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/extension.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,21 @@ export function activate(context: vscode.ExtensionContext) {
532532
}
533533
}
534534
} else { // esp8266
535-
let upload = "tools" + path.sep + "upload.py";
536-
let uploadPath = findTool(arduinoContext, "runtime.platform.path");
537-
if (uploadPath) {
538-
upload = uploadPath + path.sep + upload;
535+
if (network) {
536+
let espota = "tools" + path.sep + "espota.py";
537+
let espotaPath = findTool(arduinoContext, "runtime.platform.path");
538+
if (espotaPath) {
539+
espota = espotaPath + path.sep + espota;
540+
}
541+
uploadOpts = [espota, "-i", serialPort, "-p", String(networkPort), "-f", imageFile, "-s"];
542+
} else {
543+
let upload = "tools" + path.sep + "upload.py";
544+
let uploadPath = findTool(arduinoContext, "runtime.platform.path");
545+
if (uploadPath) {
546+
upload = uploadPath + path.sep + upload;
547+
}
548+
uploadOpts = [upload, "--chip", "esp8266", "--port", serialPort, "--baud", String(uploadSpeed), "write_flash", String(fsStart), imageFile];
539549
}
540-
uploadOpts = [upload, "--chip", "esp8266", "--port", serialPort, "--baud", String(uploadSpeed), "write_flash", String(fsStart), imageFile];
541550
}
542551

543552
writeEmitter.fire(bold("\r\nUploading LittleFS filesystem\r\n"));

0 commit comments

Comments
 (0)