diff --git a/_locales/en/messages.json b/_locales/en/messages.json index a0e30bdb..655abf57 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -567,19 +567,16 @@ "message": "Leave Firmware Flasher" }, "firmwareFlasherFirmwareNotLoaded": { - "message": "Firmware not loaded" - }, - "firmwareFlasherLocalFirmwareLoaded": { - "message": "Local Firmware loaded, ready for flashing" + "message": "Firmware not loaded" }, "firmwareFlasherHexCorrupted": { - "message": "HEX file appears to be corrupted" + "message": "HEX file appears to be corrupted" }, "firmwareFlasherRemoteFirmwareLoaded": { "message": "Remote Firmware loaded, ready for flashing" }, "firmwareFlasherFailedToLoadOnlineFirmware": { - "message": "Failed to load remote firmware" + "message": "Failed to load remote firmware" }, "firmwareFlasherWaitForFinish": { "message": "You can't do this right now, please wait for current operation to finish ..." diff --git a/js/protocols/stm32.js b/js/protocols/stm32.js index 1cb4bdd9..cae1e8a7 100644 --- a/js/protocols/stm32.js +++ b/js/protocols/stm32.js @@ -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: FAILED'); + + $('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 failed, 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 failed'); // 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: FAILED'); + + $('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: SUCCESSFUL'); + $('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: FAILED'); + $('span.progressLabel').text('Programming: FAILED'); googleAnalytics.sendEvent('Flashing', 'Programming', 'fail'); // update progress bar diff --git a/js/protocols/stm32usbdfu.js b/js/protocols/stm32usbdfu.js index 50da3e9d..e145f977 100644 --- a/js/protocols/stm32usbdfu.js +++ b/js/protocols/stm32usbdfu.js @@ -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: SUCCESSFUL'); + $('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: FAILED'); + $('span.progressLabel').text('Programming: FAILED'); googleAnalytics.sendEvent('Flashing', 'Programming', 'fail'); // update progress bar diff --git a/tabs/firmware_flasher.css b/tabs/firmware_flasher.css index 1b79862d..be3f0df8 100644 --- a/tabs/firmware_flasher.css +++ b/tabs/firmware_flasher.css @@ -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; diff --git a/tabs/firmware_flasher.html b/tabs/firmware_flasher.html index 59adba33..32b1bcb5 100644 --- a/tabs/firmware_flasher.html +++ b/tabs/firmware_flasher.html @@ -1,8 +1,7 @@
diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index d5b5ceb5..dd6e34c0 100644 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -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')); } } }