Update firmware flasher so that it uses files available via the github
releases api.10.3.x-maintenance
parent
2f9e2b13c5
commit
dac49093a0
|
@ -757,6 +757,10 @@
|
||||||
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"firmwareFlasherReleaseSummaryHead": {
|
||||||
|
"message": "Release info"
|
||||||
|
},
|
||||||
|
|
||||||
"firmwareFlasherPath": {
|
"firmwareFlasherPath": {
|
||||||
"message": "Path:"
|
"message": "Path:"
|
||||||
},
|
},
|
||||||
|
|
|
@ -90,6 +90,34 @@
|
||||||
.tab-firmware_flasher .options .flash_on_connect_wrapper {
|
.tab-firmware_flasher .options .flash_on_connect_wrapper {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-firmware_flasher .release_info {
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
border: 1px solid silver;
|
||||||
|
}
|
||||||
|
.tab-firmware_flasher .release_info .title {
|
||||||
|
line-height: 20px;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
border-bottom: 1px solid silver;
|
||||||
|
background-color: #3f4241;
|
||||||
|
}
|
||||||
|
.tab-firmware_flasher .release_info p {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.tab-firmware_flasher .release_info p a {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.tab-firmware_flasher .release_info p a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-firmware_flasher .git_info {
|
.tab-firmware_flasher .git_info {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,13 @@
|
||||||
<strong i18n="firmwareFlasherMessage"></strong> <span class="message"></span>
|
<strong i18n="firmwareFlasherMessage"></strong> <span class="message"></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="release_info">
|
||||||
|
<div class="title" i18n="firmwareFlasherReleaseSummaryHead"></div>
|
||||||
|
<p>
|
||||||
|
<strong i18n="firmwareFlasherReleaseMessage"></strong> <span class="message"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="warning">
|
<div class="warning">
|
||||||
<div class="title" i18n="firmwareFlasherWarninghead"></div>
|
<div class="title" i18n="firmwareFlasherWarninghead"></div>
|
||||||
<p i18n="firmwareFlasherWarningText">
|
<p i18n="firmwareFlasherWarningText">
|
||||||
|
|
|
@ -57,13 +57,24 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var date = new Date(summary.date);
|
var date = new Date(summary.date);
|
||||||
var formattedDate = "{0}-{1}-{2} {3}:{4}".format(date.getFullYear(),date.getMonth(),date.getDay(),
|
var formattedDate = "{0}-{1}-{2} {3}:{4}".format(
|
||||||
date.getHours(),date.getMinutes());
|
date.getFullYear(),
|
||||||
|
date.getMonth(),
|
||||||
|
date.getDay(),
|
||||||
|
date.getHours(),
|
||||||
|
date.getMinutes()
|
||||||
|
);
|
||||||
|
|
||||||
releases_e.append(
|
var select_e =
|
||||||
$("<option value='{0}_{1}'>{2} {3} {4}</option>".
|
$("<option value='{0}_{1}'>{2} {3} {4}</option>".format(
|
||||||
format(releaseIndex,assetIndex,summary.name,summary.target,formattedDate))
|
releaseIndex,
|
||||||
.data('obj', summary));
|
assetIndex,
|
||||||
|
summary.name,
|
||||||
|
summary.target,
|
||||||
|
formattedDate
|
||||||
|
)).data('summary', summary);
|
||||||
|
|
||||||
|
releases_e.append(select_e);
|
||||||
}
|
}
|
||||||
}).bind(this, releases, releaseIndex, releases_e)
|
}).bind(this, releases, releaseIndex, releases_e)
|
||||||
);
|
);
|
||||||
|
@ -72,6 +83,18 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
$.get('https://api.github.com/repos/cleanflight/cleanflight/releases', function (releases){
|
$.get('https://api.github.com/repos/cleanflight/cleanflight/releases', function (releases){
|
||||||
processReleases(releases);
|
processReleases(releases);
|
||||||
|
|
||||||
|
// bind events
|
||||||
|
$('select[name="release"]').change(function() {
|
||||||
|
if (!GUI.connect_lock) {
|
||||||
|
$('.progress').val(0).removeClass('valid invalid');
|
||||||
|
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherLoadFirmwareFile'));
|
||||||
|
$('div.git_info').slideUp();
|
||||||
|
$('div.release_info').slideUp();
|
||||||
|
$('a.flash_firmware').addClass('locked');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}).fail(function (data){
|
}).fail(function (data){
|
||||||
if (data["responseJSON"]){
|
if (data["responseJSON"]){
|
||||||
GUI.log("<b>GITHUB Query Failed: <code>{0}</code></b>".format(data["responseJSON"].message));
|
GUI.log("<b>GITHUB Query Failed: <code>{0}</code></b>".format(data["responseJSON"].message));
|
||||||
|
@ -183,7 +206,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a.load_remote_file').click(function () {
|
$('a.load_remote_file').click(function () {
|
||||||
function process_hex(data, obj) {
|
function process_hex(data, summary) {
|
||||||
intel_hex = data;
|
intel_hex = data;
|
||||||
|
|
||||||
parse_hex(intel_hex, function (data) {
|
parse_hex(intel_hex, function (data) {
|
||||||
|
@ -197,23 +220,29 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
$('a.flash_firmware').removeClass('locked');
|
$('a.flash_firmware').removeClass('locked');
|
||||||
|
|
||||||
$.get('https://api.github.com/repos/cleanflight/cleanflight/commits/' + obj.commit, function (data) {
|
if (summary.commit) {
|
||||||
var data = data,
|
$.get('https://api.github.com/repos/cleanflight/cleanflight/commits/' + summary.commit, function (data) {
|
||||||
d = new Date(data.commit.author.date),
|
var data = data,
|
||||||
offset = d.getTimezoneOffset() / 60,
|
d = new Date(data.commit.author.date),
|
||||||
date;
|
offset = d.getTimezoneOffset() / 60,
|
||||||
|
date;
|
||||||
|
|
||||||
|
date = d.getFullYear() + '.' + ('0' + (d.getMonth() + 1)).slice(-2) + '.' + ('0' + (d.getDate())).slice(-2);
|
||||||
|
date += ' @ ' + ('0' + d.getHours()).slice(-2) + ':' + ('0' + d.getMinutes()).slice(-2);
|
||||||
|
date += (offset > 0) ? ' GMT+' + offset : ' GMT' + offset;
|
||||||
|
|
||||||
|
$('div.git_info .committer').text(data.commit.author.name);
|
||||||
|
$('div.git_info .date').text(date);
|
||||||
|
$('div.git_info .hash').text(data.sha.slice(0, 7)).prop('href', 'https://github.com/cleanflight/cleanflight/commit/' + data.sha);
|
||||||
|
$('div.git_info .message').text(data.commit.message);
|
||||||
|
|
||||||
|
$('div.git_info').slideDown();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$('div.release_info .message').text(summary.message);
|
||||||
|
|
||||||
|
$('div.release_info').slideDown();
|
||||||
|
|
||||||
date = d.getFullYear() + '.' + ('0' + (d.getMonth() + 1)).slice(-2) + '.' + ('0' + (d.getDate())).slice(-2);
|
|
||||||
date += ' @ ' + ('0' + d.getHours()).slice(-2) + ':' + ('0' + d.getMinutes()).slice(-2);
|
|
||||||
date += (offset > 0) ? ' GMT+' + offset : ' GMT' + offset;
|
|
||||||
|
|
||||||
$('div.git_info .committer').text(data.commit.author.name);
|
|
||||||
$('div.git_info .date').text(date);
|
|
||||||
$('div.git_info .hash').text(data.sha.slice(0, 7)).prop('href', 'https://github.com/cleanflight/cleanflight/commit/' + data.sha);
|
|
||||||
$('div.git_info .message').text(data.commit.message);
|
|
||||||
|
|
||||||
$('div.git_info').slideDown();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
|
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
|
||||||
}
|
}
|
||||||
|
@ -225,11 +254,11 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
$('a.flash_firmware').addClass('locked');
|
$('a.flash_firmware').addClass('locked');
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = $('select[name="release"] option:selected').data('obj');
|
var summary = $('select[name="release"] option:selected').data('summary');
|
||||||
|
|
||||||
if (obj) { // undefined while list is loading or while running offline
|
if (summary) { // undefined while list is loading or while running offline
|
||||||
$.get('http://firmware.baseflight.net/' + obj.file, function (data) {
|
$.get(summary.url, function (data) {
|
||||||
process_hex(data, obj);
|
process_hex(data, summary);
|
||||||
}).fail(failed_to_load);
|
}).fail(failed_to_load);
|
||||||
} else {
|
} else {
|
||||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
||||||
|
|
Loading…
Reference in New Issue