1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Remove tabs and some trailing spaces

This commit is contained in:
Miguel Angel Mulero Martinez 2019-11-03 13:40:26 +01:00
parent 55df431247
commit 09e2f6d231
9 changed files with 384 additions and 393 deletions

View file

@ -168,7 +168,7 @@ function configuration_backup(callback) {
configuration.RXFAIL_CONFIG = jQuery.extend(true, [], RXFAIL_CONFIG);
}
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
configuration.RSSI_CONFIG = jQuery.extend(true, {}, RSSI_CONFIG);
configuration.RSSI_CONFIG = jQuery.extend(true, {}, RSSI_CONFIG);
configuration.FEATURE_CONFIG = jQuery.extend(true, {}, FEATURE_CONFIG);
configuration.MOTOR_CONFIG = jQuery.extend(true, {}, MOTOR_CONFIG);
configuration.GPS_CONFIG = jQuery.extend(true, {}, GPS_CONFIG);
@ -422,7 +422,6 @@ function configuration_restore(callback) {
configuration.LED_STRIP = fixed_led_strip;
}
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
var RC = configuration.profiles[profileIndex].RC;
// TPA breakpoint was added
@ -596,7 +595,6 @@ function configuration_restore(callback) {
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) {
// api 1.15 exposes RCdeadband and sensor alignment
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
if (configuration.profiles[profileIndex].RCdeadband == undefined) {
configuration.profiles[profileIndex].RCdeadband = {
@ -828,8 +826,8 @@ function configuration_restore(callback) {
uniqueData.push(MSPCodes.MSP_SET_FAILSAFE_CONFIG);
}
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
uniqueData.push(MSPCodes.MSP_SET_FEATURE_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_MOTOR_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_FEATURE_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_MOTOR_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_GPS_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_COMPASS_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_RSSI_CONFIG);

View file

@ -222,34 +222,34 @@ STM32DFU_protocol.prototype.getInterfaceDescriptors = function (interfaceNum, ca
return;
}
var interfaceID = 0;
var descriptorStringArray = [];
var getDescriptorString = function () {
if(interfaceID < config.interfaces.length) {
self.getInterfaceDescriptor(interfaceID, function (descriptor, resultCode) {
if (resultCode) {
callback([], resultCode);
return;
}
interfaceID++;
self.getString(descriptor.iInterface, function (descriptorString, resultCode) {
if (resultCode) {
callback([], resultCode);
return;
}
if (descriptor.bInterfaceNumber == interfaceNum) {
descriptorStringArray.push(descriptorString);
}
getDescriptorString();
});
});
} else {
//console.log(descriptorStringArray);
callback(descriptorStringArray, 0);
return;
}
}
getDescriptorString();
var interfaceID = 0;
var descriptorStringArray = [];
var getDescriptorString = function () {
if(interfaceID < config.interfaces.length) {
self.getInterfaceDescriptor(interfaceID, function (descriptor, resultCode) {
if (resultCode) {
callback([], resultCode);
return;
}
interfaceID++;
self.getString(descriptor.iInterface, function (descriptorString, resultCode) {
if (resultCode) {
callback([], resultCode);
return;
}
if (descriptor.bInterfaceNumber == interfaceNum) {
descriptorStringArray.push(descriptorString);
}
getDescriptorString();
});
});
} else {
//console.log(descriptorStringArray);
callback(descriptorStringArray, 0);
return;
}
}
getDescriptorString();
});
}
@ -396,11 +396,6 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
case 'K':
page_size *= 1024;
break;
/* case ' ':
break;
default:
return null;
*/
}
sectors.push({
@ -419,12 +414,12 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
'sectors' : sectors,
'total_size' : total_size
}
return memory;
}
var chipInfo = descriptors.map(parseDescriptor).reduce(function(o, v, i) {
o[v.type.toLowerCase().replace(' ', '_')] = v;
return o;
}, {});
return memory;
}
var chipInfo = descriptors.map(parseDescriptor).reduce(function(o, v, i) {
o[v.type.toLowerCase().replace(' ', '_')] = v;
return o;
}, {});
callback(chipInfo, resultCode);
});
}
@ -435,7 +430,7 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
// timeout support was added in chrome v43
var timeout;
if (typeof _timeout === "undefined") {
timeout = 0; // default is 0 (according to chrome.usb API)
timeout = 0; // default is 0 (according to chrome.usb API)
} else {
timeout = _timeout;
}
@ -527,11 +522,11 @@ STM32DFU_protocol.prototype.loadAddress = function (address, callback, abort) {
callback(data);
} else {
console.log('Failed to execute address load');
if(typeof abort === "undefined" || abort) {
self.upload_procedure(99);
} else {
callback(data);
}
if(typeof abort === "undefined" || abort) {
self.upload_procedure(99);
} else {
callback(data);
}
}
});
}, delay);
@ -627,122 +622,120 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
});
break;
case 1:
if (typeof self.chipInfo.option_bytes === "undefined") {
console.log('Failed to detect option bytes');
self.upload_procedure(99);
}
if (typeof self.chipInfo.option_bytes === "undefined") {
console.log('Failed to detect option bytes');
self.upload_procedure(99);
}
var unprotect = function() {
console.log('Initiate read unprotect');
let messageReadProtected = i18n.getMessage('stm32ReadProtected');
GUI.log(messageReadProtected);
TABS.firmware_flasher.flashingMessage(messageReadProtected, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
var unprotect = function() {
console.log('Initiate read unprotect');
let messageReadProtected = i18n.getMessage('stm32ReadProtected');
GUI.log(messageReadProtected);
TABS.firmware_flasher.flashingMessage(messageReadProtected, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x92], function () { // 0x92 initiates read unprotect
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNBUSY) { // completely normal
var delay = data[1] | (data[2] << 8) | (data[3] << 16);
var total_delay = delay + 20000; // wait at least 20 seconds to make sure the user does not disconnect the board while erasing the memory
var timeSpentWaiting = 0;
var incr = 1000; // one sec increments
var waitForErase = setInterval(function () {
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, [0x92], function () { // 0x92 initiates read unprotect
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNBUSY) { // completely normal
var delay = data[1] | (data[2] << 8) | (data[3] << 16);
var total_delay = delay + 20000; // wait at least 20 seconds to make sure the user does not disconnect the board while erasing the memory
var timeSpentWaiting = 0;
var incr = 1000; // one sec increments
var waitForErase = setInterval(function () {
TABS.firmware_flasher.flashProgress(Math.min(timeSpentWaiting / total_delay, 1) * 100);
TABS.firmware_flasher.flashProgress(Math.min(timeSpentWaiting / total_delay, 1) * 100);
if(timeSpentWaiting < total_delay)
{
timeSpentWaiting += incr;
return;
}
clearInterval(waitForErase);
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data, error) { // should stall/disconnect
if(error) { // we encounter an error, but this is expected. should be a stall.
console.log('Unprotect memory command ran successfully. Unplug flight controller. Connect again in DFU mode and try flashing again.');
GUI.log(i18n.getMessage('stm32UnprotectSuccessful'));
if(timeSpentWaiting < total_delay) {
timeSpentWaiting += incr;
return;
}
clearInterval(waitForErase);
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data, error) { // should stall/disconnect
if(error) { // we encounter an error, but this is expected. should be a stall.
console.log('Unprotect memory command ran successfully. Unplug flight controller. Connect again in DFU mode and try flashing again.');
GUI.log(i18n.getMessage('stm32UnprotectSuccessful'));
let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
GUI.log(messageUnprotectUnplug);
let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
GUI.log(messageUnprotectUnplug);
TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
.flashProgress(0);
TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
.flashProgress(0);
} else { // unprotecting the flight controller did not work. It did not reboot.
console.log('Failed to execute unprotect memory command');
} else { // unprotecting the flight controller did not work. It did not reboot.
console.log('Failed to execute unprotect memory command');
GUI.log(i18n.getMessage('stm32UnprotectFailed'));
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32UnprotectFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
console.log(data);
self.upload_procedure(99);
}
}, 2000); // this should stall/disconnect anyways. so we only wait 2 sec max.
}, incr);
} else {
console.log('Failed to initiate unprotect memory command');
let messageUnprotectInitFailed = i18n.getMessage('stm32UnprotectInitFailed')
GUI.log(messageUnprotectInitFailed);
TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID)
self.upload_procedure(99);
}
});
});
}
GUI.log(i18n.getMessage('stm32UnprotectFailed'));
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32UnprotectFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
console.log(data);
self.upload_procedure(99);
}
}, 2000); // this should stall/disconnect anyways. so we only wait 2 sec max.
}, incr);
} else {
console.log('Failed to initiate unprotect memory command');
let messageUnprotectInitFailed = i18n.getMessage('stm32UnprotectInitFailed')
GUI.log(messageUnprotectInitFailed);
TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID)
self.upload_procedure(99);
}
});
});
}
var tryReadOB = function() {
// the following should fail if read protection is active
self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) {
if(errcode) {
console.log('USB transfer error while reading option bytes: ' + errcode1);
self.upload_procedure(99);
return;
}
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuUPLOAD_IDLE && ob_data.length == self.chipInfo.option_bytes.total_size) {
console.log('Option bytes read successfully');
console.log('Chip does not appear read protected');
GUI.log(i18n.getMessage('stm32NotReadProtected'));
// it is pretty safe to continue to erase flash
self.clearStatus(function() {
self.upload_procedure(2);
});
/* // this snippet is to protect the flash memory (only for the brave)
ob_data[1] = 0x0;
var writeOB = function() {
self.controlTransfer('out', self.request.DNLOAD, 2, 0, 0, ob_data, function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNBUSY) {
var delay = data[1] | (data[2] << 8) | (data[3] << 16);
var tryReadOB = function() {
// the following should fail if read protection is active
self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) {
if(errcode) {
console.log('USB transfer error while reading option bytes: ' + errcode1);
self.upload_procedure(99);
return;
}
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuUPLOAD_IDLE && ob_data.length == self.chipInfo.option_bytes.total_size) {
console.log('Option bytes read successfully');
console.log('Chip does not appear read protected');
GUI.log(i18n.getMessage('stm32NotReadProtected'));
// it is pretty safe to continue to erase flash
self.clearStatus(function() {
self.upload_procedure(2);
});
/* // this snippet is to protect the flash memory (only for the brave)
ob_data[1] = 0x0;
var writeOB = function() {
self.controlTransfer('out', self.request.DNLOAD, 2, 0, 0, ob_data, function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNBUSY) {
var delay = data[1] | (data[2] << 8) | (data[3] << 16);
setTimeout(function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNLOAD_IDLE) {
console.log('Failed to write ob');
self.upload_procedure(99);
} else {
console.log('Success writing ob');
self.upload_procedure(99);
}
});
}, delay);
} else {
console.log('Failed to initiate write ob');
self.upload_procedure(99);
}
});
});
}
self.clearStatus(function () {
self.loadAddress(self.chipInfo.option_bytes.start_address, function () {
self.clearStatus(writeOB);
});
}); // */
} else {
console.log('Option bytes could not be read. Quite possibly read protected.');
self.clearStatus(unprotect);
}
});
});
}
setTimeout(function () {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNLOAD_IDLE) {
console.log('Failed to write ob');
self.upload_procedure(99);
} else {
console.log('Success writing ob');
self.upload_procedure(99);
}
});
}, delay);
} else {
console.log('Failed to initiate write ob');
self.upload_procedure(99);
}
});
});
}
self.clearStatus(function () {
self.loadAddress(self.chipInfo.option_bytes.start_address, function () {
self.clearStatus(writeOB);
});
}); // */
} else {
console.log('Option bytes could not be read. Quite possibly read protected.');
self.clearStatus(unprotect);
}
});
});
}
var initReadOB = function (loadAddressResponse) {
// contrary to what is in the docs. Address load should in theory work even if read protection is active
@ -761,10 +754,10 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
}
}
self.clearStatus(function () {
// load address fails if read protection is active unlike as stated in the docs
self.loadAddress(self.chipInfo.option_bytes.start_address, initReadOB, false);
});
self.clearStatus(function () {
// load address fails if read protection is active unlike as stated in the docs
self.loadAddress(self.chipInfo.option_bytes.start_address, initReadOB, false);
});
break;
case 2:
// erase

