Merge pull request #2696 from chmelevskij/chore/eslint-prefer-templates
chore: add prefer template rule10.8-maintenance
commit
d0d3141b72
|
@ -17,5 +17,7 @@ module.exports = {
|
|||
semi: "error",
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"no-var": "error",
|
||||
"prefer-template": "error",
|
||||
"template-curly-spacing": "error",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = function(options) {
|
|||
const ee = appdmg(options);
|
||||
|
||||
ee.on('progress', function(info) {
|
||||
gutil.log(info.current + '/' + info.total + ' ' + info.type + ' ' + (info.title || info.status));
|
||||
gutil.log(`${info.current}/${info.total} ${info.type} ${info.title || info.status}`);
|
||||
});
|
||||
|
||||
ee.on('error', function(err) {
|
||||
|
|
|
@ -21,7 +21,7 @@ const Analytics = function (trackingId, userId, appName, appVersion, gitRevision
|
|||
this._googleAnalytics.set('checkProtocolTask', null);
|
||||
|
||||
this._googleAnalytics.set('appName', appName);
|
||||
this._googleAnalytics.set('appVersion', debugMode ? appVersion + '-debug' : appVersion);
|
||||
this._googleAnalytics.set('appVersion', debugMode ? `${appVersion}-debug` : appVersion);
|
||||
|
||||
this.EVENT_CATEGORIES = {
|
||||
APPLICATION: 'Application',
|
||||
|
@ -130,7 +130,7 @@ Analytics.prototype.sendException = function (message) {
|
|||
};
|
||||
|
||||
Analytics.prototype.setOptOut = function (optOut) {
|
||||
window['ga-disable-' + this._trackingId] = !!optOut;
|
||||
window[`ga-disable-${this._trackingId}`] = !!optOut;
|
||||
};
|
||||
|
||||
Analytics.prototype._rebuildFlightControllerEvent = function () {
|
||||
|
|
|
@ -103,7 +103,7 @@ CliAutoComplete.builderStart = function() {
|
|||
};
|
||||
this.builder.commandSequence = ['help', 'dump', 'get', 'mixer list'];
|
||||
this.builder.currentSetting = null;
|
||||
this.builder.sentinel = '# ' + Math.random();
|
||||
this.builder.sentinel = `# ${Math.random()}`;
|
||||
this.builder.state = 'init';
|
||||
this.writeToOutput('<br># Building AutoComplete Cache ... ');
|
||||
this.sendLine(this.builder.sentinel);
|
||||
|
@ -123,7 +123,7 @@ CliAutoComplete.builderParseLine = function(line) {
|
|||
|
||||
if (command && this.configEnabled) {
|
||||
// next state
|
||||
builder.state = 'parse-' + command;
|
||||
builder.state = `parse-${command}`;
|
||||
this.sendLine(command);
|
||||
this.sendLine(builder.sentinel);
|
||||
} else {
|
||||
|
@ -398,7 +398,7 @@ CliAutoComplete._initTextcomplete = function() {
|
|||
value = this.value;
|
||||
}
|
||||
|
||||
return '$1 = ' + value; // cosmetic - make sure we have spaces around the `=`
|
||||
return `$1 = ${value}`; // cosmetic - make sure we have spaces around the `=`
|
||||
},
|
||||
index: 3,
|
||||
isSettingValueArray: false,
|
||||
|
|
|
@ -59,7 +59,7 @@ function generateData(firmware, input, startAddress) {
|
|||
}
|
||||
|
||||
// Add 0 terminator
|
||||
input = input + '\0';
|
||||
input = `${input}\0`;
|
||||
|
||||
let inputIndex = 0;
|
||||
while (inputIndex < input.length) {
|
||||
|
|
|
@ -57,9 +57,9 @@ DarkTheme.setConfig = function (result) {
|
|||
};
|
||||
|
||||
DarkTheme.applyDark = function () {
|
||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', false));
|
||||
css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', false));
|
||||
};
|
||||
|
||||
DarkTheme.applyNormal = function () {
|
||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', true));
|
||||
css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', true));
|
||||
};
|
||||
|
|
|
@ -104,7 +104,7 @@ let FirmwareCache = (function () {
|
|||
* @returns {string} A key for storing cached data for a release
|
||||
*/
|
||||
function withCachePrefix(key) {
|
||||
return "cache:" + key;
|
||||
return `cache:${key}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,7 @@ let FirmwareCache = (function () {
|
|||
}
|
||||
let key = keyOf(release);
|
||||
if (has(release)) {
|
||||
console.debug("Firmware is already cached: " + key);
|
||||
console.debug(`Firmware is already cached: ${key}`);
|
||||
return;
|
||||
}
|
||||
journal.set(key, true);
|
||||
|
@ -159,7 +159,7 @@ let FirmwareCache = (function () {
|
|||
}
|
||||
let key = keyOf(release);
|
||||
if (!has(release)) {
|
||||
console.debug("Firmware is not cached: " + key);
|
||||
console.debug(`Firmware is not cached: ${key}`);
|
||||
return;
|
||||
}
|
||||
let cacheKey = withCachePrefix(key);
|
||||
|
@ -208,7 +208,7 @@ let FirmwareCache = (function () {
|
|||
if (typeof onPutToCacheCallback === "function") {
|
||||
onPutToCacheCallback(release);
|
||||
}
|
||||
console.info("Release put to cache: " + keyOf(release));
|
||||
console.info(`Release put to cache: ${keyOf(release)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,7 +218,7 @@ let FirmwareCache = (function () {
|
|||
if (typeof onRemoveFromCacheCallback === "function") {
|
||||
onRemoveFromCacheCallback(release);
|
||||
}
|
||||
console.debug("Cache data removed: " + keyOf(release));
|
||||
console.debug(`Cache data removed: ${keyOf(release)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,7 +231,7 @@ let FirmwareCache = (function () {
|
|||
}
|
||||
journal.assign(pairs);
|
||||
journalLoaded = true;
|
||||
console.info("Firmware cache journal loaded; number of entries: " + entries.length);
|
||||
console.info(`Firmware cache journal loaded; number of entries: ${entries.length}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -179,8 +179,8 @@ LogoManager.init = function (font, logoStartIndex) {
|
|||
this.logoStartIndex = logoStartIndex;
|
||||
// inject logo size variables for dynamic translation strings
|
||||
i18n.addResources({
|
||||
logoWidthPx: "" + this.constraints.imageSize.expectedWidth, // NOSONAR
|
||||
logoHeightPx: "" + this.constraints.imageSize.expectedHeight, // NOSONAR
|
||||
logoWidthPx: `${this.constraints.imageSize.expectedWidth}`, // NOSONAR
|
||||
logoHeightPx: `${this.constraints.imageSize.expectedHeight}`, // NOSONAR
|
||||
});
|
||||
// find/cache DOM elements
|
||||
Object.keys(this.elements).forEach(key => {
|
||||
|
|
|
@ -8,7 +8,7 @@ function configuration_backup(callback) {
|
|||
let version = CONFIGURATOR.version;
|
||||
|
||||
if (version.indexOf(".") === -1) {
|
||||
version = version + ".0.0";
|
||||
version = `${version}.0.0`;
|
||||
}
|
||||
|
||||
const configuration = {
|
||||
|
@ -211,7 +211,7 @@ function configuration_backup(callback) {
|
|||
const filename = generateFilename(prefix, suffix);
|
||||
|
||||
const accepts = [{
|
||||
description: suffix.toUpperCase() + ' files', extensions: [suffix],
|
||||
description: `${suffix.toUpperCase()} files`, extensions: [suffix],
|
||||
}];
|
||||
|
||||
// create or load the file
|
||||
|
@ -229,7 +229,7 @@ function configuration_backup(callback) {
|
|||
|
||||
// echo/console log path specified
|
||||
chrome.fileSystem.getDisplayPath(chosenFileEntry, function (path) {
|
||||
console.log('Backup file path: ' + path);
|
||||
console.log(`Backup file path: ${path}`);
|
||||
});
|
||||
|
||||
// change file entry from read only to read/write
|
||||
|
@ -300,7 +300,7 @@ function configuration_restore(callback) {
|
|||
|
||||
// echo/console log path specified
|
||||
chrome.fileSystem.getDisplayPath(chosenFileEntry, function (path) {
|
||||
console.log('Restore file path: ' + path);
|
||||
console.log(`Restore file path: ${path}`);
|
||||
});
|
||||
|
||||
// read contents into variable
|
||||
|
|
|
@ -487,7 +487,7 @@ GuiControl.prototype.showInformationDialog = function(informationDialogSettings)
|
|||
|
||||
GuiControl.prototype.saveToTextFileDialog = function(textToSave, suggestedFileName, extension) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const accepts = [{ description: extension.toUpperCase() + ' files', extensions: [extension] }];
|
||||
const accepts = [{ description: `${extension.toUpperCase()} files`, extensions: [extension] }];
|
||||
|
||||
chrome.fileSystem.chooseEntry(
|
||||
{
|
||||
|
@ -535,7 +535,7 @@ GuiControl.prototype._saveToTextFileDialogFileSelected = function(entry, textToS
|
|||
|
||||
|
||||
GuiControl.prototype.readTextFileDialog = function(extension) {
|
||||
const accepts = [{ description: extension.toUpperCase() + ' files', extensions: [extension] }];
|
||||
const accepts = [{ description: `${extension.toUpperCase()} files`, extensions: [extension] }];
|
||||
|
||||
return new Promise(resolve => {
|
||||
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) {
|
||||
|
|
|
@ -810,7 +810,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
|
||||
case MSPCodes.MSP_API_VERSION:
|
||||
FC.CONFIG.mspProtocolVersion = data.readU8();
|
||||
FC.CONFIG.apiVersion = data.readU8() + '.' + data.readU8() + '.0';
|
||||
FC.CONFIG.apiVersion = `${data.readU8()}.${data.readU8()}.0`;
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_FC_VARIANT:
|
||||
|
@ -822,7 +822,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP_FC_VERSION:
|
||||
FC.CONFIG.flightControllerVersion = data.readU8() + '.' + data.readU8() + '.' + data.readU8();
|
||||
FC.CONFIG.flightControllerVersion = `${data.readU8()}.${data.readU8()}.${data.readU8()}`;
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_BUILD_INFO:
|
||||
|
@ -1741,9 +1741,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
|
||||
default:
|
||||
console.log('Unknown code detected: ' + code);
|
||||
console.log(`Unknown code detected: ${code}`);
|
||||
} else {
|
||||
console.log('FC reports unsupported message error: ' + code);
|
||||
console.log(`FC reports unsupported message error: ${code}`);
|
||||
|
||||
if (code === MSPCodes.MSP_SET_REBOOT) {
|
||||
TABS.onboard_logging.mscRebootFailedCallback();
|
||||
|
@ -2507,12 +2507,12 @@ MspHelper.prototype.dataflashRead = function(address, blockSize, onDataCallback)
|
|||
}
|
||||
} else {
|
||||
// Report address error
|
||||
console.log('Expected address ' + address + ' but received ' + chunkAddress + ' - retrying');
|
||||
console.log(`Expected address ${address} but received ${chunkAddress} - retrying`);
|
||||
onDataCallback(address, null); // returning null to the callback forces a retry
|
||||
}
|
||||
} else {
|
||||
// Report crc error
|
||||
console.log('CRC error for address ' + address + ' - retrying');
|
||||
console.log(`CRC error for address ${address} - retrying`);
|
||||
onDataCallback(address, null); // returning null to the callback forces a retry
|
||||
}
|
||||
}, true);
|
||||
|
|
|
@ -407,7 +407,7 @@ STM32_protocol.prototype.verify_chip_signature = function (signature) {
|
|||
if (this.hex.bytes_total < this.available_flash_size) {
|
||||
return true;
|
||||
} else {
|
||||
console.log('Supplied hex is bigger then flash available on the chip, HEX: ' + this.hex.bytes_total + ' bytes, limit = ' + this.available_flash_size + ' bytes');
|
||||
console.log(`Supplied hex is bigger then flash available on the chip, HEX: ${this.hex.bytes_total} bytes, limit = ${this.available_flash_size} bytes`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ STM32DFU_protocol.prototype.connect = function (device, hex, options, callback)
|
|||
|
||||
chrome.usb.getDevices(device, function (result) {
|
||||
if (result.length) {
|
||||
console.log('USB DFU detected with ID: ' + result[0].device);
|
||||
console.log(`USB DFU detected with ID: ${result[0].device}`);
|
||||
|
||||
self.openDevice(result[0]);
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@ STM32DFU_protocol.prototype.openDevice = function (device) {
|
|||
self.handle = handle;
|
||||
|
||||
GUI.log(i18n.getMessage('usbDeviceOpened', handle.handle.toString()));
|
||||
console.log('Device opened with Handle ID: ' + handle.handle);
|
||||
console.log(`Device opened with Handle ID: ${handle.handle}`);
|
||||
self.claimInterface(0);
|
||||
});
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ STM32DFU_protocol.prototype.closeDevice = function () {
|
|||
}
|
||||
|
||||
GUI.log(i18n.getMessage('usbDeviceClosed'));
|
||||
console.log('Device closed with Handle ID: ' + self.handle.handle);
|
||||
console.log(`Device closed with Handle ID: ${self.handle.handle}`);
|
||||
|
||||
self.handle = null;
|
||||
});
|
||||
|
@ -154,7 +154,7 @@ STM32DFU_protocol.prototype.claimInterface = function (interfaceNumber) {
|
|||
self.cleanup();
|
||||
}
|
||||
|
||||
console.log('Claimed interface: ' + interfaceNumber);
|
||||
console.log(`Claimed interface: ${interfaceNumber}`);
|
||||
|
||||
if (self.options.exitDfu) {
|
||||
self.leave();
|
||||
|
@ -168,7 +168,7 @@ STM32DFU_protocol.prototype.releaseInterface = function (interfaceNumber) {
|
|||
const self = this;
|
||||
|
||||
chrome.usb.releaseInterface(this.handle, interfaceNumber, function released() {
|
||||
console.log('Released interface: ' + interfaceNumber);
|
||||
console.log(`Released interface: ${interfaceNumber}`);
|
||||
|
||||
self.closeDevice();
|
||||
});
|
||||
|
@ -176,7 +176,7 @@ STM32DFU_protocol.prototype.releaseInterface = function (interfaceNumber) {
|
|||
|
||||
STM32DFU_protocol.prototype.resetDevice = function (callback) {
|
||||
chrome.usb.resetDevice(this.handle, function (result) {
|
||||
console.log('Reset Device: ' + result);
|
||||
console.log(`Reset Device: ${result}`);
|
||||
|
||||
if (callback) callback();
|
||||
});
|
||||
|
@ -195,7 +195,7 @@ STM32DFU_protocol.prototype.getString = function (index, callback) {
|
|||
'length': 255, // max length to retreive
|
||||
}, function (result) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('USB getString failed! ' + result.resultCode);
|
||||
console.log(`USB getString failed! ${result.resultCode}`);
|
||||
callback("", result.resultCode);
|
||||
return;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ STM32DFU_protocol.prototype.getInterfaceDescriptor = function (_interface, callb
|
|||
'length': 18 + _interface * 9,
|
||||
}, function (result) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('USB getInterfaceDescriptor failed! ' + result.resultCode);
|
||||
console.log(`USB getInterfaceDescriptor failed! ${result.resultCode}`);
|
||||
callback({}, result.resultCode);
|
||||
return;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ STM32DFU_protocol.prototype.getFunctionalDescriptor = function (_interface, call
|
|||
'length': 255,
|
||||
}, function (result) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('USB getFunctionalDescriptor failed! ' + result.resultCode);
|
||||
console.log(`USB getFunctionalDescriptor failed! ${result.resultCode}`);
|
||||
callback({}, result.resultCode);
|
||||
return;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
|
|||
// support option bytes.
|
||||
|
||||
if (tmp1.length > 3) {
|
||||
console.log('parseDescriptor: shrinking long descriptor "' + str + '"');
|
||||
console.log(`parseDescriptor: shrinking long descriptor "${str}"`);
|
||||
tmp1.length = 3;
|
||||
}
|
||||
if (!tmp1[0].startsWith("@")) {
|
||||
|
@ -446,9 +446,9 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
|
|||
'timeout': timeout,
|
||||
}, function (result) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('USB controlTransfer IN failed for request ' + request + '!');
|
||||
console.log(`USB controlTransfer IN failed for request ${request}!`);
|
||||
}
|
||||
if (result.resultCode) console.log('USB transfer result code: ' + result.resultCode);
|
||||
if (result.resultCode) console.log(`USB transfer result code: ${result.resultCode}`);
|
||||
|
||||
var buf = new Uint8Array(result.data);
|
||||
callback(buf, result.resultCode);
|
||||
|
@ -474,9 +474,9 @@ STM32DFU_protocol.prototype.controlTransfer = function (direction, request, valu
|
|||
'timeout': timeout,
|
||||
}, function (result) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('USB controlTransfer OUT failed for request ' + request + '!');
|
||||
console.log(`USB controlTransfer OUT failed for request ${request}!`);
|
||||
}
|
||||
if (result.resultCode) console.log('USB transfer result code: ' + result.resultCode);
|
||||
if (result.resultCode) console.log(`USB transfer result code: ${result.resultCode}`);
|
||||
|
||||
callback(result);
|
||||
});
|
||||
|
@ -542,12 +542,12 @@ STM32DFU_protocol.prototype.loadAddress = function (address, callback, abort) {
|
|||
STM32DFU_protocol.prototype.verify_flash = function (first_array, second_array) {
|
||||
for (var i = 0; i < first_array.length; i++) {
|
||||
if (first_array[i] != second_array[i]) {
|
||||
console.log('Verification failed on byte: ' + i + ' expected: 0x' + first_array[i].toString(16) + ' received: 0x' + second_array[i].toString(16));
|
||||
console.log(`Verification failed on byte: ${i} expected: 0x${first_array[i].toString(16)} received: 0x${second_array[i].toString(16)}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Verification successful, matching: ' + first_array.length + ' bytes');
|
||||
console.log(`Verification successful, matching: ${first_array.length} bytes`);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
@ -600,7 +600,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
case 0:
|
||||
self.getChipInfo(0, function (chipInfo, resultCode) {
|
||||
if (resultCode != 0 || typeof chipInfo === "undefined") {
|
||||
console.log('Failed to detect chip info, resultCode: ' + resultCode);
|
||||
console.log(`Failed to detect chip info, resultCode: ${resultCode}`);
|
||||
self.cleanup();
|
||||
} else {
|
||||
let nextAction;
|
||||
|
@ -643,7 +643,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
} else {
|
||||
self.getFunctionalDescriptor(0, function (descriptor, resultCode) {
|
||||
self.transferSize = resultCode ? 2048 : descriptor.wTransferSize;
|
||||
console.log('Using transfer size: ' + self.transferSize);
|
||||
console.log(`Using transfer size: ${self.transferSize}`);
|
||||
self.clearStatus(function () {
|
||||
self.upload_procedure(nextAction);
|
||||
});
|
||||
|
@ -717,7 +717,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
// 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);
|
||||
console.log(`USB transfer error while reading option bytes: ${errcode1}`);
|
||||
self.cleanup();
|
||||
return;
|
||||
}
|
||||
|
@ -853,8 +853,8 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
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 +
|
||||
', page ' + erase_pages[page].page + ' @ 0x' + page_addr.toString(16));
|
||||
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 () {
|
||||
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data) {
|
||||
|
@ -882,7 +882,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
if (data[4] == self.state.dfuIDLE) {
|
||||
erase_page_next();
|
||||
} else {
|
||||
console.log('Failed to erase page 0x' + page_addr.toString(16) + ' (did not reach dfuIDLE after clearing');
|
||||
console.log(`Failed to erase page 0x${page_addr.toString(16)} (did not reach dfuIDLE after clearing`);
|
||||
self.cleanup();
|
||||
}
|
||||
});
|
||||
|
@ -890,13 +890,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
} else if (data[4] == self.state.dfuDNLOAD_IDLE) {
|
||||
erase_page_next();
|
||||
} else {
|
||||
console.log('Failed to erase page 0x' + page_addr.toString(16));
|
||||
console.log(`Failed to erase page 0x${page_addr.toString(16)}`);
|
||||
self.cleanup();
|
||||
}
|
||||
});
|
||||
}, delay);
|
||||
} else {
|
||||
console.log('Failed to initiate page erase, page 0x' + page_addr.toString(16));
|
||||
console.log(`Failed to initiate page erase, page 0x${page_addr.toString(16)}`);
|
||||
self.cleanup();
|
||||
}
|
||||
});
|
||||
|
@ -945,13 +945,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
// flash another page
|
||||
write();
|
||||
} else {
|
||||
console.log('Failed to write ' + bytes_to_write + 'bytes to 0x' + address.toString(16));
|
||||
console.log(`Failed to write ${bytes_to_write}bytes to 0x${address.toString(16)}`);
|
||||
self.cleanup();
|
||||
}
|
||||
});
|
||||
}, delay);
|
||||
} else {
|
||||
console.log('Failed to initiate write ' + bytes_to_write + 'bytes to 0x' + address.toString(16));
|
||||
console.log(`Failed to initiate write ${bytes_to_write}bytes to 0x${address.toString(16)}`);
|
||||
self.cleanup();
|
||||
}
|
||||
});
|
||||
|
@ -1104,7 +1104,7 @@ STM32DFU_protocol.prototype.cleanup = function () {
|
|||
|
||||
var timeSpent = new Date().getTime() - self.upload_time_start;
|
||||
|
||||
console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds');
|
||||
console.log(`Script finished after: ${timeSpent / 1000} seconds`);
|
||||
|
||||
if (self.callback) {
|
||||
self.callback();
|
||||
|
|
|
@ -104,7 +104,7 @@ const serial = {
|
|||
|
||||
case 'frame_error':
|
||||
case 'parity_error':
|
||||
GUI.log(i18n.getMessage('serialError' + inflection.camelize(info.error)));
|
||||
GUI.log(i18n.getMessage(`serialError${inflection.camelize(info.error)}`));
|
||||
self.errorHandler(info.error, 'receive');
|
||||
break;
|
||||
case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI
|
||||
|
|
|
@ -789,17 +789,17 @@ function bit_clear(num, bit) {
|
|||
function update_dataflash_global() {
|
||||
function formatFilesize(bytes) {
|
||||
if (bytes < 1024) {
|
||||
return bytes + "B";
|
||||
return `${bytes}B`;
|
||||
}
|
||||
const kilobytes = bytes / 1024;
|
||||
|
||||
if (kilobytes < 1024) {
|
||||
return Math.round(kilobytes) + "kB";
|
||||
return `${Math.round(kilobytes)}kB`;
|
||||
}
|
||||
|
||||
const megabytes = kilobytes / 1024;
|
||||
|
||||
return megabytes.toFixed(1) + "MB";
|
||||
return `${megabytes.toFixed(1)}MB`;
|
||||
}
|
||||
|
||||
const supportsDataflash = FC.DATAFLASH.totalSize > 0;
|
||||
|
@ -814,10 +814,10 @@ function update_dataflash_global() {
|
|||
});
|
||||
|
||||
$(".dataflash-free_global").css({
|
||||
width: (100-(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize) / FC.DATAFLASH.totalSize * 100) + "%",
|
||||
width: `${100-(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize) / FC.DATAFLASH.totalSize * 100}%`,
|
||||
display: 'block',
|
||||
});
|
||||
$(".dataflash-free_global div").text('Dataflash: free ' + formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize));
|
||||
$(".dataflash-free_global div").text(`Dataflash: free ${formatFilesize(FC.DATAFLASH.totalSize - FC.DATAFLASH.usedSize)}`);
|
||||
} else {
|
||||
$(".noflash_global").css({
|
||||
display: 'block',
|
||||
|
|
|
@ -30,7 +30,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
const template = $('#tab-adjustments-templates .adjustments .adjustment');
|
||||
const newAdjustment = template.clone();
|
||||
|
||||
$(newAdjustment).attr('id', 'adjustment-' + adjustmentIndex);
|
||||
$(newAdjustment).attr('id', `adjustment-${adjustmentIndex}`);
|
||||
$(newAdjustment).data('index', adjustmentIndex);
|
||||
|
||||
//
|
||||
|
@ -51,7 +51,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
channelOptionTemplate.remove();
|
||||
for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) {
|
||||
const channelOption = channelOptionTemplate.clone();
|
||||
channelOption.text('AUX ' + (channelIndex + 1));
|
||||
channelOption.text(`AUX ${channelIndex + 1}`);
|
||||
channelOption.val(channelIndex);
|
||||
channelList.append(channelOption);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
let switchOption;
|
||||
for (let switchIndex = 0; switchIndex < auxChannelCount; switchIndex++) {
|
||||
switchOption = switchOptionTemplate.clone();
|
||||
switchOption.text('AUX ' + (switchIndex + 1));
|
||||
switchOption.text(`AUX ${switchIndex + 1}`);
|
||||
switchOption.val(switchIndex);
|
||||
switchList.append(switchOption);
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
return;
|
||||
}
|
||||
|
||||
$(this).find('.range .marker').css('left', percentage + '%');
|
||||
$(this).find('.range .marker').css('left', `${percentage}%`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ TABS.adjustments.adjust_template = function () {
|
|||
}
|
||||
|
||||
for (let i = 0; i < elementsNumber; i++) {
|
||||
selectFunction.append(new Option(i18n.getMessage('adjustmentsFunction' + i), i));
|
||||
selectFunction.append(new Option(i18n.getMessage(`adjustmentsFunction${i}`), i));
|
||||
}
|
||||
|
||||
// For 1.40, the D Setpoint has been replaced, so we replace it with the correct values
|
||||
|
|
|
@ -46,7 +46,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
// Adjust the name of the box if a peripheral is selected
|
||||
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
|
||||
|
||||
$(newMode).attr('id', 'mode-' + modeIndex);
|
||||
$(newMode).attr('id', `mode-${modeIndex}`);
|
||||
$(newMode).find('.name').text(modeName);
|
||||
|
||||
$(newMode).data('index', modeIndex);
|
||||
|
@ -99,7 +99,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
for (let channelIndex = 0; channelIndex < auxChannelCount; channelIndex++) {
|
||||
channelOption = channelOptionTemplate.clone();
|
||||
channelOption.text('AUX ' + (channelIndex + 1));
|
||||
channelOption.text(`AUX ${channelIndex + 1}`);
|
||||
channelOption.val(channelIndex);
|
||||
channelList.append(channelOption);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
const rangeIndex = modeRanges.children().length;
|
||||
|
||||
let rangeElement = $('#tab-auxiliary-templates .range').clone();
|
||||
rangeElement.attr('id', 'mode-' + modeIndex + '-range-' + rangeIndex);
|
||||
rangeElement.attr('id', `mode-${modeIndex}-range-${rangeIndex}`);
|
||||
modeRanges.append(rangeElement);
|
||||
|
||||
if (rangeIndex == 0) {
|
||||
|
@ -172,9 +172,9 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
}),
|
||||
});
|
||||
|
||||
const elementName = '#mode-' + modeIndex + '-range-' + rangeIndex;
|
||||
$(elementName + ' .channel-slider').Link('lower').to($(elementName + ' .lowerLimitValue'));
|
||||
$(elementName + ' .channel-slider').Link('upper').to($(elementName + ' .upperLimitValue'));
|
||||
const elementName = `#mode-${modeIndex}-range-${rangeIndex}`;
|
||||
$(`${elementName} .channel-slider`).Link('lower').to($(`${elementName} .lowerLimitValue`));
|
||||
$(`${elementName} .channel-slider`).Link('upper').to($(`${elementName} .upperLimitValue`));
|
||||
|
||||
let sliderValues = [900, 1000, 1200, 1400, 1500, 1600, 1800, 2000, 2100];
|
||||
if ($(window).width() < 575) {
|
||||
|
@ -215,7 +215,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
const linkIndex = modeRanges.children().length;
|
||||
|
||||
let linkElement = $('#tab-auxiliary-templates .link').clone();
|
||||
linkElement.attr('id', 'mode-' + modeIndex + '-link-' + linkIndex);
|
||||
linkElement.attr('id', `mode-${modeIndex}-link-${linkIndex}`);
|
||||
modeRanges.append(linkElement);
|
||||
|
||||
if (linkIndex == 0) {
|
||||
|
@ -226,7 +226,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
// disable the option associated with this mode
|
||||
const linkSelect = $(linkElement).find('.linkedTo');
|
||||
$(linkSelect).find('option[value="' + modeId + '"]').prop('disabled',true);
|
||||
$(linkSelect).find(`option[value="${modeId}"]`).prop('disabled',true);
|
||||
|
||||
$(linkElement).find('.deleteLink').data('linkElement', linkElement);
|
||||
$(linkElement).find('.deleteLink').data('modeElement', modeElement);
|
||||
|
@ -422,7 +422,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
return;
|
||||
}
|
||||
|
||||
$(this).find('.marker').css('left', percentage + '%');
|
||||
$(this).find('.marker').css('left', `${percentage}%`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
function update_ui() {
|
||||
let hasUsedMode = false;
|
||||
for (let i = 0; i < FC.AUX_CONFIG.length; i++) {
|
||||
let modeElement = $('#mode-' + i);
|
||||
let modeElement = $(`#mode-${i}`);
|
||||
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
|
||||
// if the mode is unused, skip it
|
||||
modeElement.removeClass('off').removeClass('on').removeClass('disabled');
|
||||
|
@ -469,7 +469,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
// that arming is disabled.
|
||||
if (armSwitchActive) {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('off').addClass('disabled');
|
||||
$('.mode .name').eq(i).html(FC.AUX_CONFIG[i] + '<br>' + i18n.getMessage('auxiliaryDisabled'));
|
||||
$('.mode .name').eq(i).html(`${FC.AUX_CONFIG[i]}<br>${i18n.getMessage('auxiliaryDisabled')}`);
|
||||
} else {
|
||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').removeClass('disabled').addClass('off');
|
||||
$('.mode .name').eq(i).html(FC.AUX_CONFIG[i]);
|
||||
|
@ -483,7 +483,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
let hideUnused = hideUnusedModes && hasUsedMode;
|
||||
for (let i = 0; i < FC.AUX_CONFIG.length; i++) {
|
||||
let modeElement = $('#mode-' + i);
|
||||
let modeElement = $(`#mode-${i}`);
|
||||
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
|
||||
modeElement.toggle(!hideUnused);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function commandWithBackSpaces(command, buffer, noOfCharsToDelete) {
|
|||
|
||||
function getCliCommand(command, cliBuffer) {
|
||||
const buffer = removePromptHash(cliBuffer);
|
||||
const bufferRegex = new RegExp('^' + buffer, 'g');
|
||||
const bufferRegex = new RegExp(`^${buffer}`, 'g');
|
||||
if (command.match(bufferRegex)) {
|
||||
return command.replace(bufferRegex, '');
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ TABS.cli.initialize = function (callback) {
|
|||
const filename = generateFilename(prefix, suffix);
|
||||
|
||||
const accepts = [{
|
||||
description: suffix.toUpperCase() + ' files', extensions: [suffix],
|
||||
description: `${suffix.toUpperCase()} files`, extensions: [suffix],
|
||||
}];
|
||||
|
||||
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, accepts: accepts}, function(entry) {
|
||||
|
@ -377,7 +377,7 @@ function writeLineToOutput(text) {
|
|||
if (text.startsWith("###ERROR")) {
|
||||
writeToOutput(`<span class="error_message">${text}</span><br>`);
|
||||
} else {
|
||||
writeToOutput(text + "<br>");
|
||||
writeToOutput(`${text}<br>`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,11 +488,11 @@ TABS.cli.read = function (readInfo) {
|
|||
};
|
||||
|
||||
TABS.cli.sendLine = function (line, callback) {
|
||||
this.send(line + '\n', callback);
|
||||
this.send(`${line}\n`, callback);
|
||||
};
|
||||
|
||||
TABS.cli.sendNativeAutoComplete = function (line, callback) {
|
||||
this.send(line + '\t', callback);
|
||||
this.send(`${line}\t`, callback);
|
||||
};
|
||||
|
||||
TABS.cli.send = function (line, callback) {
|
||||
|
|
|
@ -118,7 +118,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
let modeName = FC.AUX_CONFIG[modeIndex];
|
||||
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
|
||||
|
||||
auxAssignment[modeRange.auxChannelIndex] += "<span class=\"modename\">" + modeName + "</span>";
|
||||
auxAssignment[modeRange.auxChannelIndex] += `<span class="modename">${modeName}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,52 +136,53 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
for (let i = 0; i < FC.RXFAIL_CONFIG.length; i++) {
|
||||
if (i < channelNames.length) {
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||
fullChannels_e.append('\
|
||||
fullChannels_e.append(`\
|
||||
<div class="number">\
|
||||
<div class="channelprimary">\
|
||||
<span>' + channelNames[i] + '</span>\
|
||||
<span>${channelNames[i]}</span>\
|
||||
</div>\
|
||||
<div class="cf_tip channelsetting" title="' + i18n.getMessage("failsafeChannelFallbackSettingsAuto") + '">\
|
||||
<select class="aux_set" id="' + i + '">\
|
||||
<div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsAuto")}">\
|
||||
<select class="aux_set" id="${i}">\
|
||||
<option value="0">Auto</option>\
|
||||
<option value="1">Hold</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
');
|
||||
`);
|
||||
} else {
|
||||
fullChannels_e.append('\
|
||||
fullChannels_e.append(`\
|
||||
<div class="number">\
|
||||
<div class="channelprimary">\
|
||||
<span>' + channelNames[i] + '</span>\
|
||||
<span>${channelNames[i]}</span>\
|
||||
</div>\
|
||||
<div class="cf_tip channelsetting" title="' + i18n.getMessage("failsafeChannelFallbackSettingsAuto") + '">\
|
||||
<select class="aux_set" id="' + i + '">\
|
||||
<div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsAuto")}">\
|
||||
<select class="aux_set" id="${i}">\
|
||||
<option value="0">Auto</option>\
|
||||
<option value="1">Hold</option>\
|
||||
<option value="2">Set</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="' + i + '"/></div>\
|
||||
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${i}"/></div>\
|
||||
</div>\
|
||||
');
|
||||
`);
|
||||
}
|
||||
} else {
|
||||
fullChannels_e.append('\
|
||||
const messageKey = `controlAxisAux${aux_index++}`;
|
||||
fullChannels_e.append(`\
|
||||
<div class="number">\
|
||||
<div class="channelauxiliary">\
|
||||
<span class="channelname">' + i18n.getMessage("controlAxisAux" + (aux_index++)) + '</span>\
|
||||
' + auxAssignment[aux_assignment_index++] + '\
|
||||
<span class="channelname">${i18n.getMessage(messageKey)}</span>\
|
||||
${auxAssignment[aux_assignment_index++]}\
|
||||
</div>\
|
||||
<div class="cf_tip channelsetting" title="' + i18n.getMessage("failsafeChannelFallbackSettingsHold") + '">\
|
||||
<select class="aux_set" id="' + i + '">\
|
||||
<div class="cf_tip channelsetting" title="${i18n.getMessage("failsafeChannelFallbackSettingsHold")}">\
|
||||
<select class="aux_set" id="${i}">\
|
||||
<option value="1">Hold</option>\
|
||||
<option value="2">Set</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="' + i + '"/></div>\
|
||||
<div class="auxiliary"><input type="number" name="aux_value" min="750" max="2250" step="25" id="${i}"/></div>\
|
||||
</div>\
|
||||
');
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ firmware_flasher.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function show_loaded_hex(summary) {
|
||||
self.flashingMessage('<a class="save_firmware" href="#" title="Save Firmware">' + i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', self.parsed_hex.bytes_total) + '</a>',
|
||||
self.flashingMessage(`<a class="save_firmware" href="#" title="Save Firmware">${i18n.getMessage('firmwareFlasherFirmwareOnlineLoaded', self.parsed_hex.bytes_total)}</a>`,
|
||||
self.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
|
||||
self.enableFlashing(true);
|
||||
|
@ -205,7 +205,12 @@ firmware_flasher.initialize = function (callback) {
|
|||
return;
|
||||
}
|
||||
const date = new Date(release.published_at);
|
||||
const formattedDate = ("0" + date.getDate()).slice(-2) + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + date.getFullYear() + " " + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2);
|
||||
const dayOfTheMonth = `0${date.getDate()}`.slice(-2);
|
||||
const month = `0${date.getMonth() + 1}`.slice(-2);
|
||||
const year = date.getFullYear();
|
||||
const hours = `0${date.getHours()}`.slice(-2);
|
||||
const minutes = `0${date.getMinutes()}`.slice(-2);
|
||||
const formattedDate = `${dayOfTheMonth}-${month}-${year} ${hours}:${minutes}`;
|
||||
const descriptor = {
|
||||
"releaseUrl": release.html_url,
|
||||
"name" : version,
|
||||
|
|
|
@ -59,12 +59,12 @@ TABS.gps.initialize = function (callback) {
|
|||
}
|
||||
|
||||
$('.GPS_info td.fix').html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
|
||||
$('.GPS_info td.alt').text(alt + ' m');
|
||||
$('.GPS_info td.lat a').prop('href', url).text(lat.toFixed(4) + ' deg');
|
||||
$('.GPS_info td.lon a').prop('href', url).text(lon.toFixed(4) + ' deg');
|
||||
$('.GPS_info td.speed').text(FC.GPS_DATA.speed + ' cm/s');
|
||||
$('.GPS_info td.alt').text(`${alt} m`);
|
||||
$('.GPS_info td.lat a').prop('href', url).text(`${lat.toFixed(4)} deg`);
|
||||
$('.GPS_info td.lon a').prop('href', url).text(`${lon.toFixed(4)} deg`);
|
||||
$('.GPS_info td.speed').text(`${FC.GPS_DATA.speed} cm/s`);
|
||||
$('.GPS_info td.sats').text(FC.GPS_DATA.numSat);
|
||||
$('.GPS_info td.distToHome').text(FC.GPS_DATA.distanceToHome + ' m');
|
||||
$('.GPS_info td.distToHome').text(`${FC.GPS_DATA.distanceToHome} m`);
|
||||
|
||||
// Update GPS Signal Strengths
|
||||
const eSsTable = $('div.GPS_signal_strength table');
|
||||
|
|
|
@ -24,7 +24,7 @@ landing.initialize = function (callback) {
|
|||
bottomSection.append(' <a href="#" i18n="language_default_pretty" lang="DEFAULT"></a>');
|
||||
const languagesAvailables = i18n.getLanguagesAvailables();
|
||||
languagesAvailables.forEach(function(element) {
|
||||
bottomSection.append(' <a href="#" lang="' + element + '" i18n="language_' + element + '"></a>');
|
||||
bottomSection.append(` <a href="#" lang="${element}" i18n="language_${element}"></a>`);
|
||||
});
|
||||
bottomSection.find('a').each(function(index) {
|
||||
let element = $(this);
|
||||
|
|
|
@ -143,13 +143,13 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
const classesToRemove = [];
|
||||
|
||||
TABS.led_strip.baseFuncs.forEach(function(letter) {
|
||||
classesToRemove.push('function-' + letter);
|
||||
classesToRemove.push(`function-${letter}`);
|
||||
});
|
||||
TABS.led_strip.overlays.forEach(function(letter) {
|
||||
classesToRemove.push('function-' + letter);
|
||||
classesToRemove.push(`function-${letter}`);
|
||||
});
|
||||
TABS.led_strip.directions.forEach(function(letter) {
|
||||
classesToRemove.push('dir-' + letter);
|
||||
classesToRemove.push(`dir-${letter}`);
|
||||
});
|
||||
$(element).removeClass(classesToRemove.join(' '));
|
||||
}
|
||||
|
@ -159,13 +159,13 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
const that = this;
|
||||
if ($('.ui-selected').length > 0) {
|
||||
TABS.led_strip.directions.forEach(function(letter) {
|
||||
if ($(that).is('.dir-' + letter)) {
|
||||
if ($(that).is(`.dir-${letter}`)) {
|
||||
if ($(that).is('.btnOn')) {
|
||||
$(that).removeClass('btnOn');
|
||||
$('.ui-selected').removeClass('dir-' + letter);
|
||||
$('.ui-selected').removeClass(`dir-${letter}`);
|
||||
} else {
|
||||
$(that).addClass('btnOn');
|
||||
$('.ui-selected').addClass('dir-' + letter);
|
||||
$('.ui-selected').addClass(`dir-${letter}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -179,10 +179,10 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
$('.mode_colors').on('click', 'button', function() {
|
||||
const that = this;
|
||||
FC.LED_MODE_COLORS.forEach(function(mc) {
|
||||
if ($(that).is('.mode_color-' + mc.mode + '-' + mc.direction)) {
|
||||
if ($(that).is(`.mode_color-${mc.mode}-${mc.direction}`)) {
|
||||
if ($(that).is('.btnOn')) {
|
||||
$(that).removeClass('btnOn');
|
||||
$('.ui-selected').removeClass('mode_color-' + mc.mode + '-' + mc.direction);
|
||||
$('.ui-selected').removeClass(`mode_color-${mc.mode}-${mc.direction}`);
|
||||
selectedModeColor = null;
|
||||
} else {
|
||||
$(that).addClass('btnOn');
|
||||
|
@ -190,7 +190,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// select the color button
|
||||
for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
|
||||
const className = '.color-' + colorIndex;
|
||||
const className = `.color-${colorIndex}`;
|
||||
if (colorIndex == getModeColor(mc.mode, mc.direction)) {
|
||||
$(className).addClass('btnOn');
|
||||
selectedColorIndex = colorIndex;
|
||||
|
@ -237,12 +237,12 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
|
||||
colorButtons.removeClass('btnOn');
|
||||
if (selectedModeColor == undefined)
|
||||
$('.ui-selected').removeClass('color-' + colorIndex);
|
||||
$('.ui-selected').removeClass(`color-${colorIndex}`);
|
||||
|
||||
if ($(that).is('.color-' + colorIndex)) {
|
||||
if ($(that).is(`.color-${colorIndex}`)) {
|
||||
selectedColorIndex = colorIndex;
|
||||
if (selectedModeColor == undefined)
|
||||
$('.ui-selected').addClass('color-' + colorIndex);
|
||||
$('.ui-selected').addClass(`color-${colorIndex}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,21 +344,21 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// Get function & overlays or current cell
|
||||
TABS.led_strip.directions.forEach(function(letter) {
|
||||
const className = '.dir-' + letter;
|
||||
const className = `.dir-${letter}`;
|
||||
if ($(that).is(className)) {
|
||||
directionsInSelection.push(className);
|
||||
}
|
||||
});
|
||||
|
||||
TABS.led_strip.baseFuncs.forEach(function(letter) {
|
||||
const className = '.function-' + letter;
|
||||
const className = `.function-${letter}`;
|
||||
if ($(that).is(className)) {
|
||||
functionsInSelection.push(className);
|
||||
}
|
||||
});
|
||||
|
||||
TABS.led_strip.overlays.forEach(function(letter) {
|
||||
const className = '.function-' + letter;
|
||||
const className = `.function-${letter}`;
|
||||
if ($(that).is(className)) {
|
||||
functionsInSelection.push(className);
|
||||
}
|
||||
|
@ -370,8 +370,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
$('select.functionSelect').val("");
|
||||
|
||||
TABS.led_strip.baseFuncs.forEach(function(letter) {
|
||||
const className = 'function-' + letter;
|
||||
if ($('select.functionSelect').is("." + className)) {
|
||||
const className = `function-${letter}`;
|
||||
if ($('select.functionSelect').is(`.${className}`)) {
|
||||
$('select.functionSelect').removeClass(className);
|
||||
}
|
||||
});
|
||||
|
@ -382,7 +382,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// set active color
|
||||
for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
|
||||
const className = '.color-' + colorIndex;
|
||||
const className = `.color-${colorIndex}`;
|
||||
if ($(uiSelectedLast).is(className)) {
|
||||
$(className).addClass('btnOn');
|
||||
selectedColorIndex = colorIndex;
|
||||
|
@ -407,8 +407,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
// Update active function in combobox
|
||||
TABS.led_strip.baseFuncs.forEach(function(letter) {
|
||||
if ($(uiSelectedLast).is(functionTag + letter)) {
|
||||
$('select.functionSelect').val("function-" + letter);
|
||||
$('select.functionSelect').addClass("function-" + letter);
|
||||
$('select.functionSelect').val(`function-${letter}`);
|
||||
$('select.functionSelect').addClass(`function-${letter}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -443,9 +443,9 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
$('.mode_colors').find('button').each(function() {
|
||||
for (let i = 0; i < 6; i++) {
|
||||
for (let j = 0; j < 6; j++) {
|
||||
if ($(this).hasClass('mode_color-' + i + '-' + j)) {
|
||||
$(this).removeClass('mode_color-' + i + '-' + j);
|
||||
$(this).addClass('mode_color-' + mode + '-' + j);
|
||||
if ($(this).hasClass(`mode_color-${i}-${j}`)) {
|
||||
$(this).removeClass(`mode_color-${i}-${j}`);
|
||||
$(this).addClass(`mode_color-${mode}-${j}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,27 +469,27 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
case 't':
|
||||
case 'o':
|
||||
case 's':
|
||||
if (areModifiersActive('function-' + f))
|
||||
p.addClass('function-' + letter);
|
||||
if (areModifiersActive(`function-${f}`))
|
||||
p.addClass(`function-${letter}`);
|
||||
break;
|
||||
case 'b':
|
||||
case 'n':
|
||||
if (areBlinkersActive('function-' + f))
|
||||
p.addClass('function-' + letter);
|
||||
if (areBlinkersActive(`function-${f}`))
|
||||
p.addClass(`function-${letter}`);
|
||||
break;
|
||||
case 'i':
|
||||
if (areOverlaysActive('function-' + f))
|
||||
p.addClass('function-' + letter);
|
||||
if (areOverlaysActive(`function-${f}`))
|
||||
p.addClass(`function-${letter}`);
|
||||
break;
|
||||
case 'w':
|
||||
if (areOverlaysActive('function-' + f))
|
||||
if (isWarningActive('function-' + f))
|
||||
p.addClass('function-' + letter);
|
||||
if (areOverlaysActive(`function-${f}`))
|
||||
if (isWarningActive(`function-${f}`))
|
||||
p.addClass(`function-${letter}`);
|
||||
break;
|
||||
case 'v':
|
||||
if (areOverlaysActive('function-' + f))
|
||||
if (isVtxActive('function-' + f))
|
||||
p.addClass('function-' + letter);
|
||||
if (areOverlaysActive(`function-${f}`))
|
||||
if (isVtxActive(`function-${f}`))
|
||||
p.addClass(`function-${letter}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
$('.ui-selected').removeClass('function-' + letter);
|
||||
$('.ui-selected').removeClass(`function-${letter}`);
|
||||
}
|
||||
return $(that).is(':checked');
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
});
|
||||
|
||||
TABS.led_strip.directions.forEach(function(letter){
|
||||
if ($(that).is('.dir-' + letter)) {
|
||||
if ($(that).is(`.dir-${letter}`)) {
|
||||
directions += letter;
|
||||
}
|
||||
});
|
||||
|
@ -937,19 +937,19 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
const activeFunction = $('select.functionSelect').val();
|
||||
TABS.led_strip.baseFuncs.forEach(function(letter) {
|
||||
|
||||
if (activeFunction == 'function-' + letter) {
|
||||
$('select.functionSelect').addClass('function-' + letter);
|
||||
if (activeFunction == `function-${letter}`) {
|
||||
$('select.functionSelect').addClass(`function-${letter}`);
|
||||
|
||||
$('.ui-selected').find('.wire').each(function() {
|
||||
if ($(this).text() != "")
|
||||
$(this).parent().addClass('function-' + letter);
|
||||
$(this).parent().addClass(`function-${letter}`);
|
||||
});
|
||||
|
||||
unselectOverlays(letter);
|
||||
|
||||
} else {
|
||||
$('select.functionSelect').removeClass('function-' + letter);
|
||||
$('.ui-selected').removeClass('function-' + letter);
|
||||
$('select.functionSelect').removeClass(`function-${letter}`);
|
||||
$('.ui-selected').removeClass(`function-${letter}`);
|
||||
}
|
||||
|
||||
if (activeFunction == '') {
|
||||
|
@ -990,11 +990,11 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function unselectOverlay(func, overlay) {
|
||||
$('input.function-' + overlay).prop('checked', false);
|
||||
$('input.function-' + overlay).change();
|
||||
$(`input.function-${overlay}`).prop('checked', false);
|
||||
$(`input.function-${overlay}`).change();
|
||||
$('.ui-selected').each(function() {
|
||||
if (func === '' || $(this).is(functionTag + func)) {
|
||||
$(this).removeClass('function-' + overlay);
|
||||
$(this).removeClass(`function-${overlay}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
value = Number(value);
|
||||
|
||||
const className = '.color-' + selectedColorIndex;
|
||||
const className = `.color-${selectedColorIndex}`;
|
||||
if ($(className).hasClass('btnOn')) {
|
||||
switch (hsvIndex) {
|
||||
case 0:
|
||||
|
@ -1049,12 +1049,12 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
$(this).find('.overlay-color').show();
|
||||
|
||||
for (let colorIndex = 0; colorIndex < 16; colorIndex++) {
|
||||
const className = 'color-' + colorIndex;
|
||||
if ($(this).is('.' + className)) {
|
||||
const className = `color-${colorIndex}`;
|
||||
if ($(this).is(`.${className}`)) {
|
||||
$(this).find('.overlay-color').addClass(className);
|
||||
$(this).find('.overlay-color').css('background-color', HsvToColor(FC.LED_COLORS[colorIndex]));
|
||||
} else {
|
||||
if ($(this).find('.overlay-color').is('.' + className))
|
||||
if ($(this).find('.overlay-color').is(`.${className}`))
|
||||
$(this).find('.overlay-color').removeClass(className);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,17 +158,17 @@ logging.initialize = function (callback) {
|
|||
break;
|
||||
case 'MSP_RC':
|
||||
for (let chan = 0; chan < FC.RC.active_channels; chan++) {
|
||||
head += ',' + 'RC' + chan;
|
||||
head += `${',' + 'RC'}${chan}`;
|
||||
}
|
||||
break;
|
||||
case 'MSP_MOTOR':
|
||||
for (let motor = 0; motor < FC.MOTOR_DATA.length; motor++) {
|
||||
head += ',' + 'Motor' + motor;
|
||||
head += `${',' + 'Motor'}${motor}`;
|
||||
}
|
||||
break;
|
||||
case 'MSP_DEBUG':
|
||||
for (let debug = 0; debug < FC.SENSOR_DATA.debug.length; debug++) {
|
||||
head += ',' + 'Debug' + debug;
|
||||
head += `${',' + 'Debug'}${debug}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -183,43 +183,43 @@ logging.initialize = function (callback) {
|
|||
for (let i = 0; i < requestedProperties.length; i++) {
|
||||
switch (requestedProperties[i]) {
|
||||
case 'MSP_RAW_IMU':
|
||||
sample += ',' + FC.SENSOR_DATA.gyroscope;
|
||||
sample += ',' + FC.SENSOR_DATA.accelerometer;
|
||||
sample += ',' + FC.SENSOR_DATA.magnetometer;
|
||||
sample += `,${FC.SENSOR_DATA.gyroscope}`;
|
||||
sample += `,${FC.SENSOR_DATA.accelerometer}`;
|
||||
sample += `,${FC.SENSOR_DATA.magnetometer}`;
|
||||
break;
|
||||
case 'MSP_ATTITUDE':
|
||||
sample += ',' + FC.SENSOR_DATA.kinematics[0];
|
||||
sample += ',' + FC.SENSOR_DATA.kinematics[1];
|
||||
sample += ',' + FC.SENSOR_DATA.kinematics[2];
|
||||
sample += `,${FC.SENSOR_DATA.kinematics[0]}`;
|
||||
sample += `,${FC.SENSOR_DATA.kinematics[1]}`;
|
||||
sample += `,${FC.SENSOR_DATA.kinematics[2]}`;
|
||||
break;
|
||||
case 'MSP_ALTITUDE':
|
||||
sample += ',' + FC.SENSOR_DATA.altitude;
|
||||
sample += `,${FC.SENSOR_DATA.altitude}`;
|
||||
break;
|
||||
case 'MSP_RAW_GPS':
|
||||
sample += ',' + FC.GPS_DATA.fix;
|
||||
sample += ',' + FC.GPS_DATA.numSat;
|
||||
sample += ',' + (FC.GPS_DATA.lat / 10000000);
|
||||
sample += ',' + (FC.GPS_DATA.lon / 10000000);
|
||||
sample += ',' + FC.GPS_DATA.alt;
|
||||
sample += ',' + FC.GPS_DATA.speed;
|
||||
sample += ',' + FC.GPS_DATA.ground_course;
|
||||
sample += `,${FC.GPS_DATA.fix}`;
|
||||
sample += `,${FC.GPS_DATA.numSat}`;
|
||||
sample += `,${FC.GPS_DATA.lat / 10000000}`;
|
||||
sample += `,${FC.GPS_DATA.lon / 10000000}`;
|
||||
sample += `,${FC.GPS_DATA.alt}`;
|
||||
sample += `,${FC.GPS_DATA.speed}`;
|
||||
sample += `,${FC.GPS_DATA.ground_course}`;
|
||||
break;
|
||||
case 'MSP_ANALOG':
|
||||
sample += ',' + FC.ANALOG.voltage;
|
||||
sample += ',' + FC.ANALOG.amperage;
|
||||
sample += ',' + FC.ANALOG.mAhdrawn;
|
||||
sample += ',' + FC.ANALOG.rssi;
|
||||
sample += `,${FC.ANALOG.voltage}`;
|
||||
sample += `,${FC.ANALOG.amperage}`;
|
||||
sample += `,${FC.ANALOG.mAhdrawn}`;
|
||||
sample += `,${FC.ANALOG.rssi}`;
|
||||
break;
|
||||
case 'MSP_RC':
|
||||
for (let chan = 0; chan < FC.RC.active_channels; chan++) {
|
||||
sample += ',' + FC.RC.channels[chan];
|
||||
sample += `,${FC.RC.channels[chan]}`;
|
||||
}
|
||||
break;
|
||||
case 'MSP_MOTOR':
|
||||
sample += ',' + FC.MOTOR_DATA;
|
||||
sample += `,${FC.MOTOR_DATA}`;
|
||||
break;
|
||||
case 'MSP_DEBUG':
|
||||
sample += ',' + FC.SENSOR_DATA.debug;
|
||||
sample += `,${FC.SENSOR_DATA.debug}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ logging.initialize = function (callback) {
|
|||
const filename = generateFilename(prefix, suffix);
|
||||
|
||||
const accepts = [{
|
||||
description: suffix.toUpperCase() + ' files', extensions: [suffix],
|
||||
description: `${suffix.toUpperCase()} files`, extensions: [suffix],
|
||||
}];
|
||||
|
||||
// create or load the file
|
||||
|
@ -252,7 +252,7 @@ logging.initialize = function (callback) {
|
|||
|
||||
// echo/console log path specified
|
||||
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
|
||||
console.log('Log file path: ' + path);
|
||||
console.log(`Log file path: ${path}`);
|
||||
});
|
||||
|
||||
// change file entry from read only to read/write
|
||||
|
@ -315,7 +315,7 @@ logging.initialize = function (callback) {
|
|||
fileWriter.seek(fileWriter.length);
|
||||
}
|
||||
|
||||
fileWriter.write(new Blob([data + '\n'], {type: 'text/plain'}));
|
||||
fileWriter.write(new Blob([`${data}\n`], {type: 'text/plain'}));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1016,7 +1016,7 @@ TABS.motors.initialize = function (callback) {
|
|||
|
||||
// Reduce the size of the value if too big
|
||||
if (rpmMotorValue > 999999) {
|
||||
rpmMotorValue = (rpmMotorValue / 1000000).toFixed(5 - (rpmMotorValue / 1000000).toFixed(0).toString().length) + "M";
|
||||
rpmMotorValue = `${(rpmMotorValue / 1000000).toFixed(5 - (rpmMotorValue / 1000000).toFixed(0).toString().length)}M`;
|
||||
}
|
||||
|
||||
rpmMotorValue = rpmMotorValue.toString().padStart(MAX_VALUE_SIZE);
|
||||
|
|
|
@ -167,21 +167,21 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
deviceSelect.empty();
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
|
||||
deviceSelect.append('<option value="0">' + i18n.getMessage('blackboxLoggingNone') + '</option>');
|
||||
deviceSelect.append(`<option value="0">${i18n.getMessage('blackboxLoggingNone')}</option>`);
|
||||
if (FC.DATAFLASH.supported) {
|
||||
deviceSelect.append('<option value="1">' + i18n.getMessage('blackboxLoggingFlash') + '</option>');
|
||||
deviceSelect.append(`<option value="1">${i18n.getMessage('blackboxLoggingFlash')}</option>`);
|
||||
}
|
||||
if (FC.SDCARD.supported) {
|
||||
deviceSelect.append('<option value="2">' + i18n.getMessage('blackboxLoggingSdCard') + '</option>');
|
||||
deviceSelect.append(`<option value="2">${i18n.getMessage('blackboxLoggingSdCard')}</option>`);
|
||||
}
|
||||
deviceSelect.append('<option value="3">' + i18n.getMessage('blackboxLoggingSerial') + '</option>');
|
||||
deviceSelect.append(`<option value="3">${i18n.getMessage('blackboxLoggingSerial')}</option>`);
|
||||
} else {
|
||||
deviceSelect.append('<option value="0">' + i18n.getMessage('blackboxLoggingSerial') + '</option>');
|
||||
deviceSelect.append(`<option value="0">${i18n.getMessage('blackboxLoggingSerial')}</option>`);
|
||||
if (FC.DATAFLASH.ready) {
|
||||
deviceSelect.append('<option value="1">' + i18n.getMessage('blackboxLoggingFlash') + '</option>');
|
||||
deviceSelect.append(`<option value="1">${i18n.getMessage('blackboxLoggingFlash')}</option>`);
|
||||
}
|
||||
if (FC.SDCARD.supported) {
|
||||
deviceSelect.append('<option value="2">' + i18n.getMessage('blackboxLoggingSdCard') + '</option>');
|
||||
deviceSelect.append(`<option value="2">${i18n.getMessage('blackboxLoggingSdCard')}</option>`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,11 +264,11 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
loggingRateUnit = " kHz";
|
||||
}
|
||||
}
|
||||
loggingRatesSelect.append('<option value="' + loggingRates[i].num + '/' + loggingRates[i].denom + '">'
|
||||
+ loggingRate + loggingRateUnit + ' (' + Math.round(loggingRates[i].num / loggingRates[i].denom * 100) + '%)</option>');
|
||||
loggingRatesSelect.append(`<option value="${loggingRates[i].num}/${loggingRates[i].denom}">${
|
||||
loggingRate}${loggingRateUnit} (${Math.round(loggingRates[i].num / loggingRates[i].denom * 100)}%)</option>`);
|
||||
|
||||
}
|
||||
loggingRatesSelect.val(FC.BLACKBOX.blackboxRateNum + '/' + FC.BLACKBOX.blackboxRateDenom);
|
||||
loggingRatesSelect.val(`${FC.BLACKBOX.blackboxRateNum}/${FC.BLACKBOX.blackboxRateDenom}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,24 +384,24 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
|
||||
function formatFilesizeKilobytes(kilobytes) {
|
||||
if (kilobytes < 1024) {
|
||||
return Math.round(kilobytes) + "kB";
|
||||
return `${Math.round(kilobytes)}kB`;
|
||||
}
|
||||
|
||||
const megabytes = kilobytes / 1024;
|
||||
let gigabytes;
|
||||
|
||||
if (megabytes < 900) {
|
||||
return megabytes.toFixed(1) + "MB";
|
||||
return `${megabytes.toFixed(1)}MB`;
|
||||
} else {
|
||||
gigabytes = megabytes / 1024;
|
||||
|
||||
return gigabytes.toFixed(1) + "GB";
|
||||
return `${gigabytes.toFixed(1)}GB`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatFilesizeBytes(bytes) {
|
||||
if (bytes < 1024) {
|
||||
return bytes + "B";
|
||||
return `${bytes}B`;
|
||||
}
|
||||
return formatFilesizeKilobytes(bytes / 1024);
|
||||
}
|
||||
|
@ -409,11 +409,11 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
function update_bar_width(bar, value, total, label, valuesAreKilobytes) {
|
||||
if (value > 0) {
|
||||
bar.css({
|
||||
width: (value / total * 100) + "%",
|
||||
width: `${value / total * 100}%`,
|
||||
display: 'block',
|
||||
});
|
||||
|
||||
$("div", bar).text((label ? label + " " : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value)));
|
||||
$("div", bar).text((label ? `${label} ` : "") + (valuesAreKilobytes ? formatFilesizeKilobytes(value) : formatFilesizeBytes(value)));
|
||||
} else {
|
||||
bar.css({
|
||||
display: 'none',
|
||||
|
@ -515,8 +515,8 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'SaveDataflash');
|
||||
|
||||
const totalTime = (new Date().getTime() - startTime) / 1000;
|
||||
console.log('Received ' + totalBytes + ' bytes in ' + totalTime.toFixed(2) + 's ('
|
||||
+ (totalBytes / totalTime / 1024).toFixed(2) + 'kB / s) with block size ' + self.blockSize + '.');
|
||||
console.log(`Received ${totalBytes} bytes in ${totalTime.toFixed(2)}s (${
|
||||
(totalBytes / totalTime / 1024).toFixed(2)}kB / s) with block size ${self.blockSize}.`);
|
||||
if (!isNaN(totalBytesCompressed)) {
|
||||
console.log('Compressed into', totalBytesCompressed, 'bytes with mean compression factor of', totalBytes / totalBytesCompressed);
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
const filename = generateFilename(prefix, suffix);
|
||||
|
||||
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) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
if (chrome.runtime.lastError.message !== "User cancelled") {
|
||||
GUI.log(i18n.getMessage('dataflashFileWriteFailed'));
|
||||
|
@ -624,12 +624,12 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
|
||||
// echo/console log path specified
|
||||
chrome.fileSystem.getDisplayPath(fileEntry, function(path) {
|
||||
console.log('Dataflash dump file path: ' + path);
|
||||
console.log(`Dataflash dump file path: ${path}`);
|
||||
});
|
||||
|
||||
fileEntry.createWriter(function (fileWriter) {
|
||||
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);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
|
||||
|
||||
// Look into the PID table to a row with the name of the pid
|
||||
const searchRow = $('.pid_tuning .' + elementPid + ' input');
|
||||
const searchRow = $(`.pid_tuning .${elementPid} input`);
|
||||
|
||||
// Assign each value
|
||||
searchRow.each((indexInput, element) => {
|
||||
|
@ -1016,14 +1016,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
// The notch cutoff must be smaller than the notch frecuency
|
||||
function adjustNotchCutoff(frequencyName, cutoffName) {
|
||||
const frecuency = parseInt($(".pid_filter input[name='" + frequencyName + "']").val());
|
||||
const cutoff = parseInt($(".pid_filter input[name='" + cutoffName + "']").val());
|
||||
const frecuency = parseInt($(`.pid_filter input[name='${frequencyName}']`).val());
|
||||
const cutoff = parseInt($(`.pid_filter input[name='${cutoffName}']`).val());
|
||||
|
||||
// Change the max and refresh the value if needed
|
||||
const maxCutoff = frecuency == 0 ? 0 : frecuency - 1;
|
||||
$(".pid_filter input[name='" + cutoffName + "']").attr("max", maxCutoff);
|
||||
$(`.pid_filter input[name='${cutoffName}']`).attr("max", maxCutoff);
|
||||
if (cutoff >= frecuency) {
|
||||
$(".pid_filter input[name='" + cutoffName + "']").val(maxCutoff);
|
||||
$(`.pid_filter input[name='${cutoffName}']`).val(maxCutoff);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
|
||||
|
||||
// Look into the PID table to a row with the name of the pid
|
||||
const searchRow = $('.pid_tuning .' + elementPid + ' input');
|
||||
const searchRow = $(`.pid_tuning .${elementPid} input`);
|
||||
|
||||
// Assign each value
|
||||
searchRow.each(function (indexInput) {
|
||||
|
@ -1320,10 +1320,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
// Only show rows supported by the firmware
|
||||
FC.PID_NAMES.forEach(function(elementPid) {
|
||||
// Show rows for the PID
|
||||
$('.pid_tuning .' + elementPid).show();
|
||||
$(`.pid_tuning .${elementPid}`).show();
|
||||
|
||||
// Show titles and other elements needed by the PID
|
||||
$('.needed_by_' + elementPid).show();
|
||||
$(`.needed_by_${elementPid}`).show();
|
||||
});
|
||||
|
||||
// Special case
|
||||
|
@ -1549,7 +1549,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function populateProfilesSelector(_selectProfileValues) {
|
||||
const profileSelect = $('select[name="profile"]');
|
||||
_selectProfileValues.forEach(function(value, key) {
|
||||
profileSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
profileSelect.append(`<option value="${key}">${value}</option>`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1558,7 +1558,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function populateRateProfilesSelector(_selectRateProfileValues) {
|
||||
const rateProfileSelect = $('select[name="rate_profile"]');
|
||||
_selectRateProfileValues.forEach(function(value, key) {
|
||||
rateProfileSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
rateProfileSelect.append(`<option value="${key}">${value}</option>`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1689,9 +1689,9 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function populateFilterTypeSelector(name, selectDtermValues) {
|
||||
const dtermFilterSelect = $('select[name="' + name + '"]');
|
||||
const dtermFilterSelect = $(`select[name="${name}"]`);
|
||||
selectDtermValues.forEach(function(value, key) {
|
||||
dtermFilterSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
dtermFilterSelect.append(`<option value="${key}">${value}</option>`);
|
||||
});
|
||||
}
|
||||
// Added in API 1.42.0
|
||||
|
@ -1701,7 +1701,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function populateDynamicNotchRangeSelect(selectDynamicNotchRangeValues) {
|
||||
const dynamicNotchRangeSelect = $('select[name="dynamicNotchRange"]');
|
||||
selectDynamicNotchRangeValues.forEach(function(value, key) {
|
||||
dynamicNotchRangeSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
dynamicNotchRangeSelect.append(`<option value="${key}">${value}</option>`);
|
||||
});
|
||||
}
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
|
@ -1723,15 +1723,15 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
function activateSubtab(subtabName) {
|
||||
const names = ['pid', 'rates', 'filter'];
|
||||
if (!names.includes(subtabName)) {
|
||||
console.debug('Invalid subtab name: "' + subtabName + '"');
|
||||
console.debug(`Invalid subtab name: "${subtabName}"`);
|
||||
return;
|
||||
}
|
||||
for (name of names) {
|
||||
const el = $('.tab-pid_tuning .subtab-' + name);
|
||||
const el = $(`.tab-pid_tuning .subtab-${name}`);
|
||||
el[name == subtabName ? 'show' : 'hide']();
|
||||
}
|
||||
$('.tab-pid_tuning .tab-container .tab').removeClass('active');
|
||||
$('.tab-pid_tuning .tab-container .' + subtabName).addClass('active');
|
||||
$(`.tab-pid_tuning .tab-container .${subtabName}`).addClass('active');
|
||||
self.activeSubtab = subtabName;
|
||||
if (subtabName == 'rates') {
|
||||
// force drawing of throttle curve once the throttle curve container element is available
|
||||
|
@ -1771,7 +1771,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
|
||||
for (let i = 0; i < pidControllerList.length; i++) {
|
||||
pidController_e.append('<option value="' + (i) + '">' + pidControllerList[i].name + '</option>');
|
||||
pidController_e.append(`<option value="${i}">${pidControllerList[i].name}</option>`);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_MIN_SUPPORTED_PID_CONTROLLER_CHANGE)) {
|
||||
|
@ -2003,11 +2003,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
context.fill();
|
||||
context.save();
|
||||
let fontSize = 10;
|
||||
context.font = fontSize + "pt Verdana, Arial, sans-serif";
|
||||
context.font = `${fontSize}pt Verdana, Arial, sans-serif`;
|
||||
let realthr = thrPercent * 100.0,
|
||||
expothr = 100 - (thrpos.y / canvasHeight) * 100.0,
|
||||
thrlabel = Math.round(thrPercent <= 0 ? 0 : realthr) + "%" +
|
||||
" = " + Math.round(thrPercent <= 0 ? 0 : expothr) + "%",
|
||||
thrlabel = `${Math.round(thrPercent <= 0 ? 0 : realthr)}%` +
|
||||
` = ${Math.round(thrPercent <= 0 ? 0 : expothr)}%`,
|
||||
textWidth = context.measureText(thrlabel);
|
||||
context.fillStyle = '#000';
|
||||
context.scale(textWidth / throttleCurve.clientWidth, 1);
|
||||
|
@ -2855,9 +2855,9 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
|||
|
||||
stickContext.save();
|
||||
|
||||
const maxAngularVelRoll = self.maxAngularVelRollElement.text() + ' deg/s';
|
||||
const maxAngularVelPitch = self.maxAngularVelPitchElement.text() + ' deg/s';
|
||||
const maxAngularVelYaw = self.maxAngularVelYawElement.text() + ' deg/s';
|
||||
const maxAngularVelRoll = `${self.maxAngularVelRollElement.text()} deg/s`;
|
||||
const maxAngularVelPitch = `${self.maxAngularVelPitchElement.text()} deg/s`;
|
||||
const maxAngularVelYaw = `${self.maxAngularVelYawElement.text()} deg/s`;
|
||||
let currentValues = [];
|
||||
let balloonsDirty = [];
|
||||
const curveHeight = rcStickElement.height;
|
||||
|
@ -2874,13 +2874,13 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
|||
if (windowScale <= 1) {
|
||||
stickContext.font = "24pt Verdana, Arial, sans-serif";
|
||||
} else {
|
||||
stickContext.font = (24 * windowScale) + "pt Verdana, Arial, sans-serif";
|
||||
stickContext.font = `${24 * windowScale}pt Verdana, Arial, sans-serif`;
|
||||
}
|
||||
|
||||
if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) {
|
||||
currentValues.push(self.rateCurve.drawStickPosition(FC.RC.channels[0], self.currentRates.roll_rate, self.currentRates.rc_rate, self.currentRates.rc_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.roll_rate_limit, maxAngularVel, stickContext, '#FF8080') + ' deg/s');
|
||||
currentValues.push(self.rateCurve.drawStickPosition(FC.RC.channels[1], self.currentRates.pitch_rate, self.currentRates.rc_rate_pitch, self.currentRates.rc_pitch_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.pitch_rate_limit, maxAngularVel, stickContext, '#80FF80') + ' deg/s');
|
||||
currentValues.push(self.rateCurve.drawStickPosition(FC.RC.channels[2], self.currentRates.yaw_rate, self.currentRates.rc_rate_yaw, self.currentRates.rc_yaw_expo, self.currentRates.superexpo, self.currentRates.yawDeadband, self.currentRates.yaw_rate_limit, maxAngularVel, stickContext, '#8080FF') + ' deg/s');
|
||||
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[0], self.currentRates.roll_rate, self.currentRates.rc_rate, self.currentRates.rc_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.roll_rate_limit, maxAngularVel, stickContext, '#FF8080')} deg/s`);
|
||||
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[1], self.currentRates.pitch_rate, self.currentRates.rc_rate_pitch, self.currentRates.rc_pitch_expo, self.currentRates.superexpo, self.currentRates.deadband, self.currentRates.pitch_rate_limit, maxAngularVel, stickContext, '#80FF80')} deg/s`);
|
||||
currentValues.push(`${self.rateCurve.drawStickPosition(FC.RC.channels[2], self.currentRates.yaw_rate, self.currentRates.rc_rate_yaw, self.currentRates.rc_yaw_expo, self.currentRates.superexpo, self.currentRates.yawDeadband, self.currentRates.yaw_rate_limit, maxAngularVel, stickContext, '#8080FF')} deg/s`);
|
||||
} else {
|
||||
currentValues = [];
|
||||
}
|
||||
|
@ -2891,7 +2891,7 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
|||
stickContext.scale(textScale, 1);
|
||||
|
||||
// add the maximum range label
|
||||
drawAxisLabel(stickContext, maxAngularVel.toFixed(0) + ' deg/s', ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right');
|
||||
drawAxisLabel(stickContext, `${maxAngularVel.toFixed(0)} deg/s`, ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right');
|
||||
|
||||
// and then the balloon labels.
|
||||
balloonsDirty = []; // reset the dirty balloon draw area (for overlap detection)
|
||||
|
@ -2995,7 +2995,7 @@ TABS.pid_tuning.updatePIDColors = function(clear = false) {
|
|||
};
|
||||
|
||||
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
|
||||
$(".pid_tuning ." + elementPid + " input").each(function(indexInput) {
|
||||
$(`.pid_tuning .${elementPid} input`).each(function(indexInput) {
|
||||
setTuningElementColor($(this), FC.PIDS_ACTIVE[indexPid][indexInput], FC.PIDS[indexPid][indexInput]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -88,7 +88,7 @@ TABS.power.initialize = function (callback) {
|
|||
const elementVoltageMeter = templateVoltageMeter.clone();
|
||||
$(elementVoltageMeter).attr('id', `voltage-meter-${index}`);
|
||||
|
||||
const message = i18n.getMessage('powerVoltageId' + FC.VOLTAGE_METERS[index].id);
|
||||
const message = i18n.getMessage(`powerVoltageId${FC.VOLTAGE_METERS[index].id}`);
|
||||
$(elementVoltageMeter).find('.label').text(message);
|
||||
destinationVoltageMeter.append(elementVoltageMeter);
|
||||
|
||||
|
@ -106,7 +106,7 @@ TABS.power.initialize = function (callback) {
|
|||
|
||||
const attributeNames = ["vbatscale", "vbatresdivval", "vbatresdivmultiplier"];
|
||||
for (let attributeName of attributeNames) {
|
||||
$(elementVoltageConfiguration).find(`input[name="${attributeName}"]`).attr('name', attributeName + '-' + index);
|
||||
$(elementVoltageConfiguration).find(`input[name="${attributeName}"]`).attr('name', `${attributeName}-${index}`);
|
||||
}
|
||||
destinationVoltageConfiguration.append(elementVoltageConfiguration);
|
||||
|
||||
|
@ -146,7 +146,7 @@ TABS.power.initialize = function (callback) {
|
|||
const elementAmperageMeter = templateAmperageMeter.clone();
|
||||
$(elementAmperageMeter).attr('id', `amperage-meter-${index}`);
|
||||
|
||||
const message = i18n.getMessage('powerAmperageId' + FC.CURRENT_METERS[index].id);
|
||||
const message = i18n.getMessage(`powerAmperageId${FC.CURRENT_METERS[index].id}`);
|
||||
$(elementAmperageMeter).find('.label').text(message);
|
||||
destinationAmperageMeter.append(elementAmperageMeter);
|
||||
|
||||
|
|
|
@ -122,22 +122,22 @@ TABS.receiver.initialize = function (callback) {
|
|||
if (i < bar_names.length) {
|
||||
name = bar_names[i];
|
||||
} else {
|
||||
name = i18n.getMessage("controlAxisAux" + (auxIndex++));
|
||||
name = i18n.getMessage(`controlAxisAux${auxIndex++}`);
|
||||
}
|
||||
|
||||
barContainer.append('\
|
||||
barContainer.append(`\
|
||||
<ul>\
|
||||
<li class="name">' + name + '</li>\
|
||||
<li class="name">${name}</li>\
|
||||
<li class="meter">\
|
||||
<div class="meter-bar">\
|
||||
<div class="label"></div>\
|
||||
<div class="fill' + (FC.RC.active_channels == 0 ? 'disabled' : '') + '">\
|
||||
<div class="fill${FC.RC.active_channels == 0 ? 'disabled' : ''}">\
|
||||
<div class="label"></div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</li>\
|
||||
</ul>\
|
||||
');
|
||||
`);
|
||||
}
|
||||
|
||||
// we could probably use min and max throttle for the range, will see
|
||||
|
@ -233,7 +233,8 @@ TABS.receiver.initialize = function (callback) {
|
|||
rssi_channel_e.append(`<option value="0">${i18n.getMessage("receiverRssiChannelDisabledOption")}</option>`);
|
||||
//1-4 reserved for Roll Pitch Yaw & Throttle, starting at 5
|
||||
for (let i = 5; i < FC.RC.active_channels + 1; i++) {
|
||||
rssi_channel_e.append(`<option value="${i}">${i18n.getMessage("controlAxisAux" + (i-4))}</option>`);
|
||||
const messageKey = `controlAxisAux${i-4}`;
|
||||
rssi_channel_e.append(`<option value="${i}">${i18n.getMessage(messageKey)}</option>`);
|
||||
}
|
||||
|
||||
$('select[name="rssi_channel"]').val(FC.RSSI_CONFIG.channel);
|
||||
|
@ -715,7 +716,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
// update bars with latest data
|
||||
for (let i = 0; i < FC.RC.active_channels; i++) {
|
||||
meterFillArray[i].css('width', ((FC.RC.channels[i] - meterScale.min) / (meterScale.max - meterScale.min) * 100).clamp(0, 100) + '%');
|
||||
meterFillArray[i].css('width', `${((FC.RC.channels[i] - meterScale.min) / (meterScale.max - meterScale.min) * 100).clamp(0, 100)}%`);
|
||||
meterLabelArray[i].text(FC.RC.channels[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,10 +106,10 @@ function updateControlPositions() {
|
|||
stickElem = $(".control-stick", gimbalElem);
|
||||
|
||||
if (gimbal[0] == stickName) {
|
||||
stickElem.css('top', (1.0 - channelValueToStickPortion(stickValue)) * gimbalSize + "px");
|
||||
stickElem.css('top', `${(1.0 - channelValueToStickPortion(stickValue)) * gimbalSize}px`);
|
||||
break;
|
||||
} else if (gimbal[1] == stickName) {
|
||||
stickElem.css('left', channelValueToStickPortion(stickValue) * gimbalSize + "px");
|
||||
stickElem.css('left', `${channelValueToStickPortion(stickValue) * gimbalSize}px`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -131,21 +131,21 @@ function localizeAxisNames() {
|
|||
for (const gimbalIndex in gimbals) {
|
||||
const gimbal = gimbalElems.get(gimbalIndex);
|
||||
|
||||
$(".gimbal-label-vert", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][0]));
|
||||
$(".gimbal-label-horz", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
|
||||
$(".gimbal-label-vert", gimbal).text(i18n.getMessage(`controlAxis${gimbals[gimbalIndex][0]}`));
|
||||
$(".gimbal-label-horz", gimbal).text(i18n.getMessage(`controlAxis${gimbals[gimbalIndex][1]}`));
|
||||
}
|
||||
|
||||
for (let sliderIndex = 0; sliderIndex < 4; sliderIndex++) {
|
||||
$(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage("controlAxisAux" + (sliderIndex + 1)));
|
||||
$(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage(`controlAxisAux${sliderIndex + 1}`));
|
||||
}
|
||||
}
|
||||
|
||||
function applyDarkTheme() {
|
||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', false));
|
||||
css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', false));
|
||||
}
|
||||
|
||||
function applyNormalTheme() {
|
||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', true));
|
||||
css_dark.forEach((el) => $(`link[href="${el}"]`).prop('disabled', true));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
|
@ -255,15 +255,16 @@ TABS.setup.initialize = function (callback) {
|
|||
|
||||
// All the known elements but the ARM_SWITCH (it must be always the last element)
|
||||
if (i < disarmFlagElements.length - 1) {
|
||||
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="cf_tip disarm-flag" title="' + i18n.getMessage('initialSetupArmingDisableFlagsTooltip' + disarmFlagElements[i]) + '" style="display: none;">' + disarmFlagElements[i] + '</span>');
|
||||
const messageKey = `initialSetupArmingDisableFlagsTooltip${disarmFlagElements[i]}`;
|
||||
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="cf_tip disarm-flag" title="${i18n.getMessage(messageKey)}" style="display: none;">${disarmFlagElements[i]}</span>`);
|
||||
|
||||
// The ARM_SWITCH, always the last element
|
||||
} else if (i == FC.CONFIG.armingDisableCount - 1) {
|
||||
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="cf_tip disarm-flag" title="' + i18n.getMessage('initialSetupArmingDisableFlagsTooltipARM_SWITCH') + '" style="display: none;">ARM_SWITCH</span>');
|
||||
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="cf_tip disarm-flag" title="${i18n.getMessage('initialSetupArmingDisableFlagsTooltipARM_SWITCH')}" style="display: none;">ARM_SWITCH</span>`);
|
||||
|
||||
// Unknown disarm flags
|
||||
} else {
|
||||
arming_disable_flags_e.append('<span id="initialSetupArmingDisableFlags' + i + '" class="disarm-flag" style="display: none;">' + (i + 1) + '</span>');
|
||||
arming_disable_flags_e.append(`<span id="initialSetupArmingDisableFlags${i}" class="disarm-flag" style="display: none;">${i + 1}</span>`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -277,7 +278,7 @@ TABS.setup.initialize = function (callback) {
|
|||
$('#initialSetupArmingAllowed').toggle(FC.CONFIG.armingDisableFlags == 0);
|
||||
|
||||
for (let i = 0; i < FC.CONFIG.armingDisableCount; i++) {
|
||||
$('#initialSetupArmingDisableFlags'+i).css('display',(FC.CONFIG.armingDisableFlags & (1 << i)) == 0 ? 'none':'inline-block');
|
||||
$(`#initialSetupArmingDisableFlags${i}`).css('display',(FC.CONFIG.armingDisableFlags & (1 << i)) == 0 ? 'none':'inline-block');
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -293,8 +294,8 @@ TABS.setup.initialize = function (callback) {
|
|||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
|
||||
gpsFix_e.html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
|
||||
gpsSats_e.text(FC.GPS_DATA.numSat);
|
||||
gpsLat_e.text((FC.GPS_DATA.lat / 10000000).toFixed(4) + ' deg');
|
||||
gpsLon_e.text((FC.GPS_DATA.lon / 10000000).toFixed(4) + ' deg');
|
||||
gpsLat_e.text(`${(FC.GPS_DATA.lat / 10000000).toFixed(4)} deg`);
|
||||
gpsLon_e.text(`${(FC.GPS_DATA.lon / 10000000).toFixed(4)} deg`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function pad(n, width) {
|
||||
n = n + '';
|
||||
n = `${n}`;
|
||||
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
|
|||
|
||||
if ( transponderProvider.hasOwnProperty('id') ) {
|
||||
transponderTypeSelect.append(
|
||||
$('<option>').attr('value', transponderProvider.id).html(i18n.getMessage("transponderType" + transponderProvider.id)),
|
||||
$('<option>').attr('value', transponderProvider.id).html(i18n.getMessage(`transponderType${transponderProvider.id}`)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -192,12 +192,12 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
|
|||
|
||||
let template = $('#transponder-configuration-template').clone();
|
||||
|
||||
template.find('.spacer_box_title').html(i18n.getMessage("transponderData" + transponderProvider.id));
|
||||
template.find('.dataHelp').html(i18n.getMessage("transponderDataHelp" + transponderProvider.id));
|
||||
template.find('.spacer_box_title').html(i18n.getMessage(`transponderData${transponderProvider.id}`));
|
||||
template.find('.dataHelp').html(i18n.getMessage(`transponderDataHelp${transponderProvider.id}`));
|
||||
|
||||
|
||||
if ( i18n.getMessage("transponderHelp" + transponderProvider.id).length ) {
|
||||
$('#transponderHelp').html(i18n.getMessage("transponderHelp" + transponderProvider.id));
|
||||
if ( i18n.getMessage(`transponderHelp${transponderProvider.id}`).length ) {
|
||||
$('#transponderHelp').html(i18n.getMessage(`transponderHelp${transponderProvider.id}`));
|
||||
$('#transponderHelpBox').show();
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
|
|||
dataInput.append($('<option>').val(dataOptions).html(dataOptionsKey));
|
||||
}
|
||||
|
||||
if ( dataInput.find("option[value='" + data + "']").length > 0 && !clearValue ) {
|
||||
if ( dataInput.find(`option[value='${data}']`).length > 0 && !clearValue ) {
|
||||
dataInput.val(data);
|
||||
} else {
|
||||
dataInput.val(_persistentInputValues[transponderProvider.id] || '');
|
||||
|
@ -239,7 +239,7 @@ TABS.transponder.initialize = function(callback, scrollPosition) {
|
|||
|
||||
let changedInputValue = function() {
|
||||
let dataString = $(this).val();
|
||||
let hexRegExp = new RegExp('[0-9a-fA-F]{' + (transponderProvider.dataLength * 2) + '}', 'gi');
|
||||
let hexRegExp = new RegExp(`[0-9a-fA-F]{${transponderProvider.dataLength * 2}}`, 'gi');
|
||||
|
||||
if ( !dataString.match(hexRegExp) ) {
|
||||
FC.TRANSPONDER.data = [];
|
||||
|
|
|
@ -43,7 +43,7 @@ CSSUtil.prototype.getColorForPercentage = function(percentage, colorTable = null
|
|||
b: Math.floor(lower.color.b * percentageLower + upper.color.b * percentageUpper),
|
||||
a: lower.color.a * percentageLower + upper.color.a * percentageUpper,
|
||||
};
|
||||
return "rgba(" + [color.r, color.g, color.b, color.a].join(",") + ")";
|
||||
return `rgba(${[color.r, color.g, color.b, color.a].join(",")})`;
|
||||
};
|
||||
|
||||
const cssUtil = new CSSUtil();
|
||||
|
|
|
@ -133,7 +133,7 @@ class CliEngine
|
|||
|
||||
getCliCommand(command, cliBuffer) {
|
||||
const buffer = this.removePromptHash(cliBuffer);
|
||||
const bufferRegex = new RegExp('^' + buffer, 'g');
|
||||
const bufferRegex = new RegExp(`^${buffer}`, 'g');
|
||||
|
||||
if (command.match(bufferRegex)) {
|
||||
return command.replace(bufferRegex, '');
|
||||
|
@ -153,7 +153,7 @@ class CliEngine
|
|||
this.writeToOutput(`<span class="error_message">${text}</span><br>`);
|
||||
this._cliErrorsCount++;
|
||||
} else {
|
||||
this.writeToOutput(text + "<br>");
|
||||
this.writeToOutput(`${text}<br>`);
|
||||
}
|
||||
this._responseCallback?.();
|
||||
this._onRowCameCallback?.(text);
|
||||
|
@ -219,7 +219,7 @@ class CliEngine
|
|||
}
|
||||
|
||||
sendLine(line, callback, responseCallback) {
|
||||
this.send(line + '\n', callback, responseCallback);
|
||||
this.send(`${line}\n`, callback, responseCallback);
|
||||
}
|
||||
|
||||
send(line, callback, responseCallback) {
|
||||
|
|
|
@ -129,8 +129,8 @@ class PresetParser {
|
|||
|
||||
_getOptionName(line) {
|
||||
const directiveRemoved = line.slice(this._settings.OptionsDirectives.BEGIN_OPTION_DIRECTIVE.length).trim();
|
||||
const regExpRemoveChecked = new RegExp(this._escapeRegex(this._settings.OptionsDirectives.OPTION_CHECKED +":"), 'gi');
|
||||
const regExpRemoveUnchecked = new RegExp(this._escapeRegex(this._settings.OptionsDirectives.OPTION_UNCHECKED +":"), 'gi');
|
||||
const regExpRemoveChecked = new RegExp(this._escapeRegex(`${this._settings.OptionsDirectives.OPTION_CHECKED}:`), 'gi');
|
||||
const regExpRemoveUnchecked = new RegExp(this._escapeRegex(`${this._settings.OptionsDirectives.OPTION_UNCHECKED}:`), 'gi');
|
||||
let optionName = directiveRemoved.replace(regExpRemoveChecked, "");
|
||||
optionName = optionName.replace(regExpRemoveUnchecked, "").trim();
|
||||
return optionName;
|
||||
|
|
|
@ -12,7 +12,7 @@ class PresetsRepoIndexed {
|
|||
}
|
||||
|
||||
loadIndex() {
|
||||
return fetch(this._urlRaw + "index.json", {cache: "no-cache"})
|
||||
return fetch(`${this._urlRaw}index.json`, {cache: "no-cache"})
|
||||
.then(res => res.json())
|
||||
.then(out => {
|
||||
this._index = out;
|
||||
|
|
|
@ -104,7 +104,7 @@ class PresetsSourcesDialog {
|
|||
|
||||
_scrollDown() {
|
||||
this._domDivSourcesPanel.stop();
|
||||
this._domDivSourcesPanel.animate({scrollTop: this._domDivSourcesPanel.prop('scrollHeight') + "px"});
|
||||
this._domDivSourcesPanel.animate({scrollTop: `${this._domDivSourcesPanel.prop('scrollHeight')}px`});
|
||||
}
|
||||
|
||||
_addNewSourcePanel(presetSource, isActive = false, isSelected = true) {
|
||||
|
|
Loading…
Reference in New Issue