Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Commit

Permalink
Fix a bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
skullydazed committed Jun 27, 2017
1 parent f199c2e commit 3c152dd
Showing 1 changed file with 44 additions and 38 deletions.
82 changes: 44 additions & 38 deletions src/MainWindow/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,55 +576,61 @@ function eraseEEPROM(callback) {
}

function checkForBoard() {
if (!flash_in_progress) {
// First look for a supported bootloader
dfu_device = null;
for (let device of usb.getDeviceList()) {
if (usbDevices.hasOwnProperty(device.deviceDescriptor.idVendor) && (usbDevices[device.deviceDescriptor.idVendor].hasOwnProperty(device.deviceDescriptor.idProduct))) {
dfu_device = usbDevices[device.deviceDescriptor.idVendor][device.deviceDescriptor.idProduct];
console.log('Found atmel device: '+dfu_device[0]);
break; // First match wins for now
}
if (flash_in_progress) {
return;
}

// First look for a supported bootloader
dfu_device = null;
for (let device of usb.getDeviceList()) {
if (usbDevices.hasOwnProperty(device.deviceDescriptor.idVendor) && (usbDevices[device.deviceDescriptor.idVendor].hasOwnProperty(device.deviceDescriptor.idProduct))) {
dfu_device = usbDevices[device.deviceDescriptor.idVendor][device.deviceDescriptor.idProduct];
console.log('Found atmel device: '+dfu_device[0]);
break; // First match wins for now
}
if (dfu_device) {
exec(dfu_location + ' ' + dfu_device + ' get bootloader-version', function(error, stdout, stderr) {
if (stdout.indexOf("Bootloader Version:") > -1) {
if (!bootloader_ready && checkFileSilent()) {
clearStatus();
}
}

if (!bootloader_ready) {
bootloader_ready = true;
if (checkFileSilent()) {
if (flash_when_ready || autoFlashEnabled()) {
flashFirmware();
} else {
enableButton($flashHex);
enableButton($rebootMCU);
enableButton($eraseEEPROM);
setFlashButtonImmediate();
sendStatus("Ready To Flash!");
}
}
}
} else if (bootloader_ready) {
bootloader_ready = false;
disableButton($rebootMCU);
disableButton($eraseEEPROM);
if(checkFileSilent() && !autoFlashEnabled()) {
if(!flash_when_ready){
if (!dfu_device) {
return;
}

exec(dfu_location + ' ' + dfu_device + ' get bootloader-version', function(error, stdout, stderr) {
if (stdout.indexOf("Bootloader Version:") > -1) {
if (!bootloader_ready && checkFileSilent()) {
clearStatus();
}

if (!bootloader_ready) {
bootloader_ready = true;
if (checkFileSilent()) {
if (flash_when_ready || autoFlashEnabled()) {
flashFirmware();
} else {
enableButton($flashHex);
enableButton($rebootMCU);
enableButton($eraseEEPROM);
setFlashButtonImmediate();
sendStatus("Ready To Flash!");
}
}
});
}
} else if (bootloader_ready) {
bootloader_ready = false;
disableButton($rebootMCU);
disableButton($eraseEEPROM);
if(checkFileSilent() && !autoFlashEnabled()) {
if(!flash_when_ready){
enableButton($flashHex);
}
}
}
}
});

if (bootloader_ready) {
window.setTimeout(checkForBoard, 1000);
} else if (autoFlashEnabled()) {
window.setTimeout(checkForBoard, 500);
} else {
window.setTimeout(checkForBoard, 5000);
window.setTimeout(checkForBoard, 3000);
}
}

0 comments on commit 3c152dd

Please sign in to comment.