new simplified flasher status UI

10.3.x-maintenance
cTn 2014-08-30 10:30:28 +02:00
parent bed74a5f62
commit 37de8dfefa
6 changed files with 70 additions and 41 deletions

View File

@ -567,19 +567,16 @@
"message": "Leave Firmware Flasher"
},
"firmwareFlasherFirmwareNotLoaded": {
"message": "<span style=\"color: red\">Firmware not loaded</span>"
},
"firmwareFlasherLocalFirmwareLoaded": {
"message": "<span style=\"color: green\">Local Firmware loaded, ready for flashing</span>"
"message": "Firmware not loaded"
},
"firmwareFlasherHexCorrupted": {
"message": "<span style=\"color: red\">HEX file appears to be corrupted</span>"
"message": "HEX file appears to be corrupted"
},
"firmwareFlasherRemoteFirmwareLoaded": {
"message": "<span style=\"color: green\">Remote Firmware loaded, ready for flashing</span>"
},
"firmwareFlasherFailedToLoadOnlineFirmware": {
"message": "<span style=\"color: red\">Failed to load remote firmware</span>"
"message": "Failed to load remote firmware"
},
"firmwareFlasherWaitForFinish": {
"message": "You <span style=\"color: red\">can't</span> do this right now, please wait for current operation to finish ..."

View File

@ -145,7 +145,10 @@ STM32_protocol.prototype.initialize = function () {
self.upload_process_alive = false;
} else {
console.log('STM32 - timed out, programming failed ...');
GUI.log('STM32 - timed out, programming: <strong style="color: red">FAILED</strong>');
$('span.progressLabel').text('STM32 - timed out, programming: FAILED');
self.progress_bar_e.addClass('invalid');
googleAnalytics.sendEvent('Flashing', 'Programming', 'timeout');
// protocol got stuck, clear timer and disconnect
@ -225,7 +228,8 @@ STM32_protocol.prototype.send = function (Array, bytes_to_read, callback) {
STM32_protocol.prototype.verify_response = function (val, data) {
if (val != data[0]) {
console.error('STM32 Communication failed, wrong response, expected: ' + val + ' received: ' + data[0]);
GUI.log('STM32 Communication <span style="color: red">failed</span>, wrong response, expected: ' + val + ' received: ' + data[0]);
$('span.progressLabel').text('STM32 Communication failed, wrong response, expected: ' + val + ' received: ' + data[0]);
self.progress_bar_e.addClass('invalid');
// disconnect
this.upload_procedure(99);
@ -333,7 +337,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
switch (step) {
case 1:
// initialize serial interface on the MCU side, auto baud rate settings
GUI.log('Contacting bootloader ...');
$('span.progressLabel').text('Contacting bootloader ...');
var send_counter = 0;
GUI.interval_add('stm32_initialize_mcu', function () { // 200 ms interval (just in case mcu was already initialized), we need to break the 2 bytes command requirement
@ -345,8 +349,10 @@ STM32_protocol.prototype.upload_procedure = function (step) {
// proceed to next step
self.upload_procedure(2);
} else {
$('span.progressLabel').text('Communication with bootloader failed');
self.progress_bar_e.addClass('invalid');
GUI.interval_remove('stm32_initialize_mcu');
GUI.log('Communication with bootloader <span style="color: red">failed</span>');
// disconnect
self.upload_procedure(99);
@ -356,7 +362,10 @@ STM32_protocol.prototype.upload_procedure = function (step) {
if (send_counter++ > 3) {
// stop retrying, its too late to get any response from MCU
console.log('STM32 - no response from bootloader, disconnecting');
GUI.log('No reponse from the bootloader, programming: <strong style="color: red">FAILED</strong>');
$('span.progressLabel').text('No reponse from the bootloader, programming: FAILED');
self.progress_bar_e.addClass('invalid');
GUI.interval_remove('stm32_initialize_mcu');
GUI.interval_remove('STM32_timeout');
@ -399,7 +408,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
break;
case 4:
// erase memory
GUI.log('Erasing ...');
$('span.progressLabel').text('Erasing ...');
if (self.options.erase_chip) {
console.log('Executing global chip erase');
@ -449,7 +458,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
case 5:
// upload
console.log('Writing data ...');
GUI.log('Flashing ...');
$('span.progressLabel').text('Flashing ...');
var blocks = self.hex.data.length - 1,
flashing_block = 0,
@ -524,7 +533,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
case 6:
// verify
console.log('Verifying data ...');
GUI.log('Verifying ...');
$('span.progressLabel').text('Verifying ...');
var blocks = self.hex.data.length - 1,
reading_block = 0,
@ -596,7 +605,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
if (verify) {
console.log('Programming: SUCCESSFUL');
GUI.log('Programming: <strong style="color: green">SUCCESSFUL</strong>');
$('span.progressLabel').text('Programming: SUCCESSFUL');
googleAnalytics.sendEvent('Flashing', 'Programming', 'success');
// update progress bar
@ -606,7 +615,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
self.upload_procedure(7);
} else {
console.log('Programming: FAILED');
GUI.log('Programming: <strong style="color: red">FAILED</strong>');
$('span.progressLabel').text('Programming: FAILED');
googleAnalytics.sendEvent('Flashing', 'Programming', 'fail');
// update progress bar

View File

@ -256,7 +256,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
case 2:
// full chip erase
console.log('Executing global chip erase');
GUI.log('Erasing ...');
$('span.progressLabel').text('Erasing ...');
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x41], function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
@ -284,7 +284,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
// upload
// we dont need to clear the state as we are already using DFU_DNLOAD
console.log('Writing data ...');
GUI.log('Flashing ...');
$('span.progressLabel').text('Flashing ...');
var blocks = self.hex.data.length - 1;
var flashing_block = 0;
@ -355,7 +355,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
case 5:
// verify
console.log('Verifying data ...');
GUI.log('Verifying ...');
$('span.progressLabel').text('Verifying ...');
var blocks = self.hex.data.length - 1;
var reading_block = 0;
@ -422,7 +422,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
if (verify) {
console.log('Programming: SUCCESSFUL');
GUI.log('Programming: <strong style="color: green">SUCCESSFUL</strong>');
$('span.progressLabel').text('Programming: SUCCESSFUL');
googleAnalytics.sendEvent('Flashing', 'Programming', 'success');
// update progress bar
@ -432,7 +432,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
self.upload_procedure(6);
} else {
console.log('Programming: FAILED');
GUI.log('Programming: <strong style="color: red">FAILED</strong>');
$('span.progressLabel').text('Programming: FAILED');
googleAnalytics.sendEvent('Flashing', 'Programming', 'fail');
// update progress bar

View File

@ -1,22 +1,50 @@
.tab-firmware_flasher .info {
margin: 0 0 10px 0;
position: relative;
}
.tab-firmware_flasher .info strong {
margin-right: 5px;
.tab-firmware_flasher .info .progressLabel {
position: absolute;
width: 100%;
height: 26px;
top: 0;
left: 0;
text-align: center;
line-height: 24px;
color: white;
font-weight: bold;
/* text-shadow: 1px 0px 2px rgba(0, 0, 0, 0.9);*/
}
.tab-firmware_flasher .info .progress {
width: 25%;
width: 100%;
height: 26px;
border: 1px solid silver;
}
.tab-firmware_flasher .info .progress::-webkit-progress-value {
background-color: #f4af4d;
.tab-firmware_flasher .info .progress {
-webkit-appearance: none;
}
.tab-firmware_flasher .info .progress::-webkit-progress-bar {
background-color: #343434;
}
.tab-firmware_flasher .info .progress::-webkit-progress-value {
background-color: #F86008;
}
.tab-firmware_flasher .info .progress.valid::-webkit-progress-bar {
background-color: #73BE45;
}
.tab-firmware_flasher .info .progress.valid::-webkit-progress-value {
background-color: #43c232;
background-color: #73BE45;
}
.tab-firmware_flasher .info .progress.invalid::-webkit-progress-bar {
background-color: #A62E32;
}
.tab-firmware_flasher .info .progress.invalid::-webkit-progress-value {
background-color: #cf2222;
background-color: #A62E32;
}
.tab-firmware_flasher .note {
margin-bottom: 10px;

View File

@ -1,8 +1,7 @@
<div class="tab-firmware_flasher">
<div class="info">
<strong i18n="firmwareFlasherPath"></strong><span class="path">Please load firmware file</span><br />
<strong i18n="firmwareFlasherSize"></strong><span class="size">0 bytes</span><br />
<strong i18n="firmwareFlasherProgress"></strong><progress class="progress" value="0" min="0" max="100"></progress>
<progress class="progress" value="0" min="0" max="100"></progress>
<span class="progressLabel">Please load firmware file</span>
</div>
<div class="note">
<p i18n="firmwareFlasherNote">

View File

@ -27,7 +27,6 @@ TABS.firmware_flasher.initialize = function (callback) {
chrome.fileSystem.getDisplayPath(fileEntry, function (path) {
console.log('Loading file from: ' + path);
$('span.path').html(path);
fileEntry.file(function (file) {
var reader = new FileReader();
@ -50,13 +49,12 @@ TABS.firmware_flasher.initialize = function (callback) {
parsed_hex = data;
if (parsed_hex) {
GUI.log(chrome.i18n.getMessage('firmwareFlasherLocalFirmwareLoaded'));
googleAnalytics.sendEvent('Flashing', 'Firmware', 'local');
$('a.flash_firmware').removeClass('locked');
$('span.size').html(parsed_hex.bytes_total + ' bytes');
$('span.progressLabel').text('Loaded Local firmware: (' + parsed_hex.bytes_total + ' bytes)');
} else {
GUI.log(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
}
});
}
@ -76,18 +74,16 @@ TABS.firmware_flasher.initialize = function (callback) {
parsed_hex = data;
if (parsed_hex) {
GUI.log(chrome.i18n.getMessage('firmwareFlasherRemoteFirmwareLoaded'));
googleAnalytics.sendEvent('Flashing', 'Firmware', 'online');
$('a.flash_firmware').removeClass('locked');
$('span.path').text('Using remote Firmware');
$('span.size').text(parsed_hex.bytes_total + ' bytes');
$('span.progressLabel').text('Loaded Online firmware: (' + parsed_hex.bytes_total + ' bytes)');
} else {
GUI.log(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
}
});
}).fail(function () {
GUI.log(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
$('a.flash_firmware').addClass('locked');
});
@ -151,7 +147,7 @@ TABS.firmware_flasher.initialize = function (callback) {
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex);
}
} else {
GUI.log(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
}
}
}