1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +03:00

logo customization code autoformatted with 4 space indents and minor refactoring

This commit is contained in:
Kiripolszky Károly 2018-02-20 22:00:58 +01:00
parent 6ef1ae7721
commit 79907fa388

View file

@ -196,7 +196,7 @@ var openLogoImage = function() {
});
};
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['png', 'bmp']}]}, function(fileEntry) {
chrome.fileSystem.chooseEntry({ type: 'openFile', accepts: [{ extensions: ['png', 'bmp'] }] }, function(fileEntry) {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
return;
@ -252,7 +252,7 @@ FONT.replaceLogoFromImage = function(img) {
for (var n = 0, N = lines.length; n < N; n++) {
var line = lines[n];
for (var y = 0; y < 8; y = y + 2) {
var v = parseInt(line.slice(y, y+2), 2);
var v = parseInt(line.slice(y, y + 2), 2);
characterBits.push(v);
}
characterBytes.push(parseInt(line, 2));
@ -352,7 +352,7 @@ FONT.logoPreview = function($el) {
.height(FONT.constants.LOGO.TILES_NUM_VERT * FONT.constants.SIZES.CHAR_HEIGHT);
for (var i = SYM.LOGO, I = FONT.constants.MAX_CHAR_COUNT; i < I; i++) {
var url = FONT.data.character_image_urls[i];
$el.append('<img src="'+url+'" title="0x'+i.toString(16)+'"></img>');
$el.append('<img src="' + url + '" title="0x' + i.toString(16) + '"></img>');
}
};
@ -1878,8 +1878,10 @@ TABS.osd.initialize = function (callback) {
});
// replace logo
$('a.replace_logo').click(function () {
if (!GUI.connect_lock) { // button disabled while flashing is in progress
$('a.replace_logo').click(function() {
if (GUI.connect_lock) { // button disabled while flashing is in progress
return;
}
openLogoImage().then(function(ctx) {
FONT.replaceLogoFromImage(ctx);
FONT.logoPreview($logoPreview);
@ -1887,7 +1889,6 @@ TABS.osd.initialize = function (callback) {
console.error("error loading image:", error);
GUI.log(error);
});
}
});
//Switch all elements