View file

@ -76,7 +76,7 @@ TABS.firmware_flasher.initialize = function (callback) {
} else {
$('div.release_info #manufacturerInfo').hide();
}
}
}
$('div.release_info .target').text(targetName);
$('div.release_info .name').text(summary.version).prop('href', summary.releaseUrl);
$('div.release_info .date').text(summary.date);

View file

@ -869,8 +869,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
// set mode colors visibility
if (semver.gte(CONFIG.apiVersion, "1.20.0"))
if (activeFunction == "function-f")
$('.mode_colors').show();
if (activeFunction == "function-f")
$('.mode_colors').show();
// set special colors visibility
$('.special_colors').show();

View file

@ -1083,7 +1083,7 @@ TABS.pid_tuning.initialize = function (callback) {
if (!semver.gte(CONFIG.apiVersion, "1.16.0")) {
$('#pid-tuning .delta').hide();
$('.tab-pid_tuning .note').hide();
}
}
// Add a name to each row of PIDs if empty
$('.pid_tuning tr').each(function(){

View file

@ -440,11 +440,11 @@ TABS.power.initialize = function (callback) {
$('a.applycalibration').click(function() {
if (vbatscalechanged) {
self.analyticsChanges['PowerVBatUpdated'] = 'Calibrated';
}
}
if (amperagescalechanged) {
self.analyticsChanges['PowerAmperageUpdated'] = 'Calibrated';
}
}
calibrationconfirmed = true;
GUI.calibrationManagerConfirmation.close();

View file

@ -39,9 +39,9 @@ TABS.setup.initialize = function (callback) {
// initialize 3D Model
self.initModel();
// set roll in interactive block
// set roll in interactive block
$('span.roll').text(i18n.getMessage('initialSetupAttitude', [0]));
// set pitch in interactive block
// set pitch in interactive block
$('span.pitch').text(i18n.getMessage('initialSetupAttitude', [0]));
// set heading in interactive block
$('span.heading').text(i18n.getMessage('initialSetupAttitude', [0]));
@ -300,8 +300,8 @@ TABS.setup.initialize = function (callback) {
function get_fast_data() {
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
roll_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
pitch_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
roll_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
pitch_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
heading_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
self.renderModel();

View file

@ -37,73 +37,73 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
'ID 9': 'E083BFF00F9E38C0FF',
}
}, //arcitimer
3: {
dataType: dataTypes.LIST, // <select>...</select>
3: {
dataType: dataTypes.LIST, // <select>...</select>
dataOptions: {
'0':'00',
'1':'01',
'2':'02',
'3':'03',
'4':'04',
'5':'05',
'6':'06',
'7':'07',
'8':'08',
'9':'09',
'10':'0A',
'11':'0B',
'12':'0C',
'13':'0D',
'14':'0E',
'15':'0F',
'16':'10',
'17':'11',
'18':'12',
'19':'13',
'20':'14',
'21':'15',
'22':'16',
'23':'17',
'24':'18',
'25':'19',
'26':'1A',
'27':'1B',
'28':'1C',
'29':'1D',
'30':'1E',
'31':'1F',
'32':'20',
'33':'21',
'34':'22',
'35':'23',
'36':'24',
'37':'25',
'38':'26',
'39':'27',
'40':'28',
'41':'29',
'42':'2A',
'43':'2B',
'44':'2C',
'45':'2D',
'46':'2E',
'47':'2F',
'48':'30',
'49':'31',
'50':'32',
'51':'33',
'52':'34',
'53':'35',
'54':'36',
'55':'37',
'56':'38',
'57':'39',
'58':'3A',
'59':'3B',
'60':'3C',
'61':'3D',
'62':'3E',
'63':'3F',
'0':'00',
'1':'01',
'2':'02',
'3':'03',
'4':'04',
'5':'05',
'6':'06',
'7':'07',
'8':'08',
'9':'09',
'10':'0A',
'11':'0B',
'12':'0C',
'13':'0D',
'14':'0E',
'15':'0F',
'16':'10',
'17':'11',
'18':'12',
'19':'13',
'20':'14',
'21':'15',
'22':'16',
'23':'17',
'24':'18',
'25':'19',
'26':'1A',
'27':'1B',
'28':'1C',
'29':'1D',
'30':'1E',
'31':'1F',
'32':'20',
'33':'21',
'34':'22',
'35':'23',
'36':'24',
'37':'25',
'38':'26',
'39':'27',
'40':'28',
'41':'29',
'42':'2A',
'43':'2B',
'44':'2C',
'45':'2D',
'46':'2E',
'47':'2F',
'48':'30',
'49':'31',
'50':'32',
'51':'33',
'52':'34',
'53':'35',
'54':'36',
'55':'37',
'56':'38',
'57':'39',
'58':'3A',
'59':'3B',
'60':'3C',
'61':'3D',
'62':'3E',
'63':'3F',
}
}, //ERLT
};