diff --git a/bin/pacakge_urls b/bin/pacakge_urls new file mode 100644 index 0000000..349ce48 --- /dev/null +++ b/bin/pacakge_urls @@ -0,0 +1 @@ +http://dl.platformio.org/packages/manifest.json diff --git a/bin/teensy_loader_cli-armhf/package.json b/bin/teensy_loader_cli-armhf/package.json new file mode 100644 index 0000000..77395c4 --- /dev/null +++ b/bin/teensy_loader_cli-armhf/package.json @@ -0,0 +1,12 @@ +{ + "description": "Teensy Loader", + "name": "tool-teensy", + "system": [ + "linux_armv6l", + "linux_armv7l", + "linux_armv8l", + "linux_aarch64" + ], + "url": "https://www.pjrc.com/teensy/loader.html", + "version": "1.3.0" +} diff --git a/bin/teensy_loader_cli-armhf/teensy_loader_cli b/bin/teensy_loader_cli-armhf/teensy_loader_cli new file mode 100755 index 0000000..4f9b589 Binary files /dev/null and b/bin/teensy_loader_cli-armhf/teensy_loader_cli differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/.DS_Store b/bin/teensy_loader_cli-darwin-x86_64/.DS_Store new file mode 100644 index 0000000..95fab84 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/.DS_Store differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/mktinyfat b/bin/teensy_loader_cli-darwin-x86_64/mktinyfat new file mode 100755 index 0000000..8bebeb6 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/mktinyfat differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/package.json b/bin/teensy_loader_cli-darwin-x86_64/package.json new file mode 100644 index 0000000..922ff3d --- /dev/null +++ b/bin/teensy_loader_cli-darwin-x86_64/package.json @@ -0,0 +1,7 @@ +{ + "description": "Teensy Loader", + "name": "tool-teensy", + "system": "darwin_x86_64", + "url": "https://www.pjrc.com/teensy/loader.html", + "version": "1.152.0" +} diff --git a/bin/teensy_loader_cli-darwin-x86_64/precompile_helper b/bin/teensy_loader_cli-darwin-x86_64/precompile_helper new file mode 100755 index 0000000..6526e41 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/precompile_helper differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/stdout_redirect b/bin/teensy_loader_cli-darwin-x86_64/stdout_redirect new file mode 100755 index 0000000..c6731f9 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/stdout_redirect differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Info.plist b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Info.plist new file mode 100644 index 0000000..3dce7a0 --- /dev/null +++ b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Info.plist @@ -0,0 +1,40 @@ + + + + + + + CFBundleDisplayName + Teensy + CFBundleIdentifier + com.pjrc.teensy + CFBundleName + Teensy + CFBundleShortVersionString + 1.52 + LSHasLocalizedDisplayName + + NSHumanReadableCopyright + All Rights Reserved + NSAppleScriptEnabled + + CFBundleExecutable + teensy + CFBundleIconFile + teensy.icns + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.52 + LSMinimumSystemVersion + 10.7.0 + LSRequiresNativeExecution + + LSExecutableArchitectures + + i386 + + + diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/MacOS/teensy b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/MacOS/teensy new file mode 100755 index 0000000..c1b4092 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/MacOS/teensy differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/PkgInfo b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Resources/teensy.icns b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Resources/teensy.icns new file mode 100644 index 0000000..a9def1c Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/Resources/teensy.icns differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/_CodeSignature/CodeResources b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/_CodeSignature/CodeResources new file mode 100644 index 0000000..33462c1 --- /dev/null +++ b/bin/teensy_loader_cli-darwin-x86_64/teensy.app/Contents/_CodeSignature/CodeResources @@ -0,0 +1,132 @@ + + + + + files + + Resources/teensy.icns + + OHsN17Zmb0LjQBs4ge1sD/kdWdE= + + + files2 + + Resources/teensy.icns + + hash + + OHsN17Zmb0LjQBs4ge1sD/kdWdE= + + hash2 + + f0PkApyBbBz0QKM/7gc5dRvsthj3zLdUbGSxfZ+XR/U= + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_gateway b/bin/teensy_loader_cli-darwin-x86_64/teensy_gateway new file mode 100755 index 0000000..d6ff4bf Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_gateway differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_loader_cli b/bin/teensy_loader_cli-darwin-x86_64/teensy_loader_cli new file mode 100755 index 0000000..4ec3753 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_loader_cli differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_ports b/bin/teensy_loader_cli-darwin-x86_64/teensy_ports new file mode 100755 index 0000000..48a1258 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_ports differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_post_compile b/bin/teensy_loader_cli-darwin-x86_64/teensy_post_compile new file mode 100755 index 0000000..f117a91 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_post_compile differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_reboot b/bin/teensy_loader_cli-darwin-x86_64/teensy_reboot new file mode 100755 index 0000000..c7cd1e0 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_reboot differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_restart b/bin/teensy_loader_cli-darwin-x86_64/teensy_restart new file mode 100755 index 0000000..bfca265 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_restart differ diff --git a/bin/teensy_loader_cli-darwin-x86_64/teensy_serialmon b/bin/teensy_loader_cli-darwin-x86_64/teensy_serialmon new file mode 100755 index 0000000..9a966c1 Binary files /dev/null and b/bin/teensy_loader_cli-darwin-x86_64/teensy_serialmon differ diff --git a/bin/teensy_loader_cli-linux_i686/libpng12.so.0 b/bin/teensy_loader_cli-linux_i686/libpng12.so.0 new file mode 100644 index 0000000..509adcc Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/libpng12.so.0 differ diff --git a/bin/teensy_loader_cli-linux_i686/libusb-0.1.so.4 b/bin/teensy_loader_cli-linux_i686/libusb-0.1.so.4 new file mode 100644 index 0000000..dfa0d51 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/libusb-0.1.so.4 differ diff --git a/bin/teensy_loader_cli-linux_i686/mktinyfat b/bin/teensy_loader_cli-linux_i686/mktinyfat new file mode 100755 index 0000000..677644d Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/mktinyfat differ diff --git a/bin/teensy_loader_cli-linux_i686/package.json b/bin/teensy_loader_cli-linux_i686/package.json new file mode 100644 index 0000000..1af5fa5 --- /dev/null +++ b/bin/teensy_loader_cli-linux_i686/package.json @@ -0,0 +1,9 @@ +{ + "description": "Teensy Loader", + "name": "tool-teensy", + "system": [ + "linux_i686" + ], + "url": "https://www.pjrc.com/teensy/loader.html", + "version": "1.152.200516" +} diff --git a/bin/teensy_loader_cli-linux_i686/precompile_helper b/bin/teensy_loader_cli-linux_i686/precompile_helper new file mode 100755 index 0000000..1d5f22d Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/precompile_helper differ diff --git a/bin/teensy_loader_cli-linux_i686/stdout_redirect b/bin/teensy_loader_cli-linux_i686/stdout_redirect new file mode 100755 index 0000000..d08b5ff Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/stdout_redirect differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy b/bin/teensy_loader_cli-linux_i686/teensy new file mode 100755 index 0000000..cb101c7 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_gateway b/bin/teensy_loader_cli-linux_i686/teensy_gateway new file mode 100755 index 0000000..324a3d3 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_gateway differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_loader_cli b/bin/teensy_loader_cli-linux_i686/teensy_loader_cli new file mode 100755 index 0000000..60ec756 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_loader_cli differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_ports b/bin/teensy_loader_cli-linux_i686/teensy_ports new file mode 100755 index 0000000..bf06c25 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_ports differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_post_compile b/bin/teensy_loader_cli-linux_i686/teensy_post_compile new file mode 100755 index 0000000..d0c3220 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_post_compile differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_reboot b/bin/teensy_loader_cli-linux_i686/teensy_reboot new file mode 100755 index 0000000..85de761 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_reboot differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_restart b/bin/teensy_loader_cli-linux_i686/teensy_restart new file mode 100755 index 0000000..56cfe78 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_restart differ diff --git a/bin/teensy_loader_cli-linux_i686/teensy_serialmon b/bin/teensy_loader_cli-linux_i686/teensy_serialmon new file mode 100755 index 0000000..4d5cc56 Binary files /dev/null and b/bin/teensy_loader_cli-linux_i686/teensy_serialmon differ diff --git a/bin/teensy_loader_cli-linux_x86_64/libpng12.so.0 b/bin/teensy_loader_cli-linux_x86_64/libpng12.so.0 new file mode 100644 index 0000000..d8721e3 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/libpng12.so.0 differ diff --git a/bin/teensy_loader_cli-linux_x86_64/libusb-0.1.so.4 b/bin/teensy_loader_cli-linux_x86_64/libusb-0.1.so.4 new file mode 100644 index 0000000..042b7a2 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/libusb-0.1.so.4 differ diff --git a/bin/teensy_loader_cli-linux_x86_64/mktinyfat b/bin/teensy_loader_cli-linux_x86_64/mktinyfat new file mode 100755 index 0000000..582befb Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/mktinyfat differ diff --git a/bin/teensy_loader_cli-linux_x86_64/package.json b/bin/teensy_loader_cli-linux_x86_64/package.json new file mode 100644 index 0000000..9e5444e --- /dev/null +++ b/bin/teensy_loader_cli-linux_x86_64/package.json @@ -0,0 +1,9 @@ +{ + "description": "Teensy Loader", + "name": "tool-teensy", + "system": [ + "linux_x86_64" + ], + "url": "https://www.pjrc.com/teensy/loader.html", + "version": "1.152.200516" +} diff --git a/bin/teensy_loader_cli-linux_x86_64/precompile_helper b/bin/teensy_loader_cli-linux_x86_64/precompile_helper new file mode 100755 index 0000000..e068c92 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/precompile_helper differ diff --git a/bin/teensy_loader_cli-linux_x86_64/stdout_redirect b/bin/teensy_loader_cli-linux_x86_64/stdout_redirect new file mode 100755 index 0000000..c659470 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/stdout_redirect differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy b/bin/teensy_loader_cli-linux_x86_64/teensy new file mode 100755 index 0000000..18c4b15 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_gateway b/bin/teensy_loader_cli-linux_x86_64/teensy_gateway new file mode 100755 index 0000000..2ed3c39 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_gateway differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_loader_cli b/bin/teensy_loader_cli-linux_x86_64/teensy_loader_cli new file mode 100755 index 0000000..1d6f7b2 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_loader_cli differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_ports b/bin/teensy_loader_cli-linux_x86_64/teensy_ports new file mode 100755 index 0000000..9aa5816 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_ports differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_post_compile b/bin/teensy_loader_cli-linux_x86_64/teensy_post_compile new file mode 100755 index 0000000..d00e72d Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_post_compile differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_reboot b/bin/teensy_loader_cli-linux_x86_64/teensy_reboot new file mode 100755 index 0000000..3b3c707 Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_reboot differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_restart b/bin/teensy_loader_cli-linux_x86_64/teensy_restart new file mode 100755 index 0000000..b6945bb Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_restart differ diff --git a/bin/teensy_loader_cli-linux_x86_64/teensy_serialmon b/bin/teensy_loader_cli-linux_x86_64/teensy_serialmon new file mode 100755 index 0000000..3a9681a Binary files /dev/null and b/bin/teensy_loader_cli-linux_x86_64/teensy_serialmon differ diff --git a/bin/teensy_loader_cli-windows/mktinyfat.exe b/bin/teensy_loader_cli-windows/mktinyfat.exe new file mode 100755 index 0000000..921b163 Binary files /dev/null and b/bin/teensy_loader_cli-windows/mktinyfat.exe differ diff --git a/bin/teensy_loader_cli-windows/package.json b/bin/teensy_loader_cli-windows/package.json new file mode 100644 index 0000000..ee5a1ca --- /dev/null +++ b/bin/teensy_loader_cli-windows/package.json @@ -0,0 +1,11 @@ +{ + "description": "Teensy Loader", + "name": "tool-teensy", + "system": [ + "windows", + "windows_amd64", + "windows_x86" + ], + "url": "https://www.pjrc.com/teensy/loader.html", + "version": "1.152.200516" +} diff --git a/bin/teensy_loader_cli-windows/precompile_helper.exe b/bin/teensy_loader_cli-windows/precompile_helper.exe new file mode 100755 index 0000000..2beb4e5 Binary files /dev/null and b/bin/teensy_loader_cli-windows/precompile_helper.exe differ diff --git a/bin/teensy_loader_cli-windows/stdout_redirect.exe b/bin/teensy_loader_cli-windows/stdout_redirect.exe new file mode 100755 index 0000000..70b2702 Binary files /dev/null and b/bin/teensy_loader_cli-windows/stdout_redirect.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy.exe b/bin/teensy_loader_cli-windows/teensy.exe new file mode 100755 index 0000000..c98e39b Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_gateway.exe b/bin/teensy_loader_cli-windows/teensy_gateway.exe new file mode 100755 index 0000000..51c8ba2 Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_gateway.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_loader_cli.exe b/bin/teensy_loader_cli-windows/teensy_loader_cli.exe new file mode 100755 index 0000000..b8999d1 Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_loader_cli.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_ports.exe b/bin/teensy_loader_cli-windows/teensy_ports.exe new file mode 100755 index 0000000..9532e8c Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_ports.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_post_compile.exe b/bin/teensy_loader_cli-windows/teensy_post_compile.exe new file mode 100755 index 0000000..18e2b50 Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_post_compile.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_reboot.exe b/bin/teensy_loader_cli-windows/teensy_reboot.exe new file mode 100755 index 0000000..6772379 Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_reboot.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_restart.exe b/bin/teensy_loader_cli-windows/teensy_restart.exe new file mode 100755 index 0000000..6702500 Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_restart.exe differ diff --git a/bin/teensy_loader_cli-windows/teensy_serialmon.exe b/bin/teensy_loader_cli-windows/teensy_serialmon.exe new file mode 100755 index 0000000..29772ee Binary files /dev/null and b/bin/teensy_loader_cli-windows/teensy_serialmon.exe differ diff --git a/main.js b/main.js index 22df94c..fef436b 100644 --- a/main.js +++ b/main.js @@ -3,6 +3,7 @@ const {download} = require('electron-dl') const {spawn} = require('child_process'); const {execFile} = require('child_process'); const fs = require('fs'); +const path = require('path'); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -10,6 +11,8 @@ let win var avrdudeErr = ""; var avrdudeIsRunning = false; +var teensyLoaderIsRunning = false; +var teensyLoaderErr = "" function createWindow () { // Create the browser window. @@ -174,20 +177,84 @@ ipcMain.on('uploadFW', (e, args) => { } }); +}); + + ipcMain.on('uploadFW_teensy35', (e, args) => { + + if(teensyLoaderIsRunning == true) { return; } + teensyLoaderIsRunning = true; //Indicate that an avrdude process has started + var platform; + + var burnStarted = false; + var burnPercent = 0; + + //All Windows builds use the 32-bit binary + if(process.platform == "win32") + { + platform = "teensy_loader_cli-windows"; + } + //All Mac builds use the 64-bit binary + else if(process.platform == "darwin") + { + platform = "teensy_loader_cli-darwin-x86_64"; + } + else if(process.platform == "linux") + { + if(process.arch == "x32") { platform = "teensy_loader_cli-linux_i686"; } + else if(process.arch == "x64") { platform = "teensy_loader_cli-linux_x86_64"; } + else if(process.arch == "arm") { platform = "teensy_loader_cli-armhf"; } + else if(process.arch == "arm64") { platform = "teensy_loader_cli-aarch64"; } + } + + var executableName = __dirname + "/bin/" + platform + "/teensy_post_compile"; + executableName = executableName.replace('app.asar',''); //This is important for allowing the binary to be found once the app is packaed into an asar + var configName = executableName + ".conf"; + if(process.platform == "win32") { executableName = executableName + '.exe'; } //This must come after the configName line above + + var execArgs = ['-board=TEENSY35', '-reboot', '-file='+path.basename(args.firmwareFile, '.hex'), '-path='+path.dirname(args.firmwareFile), '-tools='+executableName.replace('/teensy_post_compile', "")]; + console.log(execArgs); + + console.log(executableName); + const child = execFile(executableName, execArgs); + + child.stdout.on('data', (data) => { + console.log(`teensy_loader_cli stdout:\n${data}`); + }); + + child.stderr.on('data', (data) => { + console.log(`teensy_loader_cli stderr: ${data}`); + teensyLoaderErr = teensyLoaderErr + data; + + //Check if avrdude has started the actual burn yet, and if so, track the '#' characters that it prints. Each '#' represents 1% of the total burn process (50 for write and 50 for read) + if (burnStarted == true) + { + if(data=="#") { burnPercent += 1; } + e.sender.send( "upload percent", burnPercent ); + } + else + { + //This is a hack, but basically watch the output from avrdude for the term 'Writing | ', everything after that is the #s indicating 1% of burn. + if(teensyLoaderErr.substr(teensyLoaderErr.length - 10) == "Writing | ") + { + burnStarted = true; + } + } + + }); child.on('error', (err) => { console.log('Failed to start subprocess.'); console.log(err); - avrdudeIsRunning = false; + teensyLoaderIsRunning = false; }); child.on('close', (code) => { - avrdudeIsRunning = false; + teensyLoaderIsRunning = false; if (code !== 0) { - console.log(`avrdude process exited with code ${code}`); - e.sender.send( "upload error", avrdudeErr ) - avrdudeErr = ""; + console.log(`teensyLoader process exited with code ${code}`); + e.sender.send( "upload error", teensyLoaderErr ) + teensyLoaderErr = ""; } else { diff --git a/renderer.js b/renderer.js index f8d6ad3..2e5ec1d 100644 --- a/renderer.js +++ b/renderer.js @@ -4,6 +4,8 @@ const {remote} = require('electron') const { shell } = require('electron') var basetuneList = []; +var isMega = false; +var isTeensy = false; function refreshSerialPorts() { @@ -34,8 +36,29 @@ function refreshSerialPorts() var newOption = document.createElement('option'); newOption.value = ports[i].comName; newOption.innerHTML = ports[i].comName; + if(ports[i].vendorId == "2341") + { + //Arduino device + if(ports[i].productId == "0010" || ports[i].productId == "0042") + { + //Mega2560 + newOption.innerHTML = newOption.innerHTML + " (Arduino Mega)"; + isMega = true; + } + } + else if(ports[i].vendorId == "16c0") + { + //Teensy + if(ports[i].productId == "0483") + { + //Teensy - Unfortunately all Teensy devices use the same device ID :( + newOption.innerHTML = newOption.innerHTML + " (Teensy)"; + } + } select.add(newOption); + //console.log(ports[i].serialNumber ); } + var button = document.getElementById("btnInstall") if(ports.length > 0) { @@ -207,12 +230,23 @@ function refreshBasetunes() } } -function downloadHex() +function downloadHex(isTeensy) { var e = document.getElementById('versionsSelect'); - var DLurl = "http://speeduino.com/fw/bin/" + e.options[e.selectedIndex].value + ".hex"; - console.log("Downloading: " + DLurl); + + var DLurl; + if(isTeensy) + { + DLurl = "http://speeduino.com/fw/teensy35/" + e.options[e.selectedIndex].value + ".hex"; + console.log("Downloading Teensy 35 firmware: " + DLurl); + } + else + { + + DLurl = "http://speeduino.com/fw/bin/" + e.options[e.selectedIndex].value + ".hex"; + console.log("Downloading AVR firmware: " + DLurl); + } //Download the Hex file ipcRenderer.send("download", { @@ -276,6 +310,10 @@ function uploadFW() spinner.classList.remove('fa-times'); spinner.classList.add('fa-spinner'); + //Lookup what platform we're using + var portSelect = document.getElementById('portsSelect'); + var isTeensy = portSelect.innerHTML.includes("Teensy"); + //Hide the terminal section incase it was there from a previous burn attempt document.getElementById('terminalSection').style.display = "none"; //Same for the ini location link @@ -296,7 +334,7 @@ function uploadFW() statusText.innerHTML = "Downloading firmware" document.getElementById('iniFileText').style.display = "block" document.getElementById('iniFileLocation').innerHTML = file - downloadHex(); + downloadHex(isTeensy); } else if(extension == "hex") { @@ -308,10 +346,20 @@ function uploadFW() console.log("Using port: " + uploadPort); //Begin the upload - ipcRenderer.send("uploadFW", { + if(isTeensy) + { + ipcRenderer.send("uploadFW_teensy35", { port: uploadPort, firmwareFile: file - }); + }); + } + else + { + ipcRenderer.send("uploadFW", { + port: uploadPort, + firmwareFile: file + }); + } } console.log(); });