diff --git a/src/js/backup_restore.js b/src/js/backup_restore.js
index 19bb060d..9edbb656 100644
--- a/src/js/backup_restore.js
+++ b/src/js/backup_restore.js
@@ -16,7 +16,7 @@ function configuration_backup(callback) {
'apiVersion': CONFIG.apiVersion,
'profiles': [],
};
-
+
var profileSpecificData = [
MSPCodes.MSP_PID_CONTROLLER,
MSPCodes.MSP_PID,
@@ -35,7 +35,7 @@ function configuration_backup(callback) {
profileSpecificData.push(MSPCodes.MSP_RC_DEADBAND);
}
}
-
+
update_profile_specific_data_list();
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
@@ -127,12 +127,12 @@ function configuration_backup(callback) {
uniqueData.push(MSPCodes.MSP_MODE_RANGES_EXTRA);
}
}
-
+
update_unique_data_list();
function fetch_unique_data() {
var codeKey = 0;
-
+
function fetch_unique_data_item() {
if (codeKey < uniqueData.length) {
MSP.send_message(uniqueData[codeKey], false, false, function () {
@@ -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);
@@ -280,7 +280,7 @@ function configuration_backup(callback) {
}
}
-
+
function configuration_restore(callback) {
var chosenFileEntry = null;
@@ -334,7 +334,7 @@ function configuration_restore(callback) {
// validate
- if (typeof configuration.generatedBy !== 'undefined' && compareVersions(configuration.generatedBy, CONFIGURATOR.backupFileMinVersionAccepted)) {
+ if (typeof configuration.generatedBy !== 'undefined' && compareVersions(configuration.generatedBy, CONFIGURATOR.backupFileMinVersionAccepted)) {
if (!compareVersions(configuration.generatedBy, "1.14.0") && !migrate(configuration)) {
GUI.log(i18n.getMessage('backupFileUnmigratable'));
return;
@@ -364,38 +364,38 @@ function configuration_restore(callback) {
}
return semver.gte(generated, required);
}
-
+
function migrate(configuration) {
var appliedMigrationsCount = 0;
var migratedVersion = configuration.generatedBy;
GUI.log(i18n.getMessage('configMigrationFrom', [migratedVersion]));
-
+
if (!compareVersions(migratedVersion, '0.59.1')) {
-
+
// variable was renamed
configuration.RSSI_CONFIG.channel = configuration.MISC.rssi_aux_channel;
configuration.MISC.rssi_aux_channel = undefined;
-
+
migratedVersion = '0.59.1';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (!compareVersions(migratedVersion, '0.60.1')) {
-
+
// LED_STRIP support was added.
if (!configuration.LED_STRIP) {
configuration.LED_STRIP = [];
}
-
+
migratedVersion = '0.60.1';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (!compareVersions(migratedVersion, '0.61.0')) {
-
+
// Changing PID controller via UI was added.
if (!configuration.PIDs && configuration.PID) {
configuration.PIDs = configuration.PID;
@@ -403,14 +403,14 @@ function configuration_restore(callback) {
controller: 0 // assume pid controller 0 was used.
};
}
-
+
migratedVersion = '0.61.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
if (!compareVersions(migratedVersion, '0.63.0')) {
-
+
// LED Strip was saved as object instead of array.
if (typeof(configuration.LED_STRIP) == 'object') {
var fixed_led_strip = [];
@@ -422,19 +422,18 @@ 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
if (!RC.dynamic_THR_breakpoint) {
RC.dynamic_THR_breakpoint = 1500; // firmware default
}
-
+
// Roll and pitch rates were split
RC.roll_rate = RC.roll_pitch_rate;
RC.pitch_rate = RC.roll_pitch_rate;
}
-
+
migratedVersion = '0.63.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
@@ -464,17 +463,17 @@ function configuration_restore(callback) {
telemetry_baudrate: 'AUTO',
blackbox_baudrate: '115200',
};
-
+
switch(oldPort.scenario) {
case 1: // MSP, CLI, TELEMETRY, SMARTPORT TELEMETRY, GPS-PASSTHROUGH
case 5: // MSP, CLI, GPS-PASSTHROUGH
case 8: // MSP ONLY
newPort.functions.push('MSP');
break;
- case 2: // GPS
+ case 2: // GPS
newPort.functions.push('GPS');
break;
- case 3: // RX_SERIAL
+ case 3: // RX_SERIAL
newPort.functions.push('RX_SERIAL');
break;
case 10: // BLACKBOX ONLY
@@ -485,20 +484,20 @@ function configuration_restore(callback) {
newPort.functions.push('BLACKBOX');
break;
}
-
+
ports.push(newPort);
}
- configuration.SERIAL_CONFIG = {
- ports: ports
+ configuration.SERIAL_CONFIG = {
+ ports: ports
};
-
+
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (compareVersions(migratedVersion, '0.63.0') && !compareVersions(configuration.apiVersion, '1.8.0')) {
// api 1.8 exposes looptime and arming config
-
+
if (configuration.FC_CONFIG == undefined) {
configuration.FC_CONFIG = {
loopTime: 3500
@@ -515,7 +514,7 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (compareVersions(migratedVersion, '0.63.0')) {
// backups created with 0.63.0 for firmwares with api < 1.8 were saved with incorrect looptime
if (configuration.FC_CONFIG.loopTime == 0) {
@@ -523,25 +522,25 @@ function configuration_restore(callback) {
configuration.FC_CONFIG.loopTime = 3500;
}
}
-
+
if (semver.lt(migratedVersion, '0.66.0')) {
// api 1.12 updated servo configuration protocol and added servo mixer rules
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
-
+
if (semver.eq(configuration.apiVersion, '1.10.0')) {
// drop two unused servo configurations
while (configuration.profiles[profileIndex].ServoConfig.length > 8) {
configuration.profiles[profileIndex].ServoConfig.pop();
- }
+ }
}
-
+
for (var i = 0; i < configuration.profiles[profileIndex].ServoConfig.length; i++) {
var servoConfig = profiles[profileIndex].ServoConfig;
-
+
servoConfig[i].angleAtMin = 45;
servoConfig[i].angleAtMax = 45;
servoConfig[i].reversedInputSources = 0;
-
+
// set the rate to 0 if an invalid value is detected.
if (servoConfig[i].rate < -100 || servoConfig[i].rate > 100) {
servoConfig[i].rate = 0;
@@ -550,21 +549,21 @@ function configuration_restore(callback) {
configuration.profiles[profileIndex].ServoRules = [];
}
-
+
migratedVersion = '0.66.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (semver.lt(configuration.apiVersion, '1.14.0') && semver.gte(CONFIG.apiVersion, "1.14.0")) {
// api 1.14 removed old pid controllers
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
var newPidControllerIndex = configuration.profiles[profileIndex].PID.controller;
switch (newPidControllerIndex) {
- case 3:
- case 4:
- case 5:
+ case 3:
+ case 4:
+ case 5:
newPidControllerIndex = 0;
break;
}
@@ -574,11 +573,11 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
+
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.14.0')) {
// api 1.14 exposes 3D configuration
-
+
if (configuration.MOTOR_3D_CONFIG == undefined) {
configuration.MOTOR_3D_CONFIG = {
deadband3d_low: 1406,
@@ -591,19 +590,18 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
-
-
+
+
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 = {
deadband: 0,
yaw_deadband: 0,
alt_hold_deadband: 40,
- };
+ };
}
}
if (configuration.SENSOR_ALIGNMENT == undefined) {
@@ -611,9 +609,9 @@ function configuration_restore(callback) {
align_gyro: 0,
align_acc: 0,
align_mag: 0
- };
+ };
}
-
+
// api 1.15 exposes RX_CONFIG, FAILSAFE_CONFIG and RXFAIL_CONFIG configuration
if (configuration.RX_CONFIG == undefined) {
@@ -672,7 +670,7 @@ function configuration_restore(callback) {
}
if (compareVersions(migratedVersion, '1.3.1')) {
-
+
// LED_COLORS & LED_MODE_COLORS support was added.
if (!configuration.LED_COLORS) {
configuration.LED_COLORS = [];
@@ -689,10 +687,10 @@ function configuration_restore(callback) {
if (appliedMigrationsCount > 0) {
GUI.log(i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
- }
+ }
return true;
}
-
+
function configuration_upload(configuration, callback) {
function upload() {
var activeProfile = null;
@@ -787,10 +785,10 @@ function configuration_restore(callback) {
MODE_RANGES_EXTRA = configuration.MODE_RANGES_EXTRA;
}
}
-
+
mspHelper.sendModeRanges(upload_adjustment_ranges);
}
-
+
function upload_adjustment_ranges() {
mspHelper.sendAdjustmentRanges(upload_using_specific_commands);
}
@@ -806,7 +804,7 @@ function configuration_restore(callback) {
MSPCodes.MSP_SET_RX_MAP,
MSPCodes.MSP_SET_CF_SERIAL_CONFIG
];
-
+
function update_unique_data_list() {
uniqueData.push(MSPCodes.MSP_SET_NAME);
uniqueData.push(MSPCodes.MSP_SET_SENSOR_CONFIG);
@@ -828,14 +826,14 @@ 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);
}
}
-
+
function load_objects() {
MISC = configuration.MISC;
RC_MAP = configuration.RCMAP;
@@ -902,7 +900,7 @@ function configuration_restore(callback) {
else
send_rxfail_config();
}
-
+
function send_rxfail_config() {
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
mspHelper.sendRxFailConfig(save_to_eeprom);
diff --git a/src/js/protocols/stm32usbdfu.js b/src/js/protocols/stm32usbdfu.js
index 0e6d9829..2a5ec6df 100644
--- a/src/js/protocols/stm32usbdfu.js
+++ b/src/js/protocols/stm32usbdfu.js
@@ -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();
});
}
@@ -343,7 +343,7 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
// H750 Partitions: Flash, Config, Firmware, 1x BB Management block + x BB Replacement blocks)
if (str == "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka") {
- str = "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka"
+ str = "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka"
}
// split main into [location, start_addr, sectors]
@@ -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);
@@ -572,15 +567,15 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
if (typeof chipInfo.internal_flash !== "undefined") {
// internal flash
self.chipInfo = chipInfo;
-
+
self.flash_layout = chipInfo.internal_flash;
self.available_flash_size = self.flash_layout.total_size - (self.hex.start_linear_address - self.flash_layout.start_address);
-
+
GUI.log(i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
-
+
if (self.hex.bytes_total > self.available_flash_size) {
- GUI.log(i18n.getMessage('dfu_error_image_size',
- [(self.hex.bytes_total / 1024.0).toFixed(1),
+ GUI.log(i18n.getMessage('dfu_error_image_size',
+ [(self.hex.bytes_total / 1024.0).toFixed(1),
(self.available_flash_size / 1024.0).toFixed(1)]));
self.upload_procedure(99);
} else {
@@ -596,7 +591,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
// external flash, flash to the 3rd partition.
self.chipInfo = chipInfo;
self.flash_layout = chipInfo.external_flash;
-
+
var firmware_partition_index = 2;
var firmware_sectors = self.flash_layout.sectors[firmware_partition_index];
var firmware_partition_size = firmware_sectors.total_size;
@@ -606,8 +601,8 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
GUI.log(i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
if (self.hex.bytes_total > self.available_flash_size) {
- GUI.log(i18n.getMessage('dfu_error_image_size',
- [(self.hex.bytes_total / 1024.0).toFixed(1),
+ GUI.log(i18n.getMessage('dfu_error_image_size',
+ [(self.hex.bytes_total / 1024.0).toFixed(1),
(self.available_flash_size / 1024.0).toFixed(1)]));
self.upload_procedure(99);
} else {
@@ -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'));
-
- let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
- GUI.log(messageUnprotectUnplug);
+ 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'));
- TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
- .flashProgress(0);
+ let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
+ GUI.log(messageUnprotectUnplug);
- } 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);
- }
- });
- });
- }
+ 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');
- 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);
+ 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);
+ }
+ });
+ });
+ }
- 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 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);
+ }
+ });
+ });
+ }
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
@@ -795,7 +788,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
}
}
}
-
+
if (erase_pages.length === 0) {
console.log('Aborting, No flash pages to erase');
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32InvalidHex'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
@@ -805,17 +798,17 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32Erase'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
- console.log('Executing local chip erase', erase_pages);
+ console.log('Executing local chip erase', erase_pages);
var page = 0;
var total_erased = 0; // bytes
var erase_page = function() {
- var page_addr = erase_pages[page].page * self.flash_layout.sectors[erase_pages[page].sector].page_size +
+ var page_addr = erase_pages[page].page * self.flash_layout.sectors[erase_pages[page].sector].page_size +
self.flash_layout.sectors[erase_pages[page].sector].start_address;
var cmd = [0x41, page_addr & 0xff, (page_addr >> 8) & 0xff, (page_addr >> 16) & 0xff, (page_addr >> 24) & 0xff];
total_erased += self.flash_layout.sectors[erase_pages[page].sector].page_size;
- console.log('Erasing. sector ' + erase_pages[page].sector +
+ console.log('Erasing. sector ' + erase_pages[page].sector +
', page ' + erase_pages[page].page + ' @ 0x' + page_addr.toString(16));
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, cmd, function () {
diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js
index 4a0f2882..9758f746 100644
--- a/src/js/tabs/firmware_flasher.js
+++ b/src/js/tabs/firmware_flasher.js
@@ -32,8 +32,8 @@ TABS.firmware_flasher.initialize = function (callback) {
/**
* Change boldness of firmware option depending on cache status
- *
- * @param {Descriptor} release
+ *
+ * @param {Descriptor} release
*/
function onFirmwareCacheUpdate(release) {
$("option[value='{0}']".format(release.version))
@@ -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);
@@ -113,8 +113,8 @@ TABS.firmware_flasher.initialize = function (callback) {
function onLoadSuccess(data, summary) {
self.localFirmwareLoaded = false;
// The path from getting a firmware doesn't fill in summary.
- summary = typeof summary === "object"
- ? summary
+ summary = typeof summary === "object"
+ ? summary
: $('select[name="firmware_version"] option:selected').data('summary');
process_hex(data, summary);
$("a.load_remote_file").removeClass('disabled');
@@ -1054,14 +1054,14 @@ TABS.firmware_flasher.enableFlashing = function (enabled) {
}
}
-TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
- VALID : 'VALID',
+TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
+ VALID : 'VALID',
INVALID : 'INVALID',
ACTION : 'ACTION'};
TABS.firmware_flasher.flashingMessage = function(message, type) {
let self = this;
-
+
let progressLabel_e = $('span.progressLabel');
switch (type) {
case self.FLASH_MESSAGE_TYPES.VALID:
diff --git a/src/js/tabs/led_strip.js b/src/js/tabs/led_strip.js
index c8ee096a..43ba635b 100644
--- a/src/js/tabs/led_strip.js
+++ b/src/js/tabs/led_strip.js
@@ -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();
diff --git a/src/js/tabs/onboard_logging.js b/src/js/tabs/onboard_logging.js
index 4296a6e5..59b64fa1 100644
--- a/src/js/tabs/onboard_logging.js
+++ b/src/js/tabs/onboard_logging.js
@@ -12,7 +12,7 @@ TABS.onboard_logging = {
VCP_BLOCK_SIZE: 4096
};
TABS.onboard_logging.initialize = function (callback) {
- var
+ var
self = this,
saveCancelled, eraseCancelled;
@@ -25,7 +25,7 @@ TABS.onboard_logging.initialize = function (callback) {
MSP.send_message(MSPCodes.MSP_FEATURE_CONFIG, false, false, function() {
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() {
MSP.send_message(MSPCodes.MSP_SDCARD_SUMMARY, false, false, function() {
- MSP.send_message(MSPCodes.MSP_BLACKBOX_CONFIG, false, false, function() {
+ MSP.send_message(MSPCodes.MSP_BLACKBOX_CONFIG, false, false, function() {
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, function() {
MSP.send_message(MSPCodes.MSP_NAME, false, false, load_html);
});
@@ -34,14 +34,14 @@ TABS.onboard_logging.initialize = function (callback) {
});
});
}
-
+
function gcd(a, b) {
if (b === 0)
return a;
-
+
return gcd(b, a % b);
}
-
+
function save_to_eeprom() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
}
@@ -54,19 +54,19 @@ TABS.onboard_logging.initialize = function (callback) {
reinitialiseConnection(self);
});
}
-
+
function load_html() {
$('#content').load("./tabs/onboard_logging.html", function() {
// translate to user-selected language
i18n.localizePage();
-
- var
+
+ var
dataflashPresent = DATAFLASH.totalSize > 0,
blackboxSupport;
-
- /*
+
+ /*
* Pre-1.11.0 firmware supported DATAFLASH API (on targets with SPI flash) but not the BLACKBOX config API.
- *
+ *
* The best we can do on those targets is check the BLACKBOX feature bit to identify support for Blackbox instead.
*/
if ((BLACKBOX.supported || DATAFLASH.supported) && (semver.gte(CONFIG.apiVersion, "1.33.0") || FEATURE_CONFIG.features.isEnabled('BLACKBOX'))) {
@@ -74,14 +74,14 @@ TABS.onboard_logging.initialize = function (callback) {
} else {
blackboxSupport = 'no';
}
-
+
$(".tab-onboard_logging")
.addClass("serial-supported")
.toggleClass("dataflash-supported", DATAFLASH.supported)
.toggleClass("dataflash-present", dataflashPresent)
.toggleClass("sdcard-supported", SDCARD.supported)
.toggleClass("blackbox-config-supported", BLACKBOX.supported)
-
+
.toggleClass("blackbox-supported", blackboxSupport === 'yes')
.toggleClass("blackbox-maybe-supported", blackboxSupport === 'maybe')
.toggleClass("blackbox-unsupported", blackboxSupport === 'no');
@@ -89,10 +89,10 @@ TABS.onboard_logging.initialize = function (callback) {
if (dataflashPresent) {
// UI hooks
$('.tab-onboard_logging a.erase-flash').click(ask_to_erase_flash);
-
+
$('.tab-onboard_logging a.erase-flash-confirm').click(flash_erase);
$('.tab-onboard_logging a.erase-flash-cancel').click(flash_erase_cancel);
-
+
$('.tab-onboard_logging a.save-flash').click(flash_save_begin);
$('.tab-onboard_logging a.save-flash-cancel').click(flash_save_cancel);
$('.tab-onboard_logging a.save-flash-dismiss').click(dismiss_saving_dialog);
@@ -119,7 +119,7 @@ TABS.onboard_logging.initialize = function (callback) {
MSP.send_message(MSPCodes.MSP_SET_BLACKBOX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BLACKBOX_CONFIG), false, save_to_eeprom);
});
}
-
+
populateLoggingRates(loggingRatesSelect);
populateDevices(deviceSelect);
populateDebugModes(debugModeSelect);
@@ -157,13 +157,13 @@ TABS.onboard_logging.initialize = function (callback) {
});
}
}
-
+
update_html();
-
+
GUI.content_ready(callback);
});
}
-
+
function populateDevices(deviceSelect) {
deviceSelect.empty();
@@ -188,9 +188,9 @@ TABS.onboard_logging.initialize = function (callback) {
deviceSelect.val(BLACKBOX.blackboxDevice);
}
-
+
function populateLoggingRates(loggingRatesSelect) {
-
+
// Offer a reasonable choice of logging rates (if people want weird steps they can use CLI)
var loggingRates = [];
var pidRateBase = 8000;
@@ -199,8 +199,8 @@ TABS.onboard_logging.initialize = function (callback) {
pidRateBase = 32000;
}
- var pidRate = pidRateBase / PID_ADVANCED_CONFIG.gyro_sync_denom /
- PID_ADVANCED_CONFIG.pid_process_denom;
+ var pidRate = pidRateBase / PID_ADVANCED_CONFIG.gyro_sync_denom /
+ PID_ADVANCED_CONFIG.pid_process_denom;
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
loggingRates = [
@@ -210,9 +210,9 @@ TABS.onboard_logging.initialize = function (callback) {
{text: "1.5 kHz", hz: 1500, p_denom: 48},
{text: "2 kHz", hz: 2000, p_denom: 64},
{text: "4 kHz", hz: 4000, p_denom: 128},
- {text: "8 kHz", hz: 8000, p_denom: 256},
+ {text: "8 kHz", hz: 8000, p_denom: 256},
{text: "16 kHz", hz: 16000, p_denom: 512},
- {text: "32 kHz", hz: 32000, p_denom: 1024},
+ {text: "32 kHz", hz: 32000, p_denom: 1024},
];
$.each(loggingRates, function(index, item) {
@@ -237,19 +237,19 @@ TABS.onboard_logging.initialize = function (callback) {
{num: 1, denom: 32}
];
-
+
for (var i = 0; i < loggingRates.length; i++) {
var loggingRate = Math.round(pidRate / loggingRates[i].denom);
var loggingRateUnit = " Hz";
if (loggingRate !== Infinity) {
if (gcd(loggingRate, 1000) === 1000) {
loggingRate /= 1000;
- loggingRateUnit = " KHz";
+ loggingRateUnit = " KHz";
}
}
- loggingRatesSelect.append('');
-
+
}
loggingRatesSelect.val(BLACKBOX.blackboxRateNum + '/' + BLACKBOX.blackboxRateDenom);
}
@@ -337,39 +337,39 @@ TABS.onboard_logging.initialize = function (callback) {
$('.blackboxDebugMode').hide();
}
}
-
+
function formatFilesizeKilobytes(kilobytes) {
if (kilobytes < 1024) {
return Math.round(kilobytes) + "kB";
}
-
- var
+
+ var
megabytes = kilobytes / 1024,
gigabytes;
-
+
if (megabytes < 900) {
return megabytes.toFixed(1) + "MB";
} else {
gigabytes = megabytes / 1024;
-
+
return gigabytes.toFixed(1) + "GB";
}
}
-
+
function formatFilesizeBytes(bytes) {
if (bytes < 1024) {
return bytes + "B";
}
return formatFilesizeKilobytes(bytes / 1024);
}
-
+
function update_bar_width(bar, value, total, label, valuesAreKilobytes) {
if (value > 0) {
bar.css({
width: (value / total * 100) + "%",
display: 'block'
});
-
+
$("div", bar).text((label ? label + " " : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value)));
} else {
bar.css({
@@ -377,7 +377,7 @@ TABS.onboard_logging.initialize = function (callback) {
});
}
}
-
+
function update_html() {
var dataflashPresent = DATAFLASH.totalSize > 0;
@@ -388,7 +388,7 @@ TABS.onboard_logging.initialize = function (callback) {
update_bar_width($(".tab-onboard_logging .sdcard-free"), SDCARD.freeSizeKB, SDCARD.totalSizeKB, i18n.getMessage('dataflashLogsSpace'), true);
$(".btn a.erase-flash, .btn a.save-flash").toggleClass("disabled", DATAFLASH.usedSize === 0);
-
+
$(".tab-onboard_logging")
.toggleClass("sdcard-error", SDCARD.state === MSP.SDCARD_STATE_FATAL)
.toggleClass("sdcard-initializing", SDCARD.state === MSP.SDCARD_STATE_CARD_INIT || SDCARD.state === MSP.SDCARD_STATE_FS_INIT)
@@ -405,7 +405,7 @@ TABS.onboard_logging.initialize = function (callback) {
$('a.onboardLoggingRebootMsc').removeClass('disabled');
}
}
-
+
var loggingStatus
switch (SDCARD.state) {
case MSP.SDCARD_STATE_NOT_PRESENT:
@@ -431,7 +431,7 @@ TABS.onboard_logging.initialize = function (callback) {
default:
$(".sdcard-status").text(i18n.getMessage('sdcardStatusUnknown',[SDCARD.state]));
}
-
+
if (dataflashPresent && SDCARD.state === MSP.SDCARD_STATE_NOT_PRESENT) {
loggingStatus = 'Dataflash';
analytics.setFlightControllerData(analytics.DATA.LOG_SIZE, DATAFLASH.usedSize);
@@ -450,24 +450,24 @@ TABS.onboard_logging.initialize = function (callback) {
}, 2000);
}
}
-
+
// IO related methods
function flash_save_cancel() {
saveCancelled = true;
}
-
+
function show_saving_dialog() {
$(".dataflash-saving progress").attr("value", 0);
saveCancelled = false;
$(".dataflash-saving").removeClass("done");
-
+
$(".dataflash-saving")[0].showModal();
}
-
+
function dismiss_saving_dialog() {
$(".dataflash-saving")[0].close();
}
-
+
function mark_saving_dialog_done(startTime, totalBytes, totalBytesCompressed) {
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash');
@@ -480,17 +480,17 @@ TABS.onboard_logging.initialize = function (callback) {
$(".dataflash-saving").addClass("done");
}
-
+
function flash_update_summary(onDone) {
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() {
update_html();
-
+
if (onDone) {
onDone();
}
});
}
-
+
function flash_save_begin() {
if (GUI.connected_to) {
if (FC.boardHasVcp()) {
@@ -506,13 +506,13 @@ TABS.onboard_logging.initialize = function (callback) {
// Begin by refreshing the occupied size in case it changed while the tab was open
flash_update_summary(function() {
var maxBytes = DATAFLASH.usedSize;
-
+
prepare_file(function(fileWriter) {
var nextAddress = 0;
var totalBytesCompressed = 0;
-
+
show_saving_dialog();
-
+
function onChunkRead(chunkAddress, chunkDataView, bytesCompressed) {
if (chunkDataView !== null) {
// Did we receive any data?
@@ -523,11 +523,11 @@ TABS.onboard_logging.initialize = function (callback) {
} else {
totalBytesCompressed += bytesCompressed;
}
-
+
$(".dataflash-saving progress").attr("value", nextAddress / maxBytes * 100);
var blob = new Blob([chunkDataView]);
-
+
fileWriter.onwriteend = function(e) {
if (saveCancelled || nextAddress >= maxBytes) {
if (saveCancelled) {
@@ -543,7 +543,7 @@ TABS.onboard_logging.initialize = function (callback) {
}
}
};
-
+
fileWriter.write(blob);
} else {
// A zero-byte block indicates end-of-file, so we're done
@@ -562,27 +562,27 @@ TABS.onboard_logging.initialize = function (callback) {
});
}
}
-
+
function prepare_file(onComplete) {
-
+
var prefix = 'BLACKBOX_LOG';
var suffix = 'BBL';
var filename = generateFilename(prefix, suffix);
- chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename,
+ chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename,
accepts: [{description: suffix.toUpperCase() + ' files', extensions: [suffix]}]}, function(fileEntry) {
var error = chrome.runtime.lastError;
-
+
if (error) {
console.error(error.message);
-
+
if (error.message !== "User cancelled") {
GUI.log(i18n.getMessage('dataflashFileWriteFailed'));
}
return;
}
-
+
// echo/console log path specified
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
console.log('Dataflash dump file path: ' + path);
@@ -591,7 +591,7 @@ TABS.onboard_logging.initialize = function (callback) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) {
GUI.log('' + i18n.getMessage('error', { errorMessage: e.target.error.message }) + '');
-
+
console.error(e);
// stop logging if the procedure was/is still running
@@ -606,12 +606,12 @@ TABS.onboard_logging.initialize = function (callback) {
});
});
}
-
+
function ask_to_erase_flash() {
eraseCancelled = false;
$(".dataflash-confirm-erase").removeClass('erasing');
- $(".dataflash-confirm-erase")[0].showModal();
+ $(".dataflash-confirm-erase")[0].showModal();
}
function poll_for_erase_completion() {
@@ -625,13 +625,13 @@ TABS.onboard_logging.initialize = function (callback) {
}
});
}
-
+
function flash_erase() {
$(".dataflash-confirm-erase").addClass('erasing');
-
+
MSP.send_message(MSPCodes.MSP_DATAFLASH_ERASE, false, false, poll_for_erase_completion);
}
-
+
function flash_erase_cancel() {
eraseCancelled = true;
$(".dataflash-confirm-erase")[0].close();
@@ -646,7 +646,7 @@ TABS.onboard_logging.cleanup = function (callback) {
clearTimeout(sdcardTimer);
sdcardTimer = false;
}
-
+
if (callback) {
callback();
}
diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js
index c4ceb19f..1164aceb 100644
--- a/src/js/tabs/pid_tuning.js
+++ b/src/js/tabs/pid_tuning.js
@@ -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(){
@@ -1312,9 +1312,9 @@ TABS.pid_tuning.initialize = function (callback) {
return;
}
- /*
- Quadratic curve formula taken from:
- https://stackoverflow.com/a/9195706/176210
+ /*
+ Quadratic curve formula taken from:
+ https://stackoverflow.com/a/9195706/176210
*/
function getQBezierValue(t, p1, p2, p3) {
@@ -1349,7 +1349,7 @@ TABS.pid_tuning.initialize = function (callback) {
return;
}
- throttleCurve.width = throttleCurve.height *
+ throttleCurve.width = throttleCurve.height *
(throttleCurve.clientWidth / throttleCurve.clientHeight);
var canvasHeight = throttleCurve.height;
diff --git a/src/js/tabs/power.js b/src/js/tabs/power.js
index 8d46aed3..6c8c92db 100644
--- a/src/js/tabs/power.js
+++ b/src/js/tabs/power.js
@@ -263,7 +263,7 @@ TABS.power.initialize = function (callback) {
if (haveFc) {
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeVirtual'));
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeEsc'));
-
+
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
}
@@ -390,7 +390,7 @@ TABS.power.initialize = function (callback) {
$('.srcchange').hide();
}
});
-
+
$('input[name="vbatcalibration"]').val(0);
$('input[name="amperagecalibration"]').val(0);
@@ -413,7 +413,7 @@ TABS.power.initialize = function (callback) {
var amperageoffset = CURRENT_METER_CONFIGS[ampsource - 1].offset / 1000;
if (amperagecalibration != 0) {
if (CURRENT_METERS[ampsource - 1].amperage != amperageoffset && amperagecalibration != amperageoffset) {
- var amperagenewscale = Math.round(CURRENT_METER_CONFIGS[ampsource - 1].scale *
+ var amperagenewscale = Math.round(CURRENT_METER_CONFIGS[ampsource - 1].scale *
((CURRENT_METERS[ampsource - 1].amperage - amperageoffset) / (amperagecalibration - amperageoffset)));
if (amperagenewscale > -16000 && amperagenewscale < 16000 && amperagenewscale != 0) {
CURRENT_METER_CONFIGS[ampsource - 1].scale = amperagenewscale;
@@ -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();
@@ -454,7 +454,7 @@ TABS.power.initialize = function (callback) {
$('a.discardcalibration').click(function() {
GUI.calibrationManagerConfirmation.close();
- });
+ });
} else {
GUI.calibrationManagerConfirmation.close();
}
diff --git a/src/js/tabs/setup.js b/src/js/tabs/setup.js
index bbca8661..e7d5aa00 100644
--- a/src/js/tabs/setup.js
+++ b/src/js/tabs/setup.js
@@ -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]));
@@ -202,10 +202,10 @@ TABS.setup.initialize = function (callback) {
// We add all the arming/disarming flags available, and show/hide them if needed.
var prepareDisarmFlags = function() {
- var disarmFlagElements = ['NO_GYRO',
- 'FAILSAFE',
- 'RX_FAILSAFE',
- 'BAD_RX_RECOVERY',
+ var disarmFlagElements = ['NO_GYRO',
+ 'FAILSAFE',
+ 'RX_FAILSAFE',
+ 'BAD_RX_RECOVERY',
'BOXFAILSAFE',
'THROTTLE',
'ANGLE',
@@ -221,7 +221,7 @@ TABS.setup.initialize = function (callback) {
];
if (semver.gte(CONFIG.apiVersion, "1.38.0")) {
- disarmFlagElements.splice(disarmFlagElements.indexOf('THROTTLE'), 0, 'RUNAWAY_TAKEOFF');
+ disarmFlagElements.splice(disarmFlagElements.indexOf('THROTTLE'), 0, 'RUNAWAY_TAKEOFF');
}
if (semver.gte(CONFIG.apiVersion, "1.39.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();
diff --git a/src/js/tabs/transponder.js b/src/js/tabs/transponder.js
index dee2e83f..1bb892ae 100644
--- a/src/js/tabs/transponder.js
+++ b/src/js/tabs/transponder.js
@@ -37,73 +37,73 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
'ID 9': 'E083BFF00F9E38C0FF',
}
}, //arcitimer
- 3: {
- dataType: dataTypes.LIST, //
+ 3: {
+ dataType: dataTypes.LIST, //
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
};