mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 04:45:18 +03:00
handle all sorts of edge cases that would otherwise break UI or functionality
This commit is contained in:
parent
97e37347d6
commit
7a0d3a1199
3 changed files with 23 additions and 8 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="options">
|
||||
<div class="option releases">
|
||||
<select name="release">
|
||||
<option value="0">Offline</option>
|
||||
<option value="0">Loading ...</option>
|
||||
</select>
|
||||
<span class="description" i18n="firmwareFlasherOnlineReleasesDescription"></span>
|
||||
</div>
|
||||
|
|
|
@ -68,11 +68,15 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
|
||||
// bind events
|
||||
$('select[name="release"]').change(function() {
|
||||
// hide github info (if it exists)
|
||||
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('<option value="0">Offline</option>')
|
||||
});
|
||||
|
||||
// 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');
|
||||
|
||||
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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue