diff --git a/js/protocols/stm32.js b/js/protocols/stm32.js index 7e4a1c706d..694233fc6f 100644 --- a/js/protocols/stm32.js +++ b/js/protocols/stm32.js @@ -141,6 +141,9 @@ STM32_protocol.prototype.initialize = function () { self.progress_bar_e.val(0); self.progress_bar_e.removeClass('valid invalid'); + // lock some UI elements TODO needs rework + $('select[name="release"]').prop('disabled', true); + serial.onReceive.addListener(function (info) { self.read(info); }); @@ -671,6 +674,9 @@ STM32_protocol.prototype.upload_procedure = function (step) { // unlocking connect button GUI.connect_lock = false; + // unlock some UI elements TODO needs rework + $('select[name="release"]').prop('disabled', false); + // handle timing var timeSpent = new Date().getTime() - self.upload_time_start; diff --git a/tabs/firmware_flasher.html b/tabs/firmware_flasher.html index 7a4224101d..524a2726a7 100644 --- a/tabs/firmware_flasher.html +++ b/tabs/firmware_flasher.html @@ -6,7 +6,7 @@
diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index 62d572338f..95e4270b11 100644 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -68,11 +68,15 @@ TABS.firmware_flasher.initialize = function (callback) { // bind events $('select[name="release"]').change(function() { - // hide github info (if it exists) - $('div.git_info').slideUp(); + if (!GUI.connect_lock) { + $('.progress').val(0).removeClass('valid invalid'); + $('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherLoadFirmwareFile')); + $('div.git_info').slideUp(); + $('a.flash_firmware').addClass('locked'); + } }); }).fail(function () { - // Failed to load release list, offline? + $('select[name="release"]').empty().append('') }); // UI Hooks @@ -155,7 +159,7 @@ TABS.firmware_flasher.initialize = function (callback) { $('div.git_info .committer').text(data.commit.author.name); $('div.git_info .date').text(date); - $('div.git_info .hash').text(data.sha.slice(-7)).prop('href', 'https://github.com/multiwii/baseflight/commit/' + data.sha); + $('div.git_info .hash').text(data.sha.slice(0, 7)).prop('href', 'https://github.com/multiwii/baseflight/commit/' + data.sha); $('div.git_info .message').text(data.commit.message); $('div.git_info').slideDown(); @@ -172,9 +176,14 @@ TABS.firmware_flasher.initialize = function (callback) { } var obj = $('select[name="release"] option:selected').data('obj'); - $.get('http://firmware.baseflight.net/' + obj.file, function (data) { - process_hex(data, obj); - }).fail(failed_to_load); + + if (obj) { // undefined while list is loading or while running offline + $.get('http://firmware.baseflight.net/' + obj.file, function (data) { + process_hex(data, obj); + }).fail(failed_to_load); + } else { + $('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware')); + } }); $('a.flash_firmware').click(function () {