1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 04:45:20 +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

@ -16,7 +16,7 @@ function configuration_backup(callback) {
'apiVersion': CONFIG.apiVersion, 'apiVersion': CONFIG.apiVersion,
'profiles': [], 'profiles': [],
}; };
var profileSpecificData = [ var profileSpecificData = [
MSPCodes.MSP_PID_CONTROLLER, MSPCodes.MSP_PID_CONTROLLER,
MSPCodes.MSP_PID, MSPCodes.MSP_PID,
@ -35,7 +35,7 @@ function configuration_backup(callback) {
profileSpecificData.push(MSPCodes.MSP_RC_DEADBAND); profileSpecificData.push(MSPCodes.MSP_RC_DEADBAND);
} }
} }
update_profile_specific_data_list(); update_profile_specific_data_list();
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () { MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
@ -127,12 +127,12 @@ function configuration_backup(callback) {
uniqueData.push(MSPCodes.MSP_MODE_RANGES_EXTRA); uniqueData.push(MSPCodes.MSP_MODE_RANGES_EXTRA);
} }
} }
update_unique_data_list(); update_unique_data_list();
function fetch_unique_data() { function fetch_unique_data() {
var codeKey = 0; var codeKey = 0;
function fetch_unique_data_item() { function fetch_unique_data_item() {
if (codeKey < uniqueData.length) { if (codeKey < uniqueData.length) {
MSP.send_message(uniqueData[codeKey], false, false, function () { MSP.send_message(uniqueData[codeKey], false, false, function () {
@ -168,7 +168,7 @@ function configuration_backup(callback) {
configuration.RXFAIL_CONFIG = jQuery.extend(true, [], RXFAIL_CONFIG); configuration.RXFAIL_CONFIG = jQuery.extend(true, [], RXFAIL_CONFIG);
} }
if (semver.gte(CONFIG.apiVersion, "1.33.0")) { 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.FEATURE_CONFIG = jQuery.extend(true, {}, FEATURE_CONFIG);
configuration.MOTOR_CONFIG = jQuery.extend(true, {}, MOTOR_CONFIG); configuration.MOTOR_CONFIG = jQuery.extend(true, {}, MOTOR_CONFIG);
configuration.GPS_CONFIG = jQuery.extend(true, {}, GPS_CONFIG); configuration.GPS_CONFIG = jQuery.extend(true, {}, GPS_CONFIG);
@ -280,7 +280,7 @@ function configuration_backup(callback) {
} }
} }
function configuration_restore(callback) { function configuration_restore(callback) {
var chosenFileEntry = null; var chosenFileEntry = null;
@ -334,7 +334,7 @@ function configuration_restore(callback) {
// validate // 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)) { if (!compareVersions(configuration.generatedBy, "1.14.0") && !migrate(configuration)) {
GUI.log(i18n.getMessage('backupFileUnmigratable')); GUI.log(i18n.getMessage('backupFileUnmigratable'));
return; return;
@ -364,38 +364,38 @@ function configuration_restore(callback) {
} }
return semver.gte(generated, required); return semver.gte(generated, required);
} }
function migrate(configuration) { function migrate(configuration) {
var appliedMigrationsCount = 0; var appliedMigrationsCount = 0;
var migratedVersion = configuration.generatedBy; var migratedVersion = configuration.generatedBy;
GUI.log(i18n.getMessage('configMigrationFrom', [migratedVersion])); GUI.log(i18n.getMessage('configMigrationFrom', [migratedVersion]));
if (!compareVersions(migratedVersion, '0.59.1')) { if (!compareVersions(migratedVersion, '0.59.1')) {
// variable was renamed // variable was renamed
configuration.RSSI_CONFIG.channel = configuration.MISC.rssi_aux_channel; configuration.RSSI_CONFIG.channel = configuration.MISC.rssi_aux_channel;
configuration.MISC.rssi_aux_channel = undefined; configuration.MISC.rssi_aux_channel = undefined;
migratedVersion = '0.59.1'; migratedVersion = '0.59.1';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (!compareVersions(migratedVersion, '0.60.1')) { if (!compareVersions(migratedVersion, '0.60.1')) {
// LED_STRIP support was added. // LED_STRIP support was added.
if (!configuration.LED_STRIP) { if (!configuration.LED_STRIP) {
configuration.LED_STRIP = []; configuration.LED_STRIP = [];
} }
migratedVersion = '0.60.1'; migratedVersion = '0.60.1';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (!compareVersions(migratedVersion, '0.61.0')) { if (!compareVersions(migratedVersion, '0.61.0')) {
// Changing PID controller via UI was added. // Changing PID controller via UI was added.
if (!configuration.PIDs && configuration.PID) { if (!configuration.PIDs && configuration.PID) {
configuration.PIDs = configuration.PID; configuration.PIDs = configuration.PID;
@ -403,14 +403,14 @@ function configuration_restore(callback) {
controller: 0 // assume pid controller 0 was used. controller: 0 // assume pid controller 0 was used.
}; };
} }
migratedVersion = '0.61.0'; migratedVersion = '0.61.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (!compareVersions(migratedVersion, '0.63.0')) { if (!compareVersions(migratedVersion, '0.63.0')) {
// LED Strip was saved as object instead of array. // LED Strip was saved as object instead of array.
if (typeof(configuration.LED_STRIP) == 'object') { if (typeof(configuration.LED_STRIP) == 'object') {
var fixed_led_strip = []; var fixed_led_strip = [];
@ -422,19 +422,18 @@ function configuration_restore(callback) {
configuration.LED_STRIP = fixed_led_strip; configuration.LED_STRIP = fixed_led_strip;
} }
for (var profileIndex = 0; profileIndex < 3; profileIndex++) { for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
var RC = configuration.profiles[profileIndex].RC; var RC = configuration.profiles[profileIndex].RC;
// TPA breakpoint was added // TPA breakpoint was added
if (!RC.dynamic_THR_breakpoint) { if (!RC.dynamic_THR_breakpoint) {
RC.dynamic_THR_breakpoint = 1500; // firmware default RC.dynamic_THR_breakpoint = 1500; // firmware default
} }
// Roll and pitch rates were split // Roll and pitch rates were split
RC.roll_rate = RC.roll_pitch_rate; RC.roll_rate = RC.roll_pitch_rate;
RC.pitch_rate = RC.roll_pitch_rate; RC.pitch_rate = RC.roll_pitch_rate;
} }
migratedVersion = '0.63.0'; migratedVersion = '0.63.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
@ -464,17 +463,17 @@ function configuration_restore(callback) {
telemetry_baudrate: 'AUTO', telemetry_baudrate: 'AUTO',
blackbox_baudrate: '115200', blackbox_baudrate: '115200',
}; };
switch(oldPort.scenario) { switch(oldPort.scenario) {
case 1: // MSP, CLI, TELEMETRY, SMARTPORT TELEMETRY, GPS-PASSTHROUGH case 1: // MSP, CLI, TELEMETRY, SMARTPORT TELEMETRY, GPS-PASSTHROUGH
case 5: // MSP, CLI, GPS-PASSTHROUGH case 5: // MSP, CLI, GPS-PASSTHROUGH
case 8: // MSP ONLY case 8: // MSP ONLY
newPort.functions.push('MSP'); newPort.functions.push('MSP');
break; break;
case 2: // GPS case 2: // GPS
newPort.functions.push('GPS'); newPort.functions.push('GPS');
break; break;
case 3: // RX_SERIAL case 3: // RX_SERIAL
newPort.functions.push('RX_SERIAL'); newPort.functions.push('RX_SERIAL');
break; break;
case 10: // BLACKBOX ONLY case 10: // BLACKBOX ONLY
@ -485,20 +484,20 @@ function configuration_restore(callback) {
newPort.functions.push('BLACKBOX'); newPort.functions.push('BLACKBOX');
break; break;
} }
ports.push(newPort); ports.push(newPort);
} }
configuration.SERIAL_CONFIG = { configuration.SERIAL_CONFIG = {
ports: ports ports: ports
}; };
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (compareVersions(migratedVersion, '0.63.0') && !compareVersions(configuration.apiVersion, '1.8.0')) { if (compareVersions(migratedVersion, '0.63.0') && !compareVersions(configuration.apiVersion, '1.8.0')) {
// api 1.8 exposes looptime and arming config // api 1.8 exposes looptime and arming config
if (configuration.FC_CONFIG == undefined) { if (configuration.FC_CONFIG == undefined) {
configuration.FC_CONFIG = { configuration.FC_CONFIG = {
loopTime: 3500 loopTime: 3500
@ -515,7 +514,7 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (compareVersions(migratedVersion, '0.63.0')) { if (compareVersions(migratedVersion, '0.63.0')) {
// backups created with 0.63.0 for firmwares with api < 1.8 were saved with incorrect looptime // backups created with 0.63.0 for firmwares with api < 1.8 were saved with incorrect looptime
if (configuration.FC_CONFIG.loopTime == 0) { if (configuration.FC_CONFIG.loopTime == 0) {
@ -523,25 +522,25 @@ function configuration_restore(callback) {
configuration.FC_CONFIG.loopTime = 3500; configuration.FC_CONFIG.loopTime = 3500;
} }
} }
if (semver.lt(migratedVersion, '0.66.0')) { if (semver.lt(migratedVersion, '0.66.0')) {
// api 1.12 updated servo configuration protocol and added servo mixer rules // api 1.12 updated servo configuration protocol and added servo mixer rules
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) { for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
if (semver.eq(configuration.apiVersion, '1.10.0')) { if (semver.eq(configuration.apiVersion, '1.10.0')) {
// drop two unused servo configurations // drop two unused servo configurations
while (configuration.profiles[profileIndex].ServoConfig.length > 8) { while (configuration.profiles[profileIndex].ServoConfig.length > 8) {
configuration.profiles[profileIndex].ServoConfig.pop(); configuration.profiles[profileIndex].ServoConfig.pop();
} }
} }
for (var i = 0; i < configuration.profiles[profileIndex].ServoConfig.length; i++) { for (var i = 0; i < configuration.profiles[profileIndex].ServoConfig.length; i++) {
var servoConfig = profiles[profileIndex].ServoConfig; var servoConfig = profiles[profileIndex].ServoConfig;
servoConfig[i].angleAtMin = 45; servoConfig[i].angleAtMin = 45;
servoConfig[i].angleAtMax = 45; servoConfig[i].angleAtMax = 45;
servoConfig[i].reversedInputSources = 0; servoConfig[i].reversedInputSources = 0;
// set the rate to 0 if an invalid value is detected. // set the rate to 0 if an invalid value is detected.
if (servoConfig[i].rate < -100 || servoConfig[i].rate > 100) { if (servoConfig[i].rate < -100 || servoConfig[i].rate > 100) {
servoConfig[i].rate = 0; servoConfig[i].rate = 0;
@ -550,21 +549,21 @@ function configuration_restore(callback) {
configuration.profiles[profileIndex].ServoRules = []; configuration.profiles[profileIndex].ServoRules = [];
} }
migratedVersion = '0.66.0'; migratedVersion = '0.66.0';
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (semver.lt(configuration.apiVersion, '1.14.0') && semver.gte(CONFIG.apiVersion, "1.14.0")) { if (semver.lt(configuration.apiVersion, '1.14.0') && semver.gte(CONFIG.apiVersion, "1.14.0")) {
// api 1.14 removed old pid controllers // api 1.14 removed old pid controllers
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) { for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
var newPidControllerIndex = configuration.profiles[profileIndex].PID.controller; var newPidControllerIndex = configuration.profiles[profileIndex].PID.controller;
switch (newPidControllerIndex) { switch (newPidControllerIndex) {
case 3: case 3:
case 4: case 4:
case 5: case 5:
newPidControllerIndex = 0; newPidControllerIndex = 0;
break; break;
} }
@ -574,11 +573,11 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.14.0')) { if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.14.0')) {
// api 1.14 exposes 3D configuration // api 1.14 exposes 3D configuration
if (configuration.MOTOR_3D_CONFIG == undefined) { if (configuration.MOTOR_3D_CONFIG == undefined) {
configuration.MOTOR_3D_CONFIG = { configuration.MOTOR_3D_CONFIG = {
deadband3d_low: 1406, deadband3d_low: 1406,
@ -591,19 +590,18 @@ function configuration_restore(callback) {
GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion])); GUI.log(i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++; appliedMigrationsCount++;
} }
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) { if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) {
// api 1.15 exposes RCdeadband and sensor alignment // api 1.15 exposes RCdeadband and sensor alignment
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) { for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
if (configuration.profiles[profileIndex].RCdeadband == undefined) { if (configuration.profiles[profileIndex].RCdeadband == undefined) {
configuration.profiles[profileIndex].RCdeadband = { configuration.profiles[profileIndex].RCdeadband = {
deadband: 0, deadband: 0,
yaw_deadband: 0, yaw_deadband: 0,
alt_hold_deadband: 40, alt_hold_deadband: 40,
}; };
} }
} }
if (configuration.SENSOR_ALIGNMENT == undefined) { if (configuration.SENSOR_ALIGNMENT == undefined) {
@ -611,9 +609,9 @@ function configuration_restore(callback) {
align_gyro: 0, align_gyro: 0,
align_acc: 0, align_acc: 0,
align_mag: 0 align_mag: 0
}; };
} }
// api 1.15 exposes RX_CONFIG, FAILSAFE_CONFIG and RXFAIL_CONFIG configuration // api 1.15 exposes RX_CONFIG, FAILSAFE_CONFIG and RXFAIL_CONFIG configuration
if (configuration.RX_CONFIG == undefined) { if (configuration.RX_CONFIG == undefined) {
@ -672,7 +670,7 @@ function configuration_restore(callback) {
} }
if (compareVersions(migratedVersion, '1.3.1')) { if (compareVersions(migratedVersion, '1.3.1')) {
// LED_COLORS & LED_MODE_COLORS support was added. // LED_COLORS & LED_MODE_COLORS support was added.
if (!configuration.LED_COLORS) { if (!configuration.LED_COLORS) {
configuration.LED_COLORS = []; configuration.LED_COLORS = [];
@ -689,10 +687,10 @@ function configuration_restore(callback) {
if (appliedMigrationsCount > 0) { if (appliedMigrationsCount > 0) {
GUI.log(i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount])); GUI.log(i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
} }
return true; return true;
} }
function configuration_upload(configuration, callback) { function configuration_upload(configuration, callback) {
function upload() { function upload() {
var activeProfile = null; var activeProfile = null;
@ -787,10 +785,10 @@ function configuration_restore(callback) {
MODE_RANGES_EXTRA = configuration.MODE_RANGES_EXTRA; MODE_RANGES_EXTRA = configuration.MODE_RANGES_EXTRA;
} }
} }
mspHelper.sendModeRanges(upload_adjustment_ranges); mspHelper.sendModeRanges(upload_adjustment_ranges);
} }
function upload_adjustment_ranges() { function upload_adjustment_ranges() {
mspHelper.sendAdjustmentRanges(upload_using_specific_commands); mspHelper.sendAdjustmentRanges(upload_using_specific_commands);
} }
@ -806,7 +804,7 @@ function configuration_restore(callback) {
MSPCodes.MSP_SET_RX_MAP, MSPCodes.MSP_SET_RX_MAP,
MSPCodes.MSP_SET_CF_SERIAL_CONFIG MSPCodes.MSP_SET_CF_SERIAL_CONFIG
]; ];
function update_unique_data_list() { function update_unique_data_list() {
uniqueData.push(MSPCodes.MSP_SET_NAME); uniqueData.push(MSPCodes.MSP_SET_NAME);
uniqueData.push(MSPCodes.MSP_SET_SENSOR_CONFIG); uniqueData.push(MSPCodes.MSP_SET_SENSOR_CONFIG);
@ -828,14 +826,14 @@ function configuration_restore(callback) {
uniqueData.push(MSPCodes.MSP_SET_FAILSAFE_CONFIG); uniqueData.push(MSPCodes.MSP_SET_FAILSAFE_CONFIG);
} }
if (semver.gte(CONFIG.apiVersion, "1.33.0")) { if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
uniqueData.push(MSPCodes.MSP_SET_FEATURE_CONFIG); uniqueData.push(MSPCodes.MSP_SET_FEATURE_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_MOTOR_CONFIG); uniqueData.push(MSPCodes.MSP_SET_MOTOR_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_GPS_CONFIG); uniqueData.push(MSPCodes.MSP_SET_GPS_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_COMPASS_CONFIG); uniqueData.push(MSPCodes.MSP_SET_COMPASS_CONFIG);
uniqueData.push(MSPCodes.MSP_SET_RSSI_CONFIG); uniqueData.push(MSPCodes.MSP_SET_RSSI_CONFIG);
} }
} }
function load_objects() { function load_objects() {
MISC = configuration.MISC; MISC = configuration.MISC;
RC_MAP = configuration.RCMAP; RC_MAP = configuration.RCMAP;
@ -902,7 +900,7 @@ function configuration_restore(callback) {
else else
send_rxfail_config(); send_rxfail_config();
} }
function send_rxfail_config() { function send_rxfail_config() {
if (semver.gte(CONFIG.apiVersion, "1.15.0")) { if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
mspHelper.sendRxFailConfig(save_to_eeprom); mspHelper.sendRxFailConfig(save_to_eeprom);

View file

@ -222,34 +222,34 @@ STM32DFU_protocol.prototype.getInterfaceDescriptors = function (interfaceNum, ca
return; return;
} }
var interfaceID = 0; var interfaceID = 0;
var descriptorStringArray = []; var descriptorStringArray = [];
var getDescriptorString = function () { var getDescriptorString = function () {
if(interfaceID < config.interfaces.length) { if(interfaceID < config.interfaces.length) {
self.getInterfaceDescriptor(interfaceID, function (descriptor, resultCode) { self.getInterfaceDescriptor(interfaceID, function (descriptor, resultCode) {
if (resultCode) { if (resultCode) {
callback([], resultCode); callback([], resultCode);
return; return;
} }
interfaceID++; interfaceID++;
self.getString(descriptor.iInterface, function (descriptorString, resultCode) { self.getString(descriptor.iInterface, function (descriptorString, resultCode) {
if (resultCode) { if (resultCode) {
callback([], resultCode); callback([], resultCode);
return; return;
} }
if (descriptor.bInterfaceNumber == interfaceNum) { if (descriptor.bInterfaceNumber == interfaceNum) {
descriptorStringArray.push(descriptorString); descriptorStringArray.push(descriptorString);
} }
getDescriptorString(); getDescriptorString();
}); });
}); });
} else { } else {
//console.log(descriptorStringArray); //console.log(descriptorStringArray);
callback(descriptorStringArray, 0); callback(descriptorStringArray, 0);
return; return;
} }
} }
getDescriptorString(); 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) // H750 Partitions: Flash, Config, Firmware, 1x BB Management block + x BB Replacement blocks)
if (str == "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka") { 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] // split main into [location, start_addr, sectors]
@ -396,11 +396,6 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
case 'K': case 'K':
page_size *= 1024; page_size *= 1024;
break; break;
/* case ' ':
break;
default:
return null;
*/
} }
sectors.push({ sectors.push({
@ -419,12 +414,12 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
'sectors' : sectors, 'sectors' : sectors,
'total_size' : total_size 'total_size' : total_size
} }
return memory; return memory;
} }
var chipInfo = descriptors.map(parseDescriptor).reduce(function(o, v, i) { var chipInfo = descriptors.map(parseDescriptor).reduce(function(o, v, i) {
o[v.type.toLowerCase().replace(' ', '_')] = v; o[v.type.toLowerCase().replace(' ', '_')] = v;
return o; return o;
}, {}); }, {});
callback(chipInfo, resultCode); callback(chipInfo, resultCode);
}); });
} }
@ -435,7 +430,7 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
// timeout support was added in chrome v43 // timeout support was added in chrome v43
var timeout; var timeout;
if (typeof _timeout === "undefined") { 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 { } else {
timeout = _timeout; timeout = _timeout;
} }
@ -527,11 +522,11 @@ STM32DFU_protocol.prototype.loadAddress = function (address, callback, abort) {
callback(data); callback(data);
} else { } else {
console.log('Failed to execute address load'); console.log('Failed to execute address load');
if(typeof abort === "undefined" || abort) { if(typeof abort === "undefined" || abort) {
self.upload_procedure(99); self.upload_procedure(99);
} else { } else {
callback(data); callback(data);
} }
} }
}); });
}, delay); }, delay);
@ -572,15 +567,15 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
if (typeof chipInfo.internal_flash !== "undefined") { if (typeof chipInfo.internal_flash !== "undefined") {
// internal flash // internal flash
self.chipInfo = chipInfo; self.chipInfo = chipInfo;
self.flash_layout = chipInfo.internal_flash; 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); 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())); GUI.log(i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
if (self.hex.bytes_total > self.available_flash_size) { if (self.hex.bytes_total > self.available_flash_size) {
GUI.log(i18n.getMessage('dfu_error_image_size', GUI.log(i18n.getMessage('dfu_error_image_size',
[(self.hex.bytes_total / 1024.0).toFixed(1), [(self.hex.bytes_total / 1024.0).toFixed(1),
(self.available_flash_size / 1024.0).toFixed(1)])); (self.available_flash_size / 1024.0).toFixed(1)]));
self.upload_procedure(99); self.upload_procedure(99);
} else { } else {
@ -596,7 +591,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
// external flash, flash to the 3rd partition. // external flash, flash to the 3rd partition.
self.chipInfo = chipInfo; self.chipInfo = chipInfo;
self.flash_layout = chipInfo.external_flash; self.flash_layout = chipInfo.external_flash;
var firmware_partition_index = 2; var firmware_partition_index = 2;
var firmware_sectors = self.flash_layout.sectors[firmware_partition_index]; var firmware_sectors = self.flash_layout.sectors[firmware_partition_index];
var firmware_partition_size = firmware_sectors.total_size; 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())); GUI.log(i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
if (self.hex.bytes_total > self.available_flash_size) { if (self.hex.bytes_total > self.available_flash_size) {
GUI.log(i18n.getMessage('dfu_error_image_size', GUI.log(i18n.getMessage('dfu_error_image_size',
[(self.hex.bytes_total / 1024.0).toFixed(1), [(self.hex.bytes_total / 1024.0).toFixed(1),
(self.available_flash_size / 1024.0).toFixed(1)])); (self.available_flash_size / 1024.0).toFixed(1)]));
self.upload_procedure(99); self.upload_procedure(99);
} else { } else {
@ -627,122 +622,120 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
}); });
break; break;
case 1: case 1:
if (typeof self.chipInfo.option_bytes === "undefined") { if (typeof self.chipInfo.option_bytes === "undefined") {
console.log('Failed to detect option bytes'); console.log('Failed to detect option bytes');
self.upload_procedure(99); self.upload_procedure(99);
} }
var unprotect = function() { var unprotect = function() {
console.log('Initiate read unprotect'); console.log('Initiate read unprotect');
let messageReadProtected = i18n.getMessage('stm32ReadProtected'); let messageReadProtected = i18n.getMessage('stm32ReadProtected');
GUI.log(messageReadProtected); GUI.log(messageReadProtected);
TABS.firmware_flasher.flashingMessage(messageReadProtected, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION) 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('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) { self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
if (data[4] == self.state.dfuDNBUSY) { // completely normal if (data[4] == self.state.dfuDNBUSY) { // completely normal
var delay = data[1] | (data[2] << 8) | (data[3] << 16); 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 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 timeSpentWaiting = 0;
var incr = 1000; // one sec increments var incr = 1000; // one sec increments
var waitForErase = setInterval(function () { 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) if(timeSpentWaiting < total_delay) {
{ timeSpentWaiting += incr;
timeSpentWaiting += incr; return;
return; }
} clearInterval(waitForErase);
clearInterval(waitForErase); self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data, error) { // should stall/disconnect
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.
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.');
console.log('Unprotect memory command ran successfully. Unplug flight controller. Connect again in DFU mode and try flashing again.'); GUI.log(i18n.getMessage('stm32UnprotectSuccessful'));
GUI.log(i18n.getMessage('stm32UnprotectSuccessful'));
let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
GUI.log(messageUnprotectUnplug);
TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION) let messageUnprotectUnplug = i18n.getMessage('stm32UnprotectUnplug');
.flashProgress(0); GUI.log(messageUnprotectUnplug);
} else { // unprotecting the flight controller did not work. It did not reboot. TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
console.log('Failed to execute unprotect memory command'); .flashProgress(0);
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);
}
});
});
}
} else { // unprotecting the flight controller did not work. It did not reboot.
console.log('Failed to execute unprotect memory command');
var tryReadOB = function() { GUI.log(i18n.getMessage('stm32UnprotectFailed'));
// the following should fail if read protection is active TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32UnprotectFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) { console.log(data);
if(errcode) { self.upload_procedure(99);
console.log('USB transfer error while reading option bytes: ' + errcode1); }
self.upload_procedure(99); }, 2000); // this should stall/disconnect anyways. so we only wait 2 sec max.
return; }, incr);
} } else {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) { console.log('Failed to initiate unprotect memory command');
if (data[4] == self.state.dfuUPLOAD_IDLE && ob_data.length == self.chipInfo.option_bytes.total_size) { let messageUnprotectInitFailed = i18n.getMessage('stm32UnprotectInitFailed')
console.log('Option bytes read successfully'); GUI.log(messageUnprotectInitFailed);
console.log('Chip does not appear read protected'); TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID)
GUI.log(i18n.getMessage('stm32NotReadProtected')); self.upload_procedure(99);
// 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 () { var tryReadOB = function() {
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) { // the following should fail if read protection is active
if (data[4] == self.state.dfuDNLOAD_IDLE) { self.controlTransfer('in', self.request.UPLOAD, 2, 0, self.chipInfo.option_bytes.total_size, 0, function (ob_data, errcode) {
console.log('Failed to write ob'); if(errcode) {
self.upload_procedure(99); console.log('USB transfer error while reading option bytes: ' + errcode1);
} else { self.upload_procedure(99);
console.log('Success writing ob'); return;
self.upload_procedure(99); }
} 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) {
}, delay); console.log('Option bytes read successfully');
} else { console.log('Chip does not appear read protected');
console.log('Failed to initiate write ob'); GUI.log(i18n.getMessage('stm32NotReadProtected'));
self.upload_procedure(99); // 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)
self.clearStatus(function () { ob_data[1] = 0x0;
self.loadAddress(self.chipInfo.option_bytes.start_address, function () { var writeOB = function() {
self.clearStatus(writeOB); 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) {
} else { var delay = data[1] | (data[2] << 8) | (data[3] << 16);
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) { var initReadOB = function (loadAddressResponse) {
// contrary to what is in the docs. Address load should in theory work even if read protection is active // 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 () { self.clearStatus(function () {
// load address fails if read protection is active unlike as stated in the docs // 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.loadAddress(self.chipInfo.option_bytes.start_address, initReadOB, false);
}); });
break; break;
case 2: case 2:
// erase // erase
@ -795,7 +788,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} }
} }
} }
if (erase_pages.length === 0) { if (erase_pages.length === 0) {
console.log('Aborting, No flash pages to erase'); console.log('Aborting, No flash pages to erase');
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32InvalidHex'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID); 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); 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 page = 0;
var total_erased = 0; // bytes var total_erased = 0; // bytes
var erase_page = function() { 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; 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]; 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; 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)); ', page ' + erase_pages[page].page + ' @ 0x' + page_addr.toString(16));
self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, cmd, function () { self.controlTransfer('out', self.request.DNLOAD, 0, 0, 0, cmd, function () {

View file

@ -32,8 +32,8 @@ TABS.firmware_flasher.initialize = function (callback) {
/** /**
* Change boldness of firmware option depending on cache status * Change boldness of firmware option depending on cache status
* *
* @param {Descriptor} release * @param {Descriptor} release
*/ */
function onFirmwareCacheUpdate(release) { function onFirmwareCacheUpdate(release) {
$("option[value='{0}']".format(release.version)) $("option[value='{0}']".format(release.version))
@ -76,7 +76,7 @@ TABS.firmware_flasher.initialize = function (callback) {
} else { } else {
$('div.release_info #manufacturerInfo').hide(); $('div.release_info #manufacturerInfo').hide();
} }
} }
$('div.release_info .target').text(targetName); $('div.release_info .target').text(targetName);
$('div.release_info .name').text(summary.version).prop('href', summary.releaseUrl); $('div.release_info .name').text(summary.version).prop('href', summary.releaseUrl);
$('div.release_info .date').text(summary.date); $('div.release_info .date').text(summary.date);
@ -113,8 +113,8 @@ TABS.firmware_flasher.initialize = function (callback) {
function onLoadSuccess(data, summary) { function onLoadSuccess(data, summary) {
self.localFirmwareLoaded = false; self.localFirmwareLoaded = false;
// The path from getting a firmware doesn't fill in summary. // The path from getting a firmware doesn't fill in summary.
summary = typeof summary === "object" summary = typeof summary === "object"
? summary ? summary
: $('select[name="firmware_version"] option:selected').data('summary'); : $('select[name="firmware_version"] option:selected').data('summary');
process_hex(data, summary); process_hex(data, summary);
$("a.load_remote_file").removeClass('disabled'); $("a.load_remote_file").removeClass('disabled');
@ -1054,14 +1054,14 @@ TABS.firmware_flasher.enableFlashing = function (enabled) {
} }
} }
TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL', TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
VALID : 'VALID', VALID : 'VALID',
INVALID : 'INVALID', INVALID : 'INVALID',
ACTION : 'ACTION'}; ACTION : 'ACTION'};
TABS.firmware_flasher.flashingMessage = function(message, type) { TABS.firmware_flasher.flashingMessage = function(message, type) {
let self = this; let self = this;
let progressLabel_e = $('span.progressLabel'); let progressLabel_e = $('span.progressLabel');
switch (type) { switch (type) {
case self.FLASH_MESSAGE_TYPES.VALID: case self.FLASH_MESSAGE_TYPES.VALID:

View file

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

View file

@ -12,7 +12,7 @@ TABS.onboard_logging = {
VCP_BLOCK_SIZE: 4096 VCP_BLOCK_SIZE: 4096
}; };
TABS.onboard_logging.initialize = function (callback) { TABS.onboard_logging.initialize = function (callback) {
var var
self = this, self = this,
saveCancelled, eraseCancelled; 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_FEATURE_CONFIG, false, false, function() {
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, 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_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_ADVANCED_CONFIG, false, false, function() {
MSP.send_message(MSPCodes.MSP_NAME, false, false, load_html); MSP.send_message(MSPCodes.MSP_NAME, false, false, load_html);
}); });
@ -34,14 +34,14 @@ TABS.onboard_logging.initialize = function (callback) {
}); });
}); });
} }
function gcd(a, b) { function gcd(a, b) {
if (b === 0) if (b === 0)
return a; return a;
return gcd(b, a % b); return gcd(b, a % b);
} }
function save_to_eeprom() { function save_to_eeprom() {
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot); MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
} }
@ -54,19 +54,19 @@ TABS.onboard_logging.initialize = function (callback) {
reinitialiseConnection(self); reinitialiseConnection(self);
}); });
} }
function load_html() { function load_html() {
$('#content').load("./tabs/onboard_logging.html", function() { $('#content').load("./tabs/onboard_logging.html", function() {
// translate to user-selected language // translate to user-selected language
i18n.localizePage(); i18n.localizePage();
var var
dataflashPresent = DATAFLASH.totalSize > 0, dataflashPresent = DATAFLASH.totalSize > 0,
blackboxSupport; blackboxSupport;
/* /*
* Pre-1.11.0 firmware supported DATAFLASH API (on targets with SPI flash) but not the BLACKBOX config API. * 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. * 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'))) { 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 { } else {
blackboxSupport = 'no'; blackboxSupport = 'no';
} }
$(".tab-onboard_logging") $(".tab-onboard_logging")
.addClass("serial-supported") .addClass("serial-supported")
.toggleClass("dataflash-supported", DATAFLASH.supported) .toggleClass("dataflash-supported", DATAFLASH.supported)
.toggleClass("dataflash-present", dataflashPresent) .toggleClass("dataflash-present", dataflashPresent)
.toggleClass("sdcard-supported", SDCARD.supported) .toggleClass("sdcard-supported", SDCARD.supported)
.toggleClass("blackbox-config-supported", BLACKBOX.supported) .toggleClass("blackbox-config-supported", BLACKBOX.supported)
.toggleClass("blackbox-supported", blackboxSupport === 'yes') .toggleClass("blackbox-supported", blackboxSupport === 'yes')
.toggleClass("blackbox-maybe-supported", blackboxSupport === 'maybe') .toggleClass("blackbox-maybe-supported", blackboxSupport === 'maybe')
.toggleClass("blackbox-unsupported", blackboxSupport === 'no'); .toggleClass("blackbox-unsupported", blackboxSupport === 'no');
@ -89,10 +89,10 @@ TABS.onboard_logging.initialize = function (callback) {
if (dataflashPresent) { if (dataflashPresent) {
// UI hooks // UI hooks
$('.tab-onboard_logging a.erase-flash').click(ask_to_erase_flash); $('.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-confirm').click(flash_erase);
$('.tab-onboard_logging a.erase-flash-cancel').click(flash_erase_cancel); $('.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').click(flash_save_begin);
$('.tab-onboard_logging a.save-flash-cancel').click(flash_save_cancel); $('.tab-onboard_logging a.save-flash-cancel').click(flash_save_cancel);
$('.tab-onboard_logging a.save-flash-dismiss').click(dismiss_saving_dialog); $('.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); MSP.send_message(MSPCodes.MSP_SET_BLACKBOX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BLACKBOX_CONFIG), false, save_to_eeprom);
}); });
} }
populateLoggingRates(loggingRatesSelect); populateLoggingRates(loggingRatesSelect);
populateDevices(deviceSelect); populateDevices(deviceSelect);
populateDebugModes(debugModeSelect); populateDebugModes(debugModeSelect);
@ -157,13 +157,13 @@ TABS.onboard_logging.initialize = function (callback) {
}); });
} }
} }
update_html(); update_html();
GUI.content_ready(callback); GUI.content_ready(callback);
}); });
} }
function populateDevices(deviceSelect) { function populateDevices(deviceSelect) {
deviceSelect.empty(); deviceSelect.empty();
@ -188,9 +188,9 @@ TABS.onboard_logging.initialize = function (callback) {
deviceSelect.val(BLACKBOX.blackboxDevice); deviceSelect.val(BLACKBOX.blackboxDevice);
} }
function populateLoggingRates(loggingRatesSelect) { function populateLoggingRates(loggingRatesSelect) {
// Offer a reasonable choice of logging rates (if people want weird steps they can use CLI) // Offer a reasonable choice of logging rates (if people want weird steps they can use CLI)
var loggingRates = []; var loggingRates = [];
var pidRateBase = 8000; var pidRateBase = 8000;
@ -199,8 +199,8 @@ TABS.onboard_logging.initialize = function (callback) {
pidRateBase = 32000; pidRateBase = 32000;
} }
var pidRate = pidRateBase / PID_ADVANCED_CONFIG.gyro_sync_denom / var pidRate = pidRateBase / PID_ADVANCED_CONFIG.gyro_sync_denom /
PID_ADVANCED_CONFIG.pid_process_denom; PID_ADVANCED_CONFIG.pid_process_denom;
if (semver.gte(CONFIG.apiVersion, "1.36.0")) { if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
loggingRates = [ loggingRates = [
@ -210,9 +210,9 @@ TABS.onboard_logging.initialize = function (callback) {
{text: "1.5 kHz", hz: 1500, p_denom: 48}, {text: "1.5 kHz", hz: 1500, p_denom: 48},
{text: "2 kHz", hz: 2000, p_denom: 64}, {text: "2 kHz", hz: 2000, p_denom: 64},
{text: "4 kHz", hz: 4000, p_denom: 128}, {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: "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) { $.each(loggingRates, function(index, item) {
@ -237,19 +237,19 @@ TABS.onboard_logging.initialize = function (callback) {
{num: 1, denom: 32} {num: 1, denom: 32}
]; ];
for (var i = 0; i < loggingRates.length; i++) { for (var i = 0; i < loggingRates.length; i++) {
var loggingRate = Math.round(pidRate / loggingRates[i].denom); var loggingRate = Math.round(pidRate / loggingRates[i].denom);
var loggingRateUnit = " Hz"; var loggingRateUnit = " Hz";
if (loggingRate !== Infinity) { if (loggingRate !== Infinity) {
if (gcd(loggingRate, 1000) === 1000) { if (gcd(loggingRate, 1000) === 1000) {
loggingRate /= 1000; loggingRate /= 1000;
loggingRateUnit = " KHz"; loggingRateUnit = " KHz";
} }
} }
loggingRatesSelect.append('<option value="' + loggingRates[i].num + '/' + loggingRates[i].denom + '">' loggingRatesSelect.append('<option value="' + loggingRates[i].num + '/' + loggingRates[i].denom + '">'
+ loggingRate + loggingRateUnit + ' (' + Math.round(loggingRates[i].num / loggingRates[i].denom * 100) + '%)</option>'); + loggingRate + loggingRateUnit + ' (' + Math.round(loggingRates[i].num / loggingRates[i].denom * 100) + '%)</option>');
} }
loggingRatesSelect.val(BLACKBOX.blackboxRateNum + '/' + BLACKBOX.blackboxRateDenom); loggingRatesSelect.val(BLACKBOX.blackboxRateNum + '/' + BLACKBOX.blackboxRateDenom);
} }
@ -337,39 +337,39 @@ TABS.onboard_logging.initialize = function (callback) {
$('.blackboxDebugMode').hide(); $('.blackboxDebugMode').hide();
} }
} }
function formatFilesizeKilobytes(kilobytes) { function formatFilesizeKilobytes(kilobytes) {
if (kilobytes < 1024) { if (kilobytes < 1024) {
return Math.round(kilobytes) + "kB"; return Math.round(kilobytes) + "kB";
} }
var var
megabytes = kilobytes / 1024, megabytes = kilobytes / 1024,
gigabytes; gigabytes;
if (megabytes < 900) { if (megabytes < 900) {
return megabytes.toFixed(1) + "MB"; return megabytes.toFixed(1) + "MB";
} else { } else {
gigabytes = megabytes / 1024; gigabytes = megabytes / 1024;
return gigabytes.toFixed(1) + "GB"; return gigabytes.toFixed(1) + "GB";
} }
} }
function formatFilesizeBytes(bytes) { function formatFilesizeBytes(bytes) {
if (bytes < 1024) { if (bytes < 1024) {
return bytes + "B"; return bytes + "B";
} }
return formatFilesizeKilobytes(bytes / 1024); return formatFilesizeKilobytes(bytes / 1024);
} }
function update_bar_width(bar, value, total, label, valuesAreKilobytes) { function update_bar_width(bar, value, total, label, valuesAreKilobytes) {
if (value > 0) { if (value > 0) {
bar.css({ bar.css({
width: (value / total * 100) + "%", width: (value / total * 100) + "%",
display: 'block' display: 'block'
}); });
$("div", bar).text((label ? label + " " : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value))); $("div", bar).text((label ? label + " " : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value)));
} else { } else {
bar.css({ bar.css({
@ -377,7 +377,7 @@ TABS.onboard_logging.initialize = function (callback) {
}); });
} }
} }
function update_html() { function update_html() {
var dataflashPresent = DATAFLASH.totalSize > 0; 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); 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); $(".btn a.erase-flash, .btn a.save-flash").toggleClass("disabled", DATAFLASH.usedSize === 0);
$(".tab-onboard_logging") $(".tab-onboard_logging")
.toggleClass("sdcard-error", SDCARD.state === MSP.SDCARD_STATE_FATAL) .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) .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'); $('a.onboardLoggingRebootMsc').removeClass('disabled');
} }
} }
var loggingStatus var loggingStatus
switch (SDCARD.state) { switch (SDCARD.state) {
case MSP.SDCARD_STATE_NOT_PRESENT: case MSP.SDCARD_STATE_NOT_PRESENT:
@ -431,7 +431,7 @@ TABS.onboard_logging.initialize = function (callback) {
default: default:
$(".sdcard-status").text(i18n.getMessage('sdcardStatusUnknown',[SDCARD.state])); $(".sdcard-status").text(i18n.getMessage('sdcardStatusUnknown',[SDCARD.state]));
} }
if (dataflashPresent && SDCARD.state === MSP.SDCARD_STATE_NOT_PRESENT) { if (dataflashPresent && SDCARD.state === MSP.SDCARD_STATE_NOT_PRESENT) {
loggingStatus = 'Dataflash'; loggingStatus = 'Dataflash';
analytics.setFlightControllerData(analytics.DATA.LOG_SIZE, DATAFLASH.usedSize); analytics.setFlightControllerData(analytics.DATA.LOG_SIZE, DATAFLASH.usedSize);
@ -450,24 +450,24 @@ TABS.onboard_logging.initialize = function (callback) {
}, 2000); }, 2000);
} }
} }
// IO related methods // IO related methods
function flash_save_cancel() { function flash_save_cancel() {
saveCancelled = true; saveCancelled = true;
} }
function show_saving_dialog() { function show_saving_dialog() {
$(".dataflash-saving progress").attr("value", 0); $(".dataflash-saving progress").attr("value", 0);
saveCancelled = false; saveCancelled = false;
$(".dataflash-saving").removeClass("done"); $(".dataflash-saving").removeClass("done");
$(".dataflash-saving")[0].showModal(); $(".dataflash-saving")[0].showModal();
} }
function dismiss_saving_dialog() { function dismiss_saving_dialog() {
$(".dataflash-saving")[0].close(); $(".dataflash-saving")[0].close();
} }
function mark_saving_dialog_done(startTime, totalBytes, totalBytesCompressed) { function mark_saving_dialog_done(startTime, totalBytes, totalBytesCompressed) {
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash'); analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash');
@ -480,17 +480,17 @@ TABS.onboard_logging.initialize = function (callback) {
$(".dataflash-saving").addClass("done"); $(".dataflash-saving").addClass("done");
} }
function flash_update_summary(onDone) { function flash_update_summary(onDone) {
MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() { MSP.send_message(MSPCodes.MSP_DATAFLASH_SUMMARY, false, false, function() {
update_html(); update_html();
if (onDone) { if (onDone) {
onDone(); onDone();
} }
}); });
} }
function flash_save_begin() { function flash_save_begin() {
if (GUI.connected_to) { if (GUI.connected_to) {
if (FC.boardHasVcp()) { 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 // Begin by refreshing the occupied size in case it changed while the tab was open
flash_update_summary(function() { flash_update_summary(function() {
var maxBytes = DATAFLASH.usedSize; var maxBytes = DATAFLASH.usedSize;
prepare_file(function(fileWriter) { prepare_file(function(fileWriter) {
var nextAddress = 0; var nextAddress = 0;
var totalBytesCompressed = 0; var totalBytesCompressed = 0;
show_saving_dialog(); show_saving_dialog();
function onChunkRead(chunkAddress, chunkDataView, bytesCompressed) { function onChunkRead(chunkAddress, chunkDataView, bytesCompressed) {
if (chunkDataView !== null) { if (chunkDataView !== null) {
// Did we receive any data? // Did we receive any data?
@ -523,11 +523,11 @@ TABS.onboard_logging.initialize = function (callback) {
} else { } else {
totalBytesCompressed += bytesCompressed; totalBytesCompressed += bytesCompressed;
} }
$(".dataflash-saving progress").attr("value", nextAddress / maxBytes * 100); $(".dataflash-saving progress").attr("value", nextAddress / maxBytes * 100);
var blob = new Blob([chunkDataView]); var blob = new Blob([chunkDataView]);
fileWriter.onwriteend = function(e) { fileWriter.onwriteend = function(e) {
if (saveCancelled || nextAddress >= maxBytes) { if (saveCancelled || nextAddress >= maxBytes) {
if (saveCancelled) { if (saveCancelled) {
@ -543,7 +543,7 @@ TABS.onboard_logging.initialize = function (callback) {
} }
} }
}; };
fileWriter.write(blob); fileWriter.write(blob);
} else { } else {
// A zero-byte block indicates end-of-file, so we're done // 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) { function prepare_file(onComplete) {
var prefix = 'BLACKBOX_LOG'; var prefix = 'BLACKBOX_LOG';
var suffix = 'BBL'; var suffix = 'BBL';
var filename = generateFilename(prefix, suffix); 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) { accepts: [{description: suffix.toUpperCase() + ' files', extensions: [suffix]}]}, function(fileEntry) {
var error = chrome.runtime.lastError; var error = chrome.runtime.lastError;
if (error) { if (error) {
console.error(error.message); console.error(error.message);
if (error.message !== "User cancelled") { if (error.message !== "User cancelled") {
GUI.log(i18n.getMessage('dataflashFileWriteFailed')); GUI.log(i18n.getMessage('dataflashFileWriteFailed'));
} }
return; return;
} }
// echo/console log path specified // echo/console log path specified
chrome.fileSystem.getDisplayPath(fileEntry, function(path) { chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
console.log('Dataflash dump file path: ' + path); console.log('Dataflash dump file path: ' + path);
@ -591,7 +591,7 @@ TABS.onboard_logging.initialize = function (callback) {
fileEntry.createWriter(function (fileWriter) { fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) { fileWriter.onerror = function (e) {
GUI.log('<strong><span class="message-negative">' + i18n.getMessage('error', { errorMessage: e.target.error.message }) + '</span class="message-negative></strong>'); GUI.log('<strong><span class="message-negative">' + i18n.getMessage('error', { errorMessage: e.target.error.message }) + '</span class="message-negative></strong>');
console.error(e); console.error(e);
// stop logging if the procedure was/is still running // stop logging if the procedure was/is still running
@ -606,12 +606,12 @@ TABS.onboard_logging.initialize = function (callback) {
}); });
}); });
} }
function ask_to_erase_flash() { function ask_to_erase_flash() {
eraseCancelled = false; eraseCancelled = false;
$(".dataflash-confirm-erase").removeClass('erasing'); $(".dataflash-confirm-erase").removeClass('erasing');
$(".dataflash-confirm-erase")[0].showModal(); $(".dataflash-confirm-erase")[0].showModal();
} }
function poll_for_erase_completion() { function poll_for_erase_completion() {
@ -625,13 +625,13 @@ TABS.onboard_logging.initialize = function (callback) {
} }
}); });
} }
function flash_erase() { function flash_erase() {
$(".dataflash-confirm-erase").addClass('erasing'); $(".dataflash-confirm-erase").addClass('erasing');
MSP.send_message(MSPCodes.MSP_DATAFLASH_ERASE, false, false, poll_for_erase_completion); MSP.send_message(MSPCodes.MSP_DATAFLASH_ERASE, false, false, poll_for_erase_completion);
} }
function flash_erase_cancel() { function flash_erase_cancel() {
eraseCancelled = true; eraseCancelled = true;
$(".dataflash-confirm-erase")[0].close(); $(".dataflash-confirm-erase")[0].close();
@ -646,7 +646,7 @@ TABS.onboard_logging.cleanup = function (callback) {
clearTimeout(sdcardTimer); clearTimeout(sdcardTimer);
sdcardTimer = false; sdcardTimer = false;
} }
if (callback) { if (callback) {
callback(); callback();
} }

View file

@ -1083,7 +1083,7 @@ TABS.pid_tuning.initialize = function (callback) {
if (!semver.gte(CONFIG.apiVersion, "1.16.0")) { if (!semver.gte(CONFIG.apiVersion, "1.16.0")) {
$('#pid-tuning .delta').hide(); $('#pid-tuning .delta').hide();
$('.tab-pid_tuning .note').hide(); $('.tab-pid_tuning .note').hide();
} }
// Add a name to each row of PIDs if empty // Add a name to each row of PIDs if empty
$('.pid_tuning tr').each(function(){ $('.pid_tuning tr').each(function(){
@ -1312,9 +1312,9 @@ TABS.pid_tuning.initialize = function (callback) {
return; return;
} }
/* /*
Quadratic curve formula taken from: Quadratic curve formula taken from:
https://stackoverflow.com/a/9195706/176210 https://stackoverflow.com/a/9195706/176210
*/ */
function getQBezierValue(t, p1, p2, p3) { function getQBezierValue(t, p1, p2, p3) {
@ -1349,7 +1349,7 @@ TABS.pid_tuning.initialize = function (callback) {
return; return;
} }
throttleCurve.width = throttleCurve.height * throttleCurve.width = throttleCurve.height *
(throttleCurve.clientWidth / throttleCurve.clientHeight); (throttleCurve.clientWidth / throttleCurve.clientHeight);
var canvasHeight = throttleCurve.height; var canvasHeight = throttleCurve.height;

View file

@ -263,7 +263,7 @@ TABS.power.initialize = function (callback) {
if (haveFc) { if (haveFc) {
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeVirtual')); currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeVirtual'));
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeEsc')); currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeEsc'));
if (semver.gte(CONFIG.apiVersion, "1.36.0")) { if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp')); currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
} }
@ -390,7 +390,7 @@ TABS.power.initialize = function (callback) {
$('.srcchange').hide(); $('.srcchange').hide();
} }
}); });
$('input[name="vbatcalibration"]').val(0); $('input[name="vbatcalibration"]').val(0);
$('input[name="amperagecalibration"]').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; var amperageoffset = CURRENT_METER_CONFIGS[ampsource - 1].offset / 1000;
if (amperagecalibration != 0) { if (amperagecalibration != 0) {
if (CURRENT_METERS[ampsource - 1].amperage != amperageoffset && amperagecalibration != amperageoffset) { 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))); ((CURRENT_METERS[ampsource - 1].amperage - amperageoffset) / (amperagecalibration - amperageoffset)));
if (amperagenewscale > -16000 && amperagenewscale < 16000 && amperagenewscale != 0) { if (amperagenewscale > -16000 && amperagenewscale < 16000 && amperagenewscale != 0) {
CURRENT_METER_CONFIGS[ampsource - 1].scale = amperagenewscale; CURRENT_METER_CONFIGS[ampsource - 1].scale = amperagenewscale;
@ -440,11 +440,11 @@ TABS.power.initialize = function (callback) {
$('a.applycalibration').click(function() { $('a.applycalibration').click(function() {
if (vbatscalechanged) { if (vbatscalechanged) {
self.analyticsChanges['PowerVBatUpdated'] = 'Calibrated'; self.analyticsChanges['PowerVBatUpdated'] = 'Calibrated';
} }
if (amperagescalechanged) { if (amperagescalechanged) {
self.analyticsChanges['PowerAmperageUpdated'] = 'Calibrated'; self.analyticsChanges['PowerAmperageUpdated'] = 'Calibrated';
} }
calibrationconfirmed = true; calibrationconfirmed = true;
GUI.calibrationManagerConfirmation.close(); GUI.calibrationManagerConfirmation.close();
@ -454,7 +454,7 @@ TABS.power.initialize = function (callback) {
$('a.discardcalibration').click(function() { $('a.discardcalibration').click(function() {
GUI.calibrationManagerConfirmation.close(); GUI.calibrationManagerConfirmation.close();
}); });
} else { } else {
GUI.calibrationManagerConfirmation.close(); GUI.calibrationManagerConfirmation.close();
} }

View file

@ -39,9 +39,9 @@ TABS.setup.initialize = function (callback) {
// initialize 3D Model // initialize 3D Model
self.initModel(); self.initModel();
// set roll in interactive block // set roll in interactive block
$('span.roll').text(i18n.getMessage('initialSetupAttitude', [0])); $('span.roll').text(i18n.getMessage('initialSetupAttitude', [0]));
// set pitch in interactive block // set pitch in interactive block
$('span.pitch').text(i18n.getMessage('initialSetupAttitude', [0])); $('span.pitch').text(i18n.getMessage('initialSetupAttitude', [0]));
// set heading in interactive block // set heading in interactive block
$('span.heading').text(i18n.getMessage('initialSetupAttitude', [0])); $('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. // We add all the arming/disarming flags available, and show/hide them if needed.
var prepareDisarmFlags = function() { var prepareDisarmFlags = function() {
var disarmFlagElements = ['NO_GYRO', var disarmFlagElements = ['NO_GYRO',
'FAILSAFE', 'FAILSAFE',
'RX_FAILSAFE', 'RX_FAILSAFE',
'BAD_RX_RECOVERY', 'BAD_RX_RECOVERY',
'BOXFAILSAFE', 'BOXFAILSAFE',
'THROTTLE', 'THROTTLE',
'ANGLE', 'ANGLE',
@ -221,7 +221,7 @@ TABS.setup.initialize = function (callback) {
]; ];
if (semver.gte(CONFIG.apiVersion, "1.38.0")) { 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")) { if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
@ -300,8 +300,8 @@ TABS.setup.initialize = function (callback) {
function get_fast_data() { function get_fast_data() {
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () { MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
roll_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]])); roll_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
pitch_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]])); pitch_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
heading_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]])); heading_e.text(i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
self.renderModel(); self.renderModel();

View file

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