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

chore: add semi rule to the linter and run --fix

Adds semicolon to the linter rules.
This commit is contained in:
Tomas Chmelevskij 2021-02-14 07:37:03 +01:00
parent dfbd46c6f1
commit 616c2e796d
25 changed files with 103 additions and 102 deletions

View file

@ -13,6 +13,7 @@ module.exports = {
}, },
rules: { rules: {
"no-trailing-spaces": "error", "no-trailing-spaces": "error",
"eol-last": "error" "eol-last": "error",
semi: "error"
} }
}; }

View file

@ -87,16 +87,16 @@ const Analytics = function (trackingId, userId, appName, appVersion, changesetId
Analytics.prototype.setDimension = function (dimension, value) { Analytics.prototype.setDimension = function (dimension, value) {
const dimensionName = `dimension${dimension}`; const dimensionName = `dimension${dimension}`;
this._googleAnalytics.custom(dimensionName, value); this._googleAnalytics.custom(dimensionName, value);
} };
Analytics.prototype.setMetric = function (metric, value) { Analytics.prototype.setMetric = function (metric, value) {
const metricName = `metric${metric}`; const metricName = `metric${metric}`;
this._googleAnalytics.custom(metricName, value); this._googleAnalytics.custom(metricName, value);
} };
Analytics.prototype.sendEvent = function (category, action, options) { Analytics.prototype.sendEvent = function (category, action, options) {
this._googleAnalytics.event(category, action, options); this._googleAnalytics.event(category, action, options);
} };
Analytics.prototype.sendChangeEvents = function (category, changeList) { Analytics.prototype.sendChangeEvents = function (category, changeList) {
for (const actionName in changeList) { for (const actionName in changeList) {
@ -107,23 +107,23 @@ Analytics.prototype.sendChangeEvents = function (category, changeList) {
} }
} }
} }
} };
Analytics.prototype.sendAppView = function (viewName) { Analytics.prototype.sendAppView = function (viewName) {
this._googleAnalytics.screenview(viewName); this._googleAnalytics.screenview(viewName);
} };
Analytics.prototype.sendTiming = function (category, timing, value) { Analytics.prototype.sendTiming = function (category, timing, value) {
this._googleAnalytics.timing(category, timing, value); this._googleAnalytics.timing(category, timing, value);
} };
Analytics.prototype.sendException = function (message) { Analytics.prototype.sendException = function (message) {
this._googleAnalytics.exception(message); this._googleAnalytics.exception(message);
} };
Analytics.prototype.setOptOut = function (optOut) { Analytics.prototype.setOptOut = function (optOut) {
window['ga-disable-' + this._trackingId] = !!optOut; window['ga-disable-' + this._trackingId] = !!optOut;
} };
Analytics.prototype._rebuildFlightControllerEvent = function () { Analytics.prototype._rebuildFlightControllerEvent = function () {
this.setDimension(this.DIMENSIONS.BOARD_TYPE, this._flightControllerData[this.DATA.BOARD_TYPE]); this.setDimension(this.DIMENSIONS.BOARD_TYPE, this._flightControllerData[this.DATA.BOARD_TYPE]);
@ -137,19 +137,19 @@ Analytics.prototype._rebuildFlightControllerEvent = function () {
this.setDimension(this.DIMENSIONS.BOARD_NAME, this._flightControllerData[this.DATA.BOARD_NAME]); this.setDimension(this.DIMENSIONS.BOARD_NAME, this._flightControllerData[this.DATA.BOARD_NAME]);
this.setDimension(this.DIMENSIONS.MANUFACTURER_ID, this._flightControllerData[this.DATA.MANUFACTURER_ID]); this.setDimension(this.DIMENSIONS.MANUFACTURER_ID, this._flightControllerData[this.DATA.MANUFACTURER_ID]);
this.setDimension(this.DIMENSIONS.MCU_TYPE, this._flightControllerData[this.DATA.MCU_TYPE]); this.setDimension(this.DIMENSIONS.MCU_TYPE, this._flightControllerData[this.DATA.MCU_TYPE]);
} };
Analytics.prototype.setFlightControllerData = function (property, value) { Analytics.prototype.setFlightControllerData = function (property, value) {
this._flightControllerData[property] = value; this._flightControllerData[property] = value;
this._rebuildFlightControllerEvent(); this._rebuildFlightControllerEvent();
} };
Analytics.prototype.resetFlightControllerData = function () { Analytics.prototype.resetFlightControllerData = function () {
this._flightControllerData = {}; this._flightControllerData = {};
this._rebuildFlightControllerEvent(); this._rebuildFlightControllerEvent();
} };
Analytics.prototype._rebuildFirmwareEvent = function () { Analytics.prototype._rebuildFirmwareEvent = function () {
this.setDimension(this.DIMENSIONS.FIRMWARE_NAME, this._firmwareData[this.DATA.FIRMWARE_NAME]); this.setDimension(this.DIMENSIONS.FIRMWARE_NAME, this._firmwareData[this.DATA.FIRMWARE_NAME]);
@ -157,16 +157,16 @@ Analytics.prototype._rebuildFirmwareEvent = function () {
this.setDimension(this.DIMENSIONS.FIRMWARE_ERASE_ALL, this._firmwareData[this.DATA.FIRMWARE_ERASE_ALL]); this.setDimension(this.DIMENSIONS.FIRMWARE_ERASE_ALL, this._firmwareData[this.DATA.FIRMWARE_ERASE_ALL]);
this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]); this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]);
this.setMetric(this.METRICS.FIRMWARE_SIZE, this._firmwareData[this.DATA.FIRMWARE_SIZE]); this.setMetric(this.METRICS.FIRMWARE_SIZE, this._firmwareData[this.DATA.FIRMWARE_SIZE]);
} };
Analytics.prototype.setFirmwareData = function (property, value) { Analytics.prototype.setFirmwareData = function (property, value) {
this._firmwareData[property] = value; this._firmwareData[property] = value;
this._rebuildFirmwareEvent(); this._rebuildFirmwareEvent();
} };
Analytics.prototype.resetFirmwareData = function () { Analytics.prototype.resetFirmwareData = function () {
this._firmwareData = {}; this._firmwareData = {};
this._rebuildFirmwareEvent(); this._rebuildFirmwareEvent();
} };

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
const ConfigInserter = function () { const ConfigInserter = function () {
} };
const CUSTOM_DEFAULTS_POINTER_ADDRESS = 0x08002800; const CUSTOM_DEFAULTS_POINTER_ADDRESS = 0x08002800;
const BLOCK_SIZE = 16384; const BLOCK_SIZE = 16384;
@ -102,4 +102,4 @@ ConfigInserter.prototype.insertConfig = function (firmware, input) {
console.log(`Custom defaults inserted in: ${microtime() - timeParsingStart.toFixed(4)} seconds.`); console.log(`Custom defaults inserted in: ${microtime() - timeParsingStart.toFixed(4)} seconds.`);
return true; return true;
} };

View file

@ -38,4 +38,4 @@ const ConfigStorage = {
window.localStorage.setItem(element, JSON.stringify(tmpObj)); window.localStorage.setItem(element, JSON.stringify(tmpObj));
}); });
} }
} };

View file

@ -201,7 +201,7 @@ Features.prototype.findFeatureByBit = function (bit) {
return feature; return feature;
} }
} }
} };
Features.prototype.updateData = function (featureElement) { Features.prototype.updateData = function (featureElement) {
const self = this; const self = this;

View file

@ -273,7 +273,7 @@ TuningSliders.updateFilterSlidersDisplay = function() {
$('.tuningFilterSliders .sliderLabels tr:nth-child(2)').hide(); $('.tuningFilterSliders .sliderLabels tr:nth-child(2)').hide();
this.sliderGyroFilter = true; this.sliderGyroFilter = true;
} else { } else {
$('.tuningFilterSliders .sliderLabels tr:nth-child(2)').show() $('.tuningFilterSliders .sliderLabels tr:nth-child(2)').show();
this.cachedGyroSliderValues = true; this.cachedGyroSliderValues = true;
} }

View file

@ -436,7 +436,7 @@ function configuration_restore(callback) {
} }
if (configuration.apiVersion == undefined) { if (configuration.apiVersion == undefined) {
configuration.apiVersion = "1.0.0" // a guess that will satisfy the rest of the code configuration.apiVersion = "1.0.0"; // a guess that will satisfy the rest of the code
} }
// apiVersion previously stored without patchlevel // apiVersion previously stored without patchlevel
if (!semver.parse(configuration.apiVersion)) { if (!semver.parse(configuration.apiVersion)) {

View file

@ -126,7 +126,7 @@ GuiControl.prototype.interval_add_condition = function (name, code, interval, fi
this.interval_remove(name); this.interval_remove(name);
} }
}, interval, first); }, interval, first);
} };
// name = string // name = string
GuiControl.prototype.interval_remove = function (name) { GuiControl.prototype.interval_remove = function (name) {

View file

@ -7,7 +7,7 @@ const JenkinsLoader = function (url) {
this._jobsRequest = '/api/json?tree=jobs[name]'; this._jobsRequest = '/api/json?tree=jobs[name]';
this._buildsRequest = '/api/json?tree=builds[number,result,timestamp,artifacts[relativePath],changeSet[items[commitId,msg]]]'; this._buildsRequest = '/api/json?tree=builds[number,result,timestamp,artifacts[relativePath],changeSet[items[commitId,msg]]]';
} };
JenkinsLoader.prototype.loadJobs = function (viewName, callback) { JenkinsLoader.prototype.loadJobs = function (viewName, callback) {
const self = this; const self = this;
@ -43,10 +43,10 @@ JenkinsLoader.prototype.loadJobs = function (viewName, callback) {
// remove Betaflight prefix, rename Betaflight job to Development // remove Betaflight prefix, rename Betaflight job to Development
const jobs = jobsInfo.jobs.map(job => { const jobs = jobsInfo.jobs.map(job => {
return { title: job.name.replace('Betaflight ', '').replace('Betaflight', 'Development'), name: job.name }; return { title: job.name.replace('Betaflight ', '').replace('Betaflight', 'Development'), name: job.name };
}) });
// cache loaded info // cache loaded info
const object = {} const object = {};
object[jobsDataTag] = jobs; object[jobsDataTag] = jobs;
object[cacheLastUpdateTag] = $.now(); object[cacheLastUpdateTag] = $.now();
chrome.storage.local.set(object); chrome.storage.local.set(object);
@ -60,14 +60,14 @@ JenkinsLoader.prototype.loadJobs = function (viewName, callback) {
cachedCallback(); cachedCallback();
} }
}); });
} };
JenkinsLoader.prototype.loadBuilds = function (jobName, callback) { JenkinsLoader.prototype.loadBuilds = function (jobName, callback) {
const self = this; const self = this;
const jobUrl = `${self._url}/job/${jobName}`; const jobUrl = `${self._url}/job/${jobName}`;
const buildsDataTag = `${jobUrl}BuildsData`; const buildsDataTag = `${jobUrl}BuildsData`;
const cacheLastUpdateTag = `${jobUrl}BuildsLastUpdate` const cacheLastUpdateTag = `${jobUrl}BuildsLastUpdate`;
chrome.storage.local.get([cacheLastUpdateTag, buildsDataTag], function (result) { chrome.storage.local.get([cacheLastUpdateTag, buildsDataTag], function (result) {
const buildsDataTimestamp = $.now(); const buildsDataTimestamp = $.now();
@ -98,7 +98,7 @@ JenkinsLoader.prototype.loadBuilds = function (jobName, callback) {
})); }));
// cache loaded info // cache loaded info
const object = {} const object = {};
object[buildsDataTag] = builds; object[buildsDataTag] = builds;
object[cacheLastUpdateTag] = $.now(); object[cacheLastUpdateTag] = $.now();
chrome.storage.local.set(object); chrome.storage.local.set(object);
@ -112,7 +112,7 @@ JenkinsLoader.prototype.loadBuilds = function (jobName, callback) {
cachedCallback(); cachedCallback();
} }
}); });
} };
JenkinsLoader.prototype._parseBuilds = function (jobUrl, jobName, builds, callback) { JenkinsLoader.prototype._parseBuilds = function (jobUrl, jobName, builds, callback) {
// convert from `build -> targets` to `target -> builds` mapping // convert from `build -> targets` to `target -> builds` mapping
@ -160,4 +160,4 @@ JenkinsLoader.prototype._parseBuilds = function (jobUrl, jobName, builds, callba
}); });
callback(targetBuilds); callback(targetBuilds);
} };

View file

@ -845,7 +845,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
const serialPort = { const serialPort = {
identifier: data.readU8(), identifier: data.readU8(),
scenario: data.readU8(), scenario: data.readU8(),
} };
FC.SERIAL_CONFIG.ports.push(serialPort); FC.SERIAL_CONFIG.ports.push(serialPort);
} }
FC.SERIAL_CONFIG.mspBaudRate = data.readU32(); FC.SERIAL_CONFIG.mspBaudRate = data.readU32();
@ -1658,7 +1658,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
} }
} }
} }
} };
/** /**
* Encode the request body for the MSP request with the given code and return it as an array of bytes. * Encode the request body for the MSP request with the given code and return it as an array of bytes.
@ -2330,7 +2330,7 @@ MspHelper.prototype.setRawRx = function(channels) {
} }
MSP.send_message(MSPCodes.MSP_SET_RAW_RC, buffer, false); MSP.send_message(MSPCodes.MSP_SET_RAW_RC, buffer, false);
} };
/** /**
* Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview * Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview
@ -2568,7 +2568,7 @@ MspHelper.prototype.sendVoltageConfig = function(onCompleteCallback) {
MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, buffer, false, nextFunction);
} }
} };
MspHelper.prototype.sendCurrentConfig = function(onCompleteCallback) { MspHelper.prototype.sendCurrentConfig = function(onCompleteCallback) {
@ -2598,7 +2598,7 @@ MspHelper.prototype.sendCurrentConfig = function(onCompleteCallback) {
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, buffer, false, nextFunction);
} }
} };
MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) { MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) {
@ -2688,7 +2688,7 @@ MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) {
MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_CONFIG, buffer, false, nextFunction);
} }
} };
MspHelper.prototype.sendLedStripColors = function(onCompleteCallback) { MspHelper.prototype.sendLedStripColors = function(onCompleteCallback) {
if (FC.LED_COLORS.length == 0) { if (FC.LED_COLORS.length == 0) {
@ -2703,7 +2703,7 @@ MspHelper.prototype.sendLedStripColors = function(onCompleteCallback) {
} }
MSP.send_message(MSPCodes.MSP_SET_LED_COLORS, buffer, false, onCompleteCallback); MSP.send_message(MSPCodes.MSP_SET_LED_COLORS, buffer, false, onCompleteCallback);
} }
} };
MspHelper.prototype.sendLedStripModeColors = function(onCompleteCallback) { MspHelper.prototype.sendLedStripModeColors = function(onCompleteCallback) {
@ -2733,7 +2733,7 @@ MspHelper.prototype.sendLedStripModeColors = function(onCompleteCallback) {
MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_MODECOLOR, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_LED_STRIP_MODECOLOR, buffer, false, nextFunction);
} }
} };
MspHelper.prototype.serialPortFunctionMaskToFunctions = function(functionMask) { MspHelper.prototype.serialPortFunctionMaskToFunctions = function(functionMask) {
const self = this; const self = this;
@ -2747,7 +2747,7 @@ MspHelper.prototype.serialPortFunctionMaskToFunctions = function(functionMask) {
} }
} }
return functions; return functions;
} };
MspHelper.prototype.serialPortFunctionsToMask = function(functions) { MspHelper.prototype.serialPortFunctionsToMask = function(functions) {
const self = this; const self = this;
@ -2761,7 +2761,7 @@ MspHelper.prototype.serialPortFunctionsToMask = function(functions) {
} }
} }
return mask; return mask;
} };
MspHelper.prototype.sendRxFailConfig = function(onCompleteCallback) { MspHelper.prototype.sendRxFailConfig = function(onCompleteCallback) {
let nextFunction = send_next_rxfail_config; let nextFunction = send_next_rxfail_config;
@ -2792,7 +2792,7 @@ MspHelper.prototype.sendRxFailConfig = function(onCompleteCallback) {
} }
MSP.send_message(MSPCodes.MSP_SET_RXFAIL_CONFIG, buffer, false, nextFunction); MSP.send_message(MSPCodes.MSP_SET_RXFAIL_CONFIG, buffer, false, nextFunction);
} }
} };
MspHelper.prototype.setArmingEnabled = function(doEnable, disableRunawayTakeoffPrevention, onCompleteCallback) { MspHelper.prototype.setArmingEnabled = function(doEnable, disableRunawayTakeoffPrevention, onCompleteCallback) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37) if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)
@ -2822,7 +2822,7 @@ MspHelper.prototype.setArmingEnabled = function(doEnable, disableRunawayTakeoffP
onCompleteCallback(); onCompleteCallback();
} }
} }
} };
MspHelper.prototype.loadSerialConfig = function(callback) { MspHelper.prototype.loadSerialConfig = function(callback) {
const mspCode = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43) ? MSPCodes.MSP2_COMMON_SERIAL_CONFIG : MSPCodes.MSP_CF_SERIAL_CONFIG; const mspCode = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43) ? MSPCodes.MSP2_COMMON_SERIAL_CONFIG : MSPCodes.MSP_CF_SERIAL_CONFIG;

View file

@ -185,14 +185,14 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
}); });
}); });
} }
} };
var onTimeoutHandler = function() { var onTimeoutHandler = function() {
GUI.connect_lock = false; GUI.connect_lock = false;
console.log('Looking for capabilities via MSP failed'); console.log('Looking for capabilities via MSP failed');
TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32RebootingToBootloaderFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID); TABS.firmware_flasher.flashingMessage(i18n.getMessage('stm32RebootingToBootloaderFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
} };
var onFailureHandler = function() { var onFailureHandler = function() {
GUI.connect_lock = false; GUI.connect_lock = false;
@ -688,7 +688,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
self.upload_procedure(6); self.upload_procedure(6);
} }
} }
} };
// start writing // start writing
write(); write();
@ -783,7 +783,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
} }
} }
} }
} };
// start reading // start reading
reading(); reading();
@ -840,7 +840,7 @@ STM32_protocol.prototype.cleanup = function () {
if (self.callback) { if (self.callback) {
self.callback(); self.callback();
} }
} };
// initialize object // initialize object
var STM32 = new STM32_protocol(); var STM32 = new STM32_protocol();

View file

@ -205,7 +205,7 @@ STM32DFU_protocol.prototype.getString = function (index, callback) {
} }
callback(descriptor, result.resultCode); callback(descriptor, result.resultCode);
}); });
} };
STM32DFU_protocol.prototype.getInterfaceDescriptors = function (interfaceNum, callback) { STM32DFU_protocol.prototype.getInterfaceDescriptors = function (interfaceNum, callback) {
var self = this; var self = this;
@ -243,10 +243,10 @@ STM32DFU_protocol.prototype.getInterfaceDescriptors = function (interfaceNum, ca
callback(descriptorStringArray, 0); callback(descriptorStringArray, 0);
return; return;
} }
} };
getDescriptorString(); getDescriptorString();
}); });
} };
STM32DFU_protocol.prototype.getInterfaceDescriptor = function (_interface, callback) { STM32DFU_protocol.prototype.getInterfaceDescriptor = function (_interface, callback) {
@ -281,7 +281,7 @@ STM32DFU_protocol.prototype.getInterfaceDescriptor = function (_interface, callb
callback(descriptor, result.resultCode); callback(descriptor, result.resultCode);
}); });
} };
STM32DFU_protocol.prototype.getFunctionalDescriptor = function (_interface, callback) { STM32DFU_protocol.prototype.getFunctionalDescriptor = function (_interface, callback) {
var self = this; var self = this;
@ -313,7 +313,7 @@ STM32DFU_protocol.prototype.getFunctionalDescriptor = function (_interface, call
callback(descriptor, result.resultCode); callback(descriptor, result.resultCode);
}); });
} };
STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) { STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
var self = this; var self = this;
@ -338,7 +338,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]
@ -408,16 +408,16 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
'start_address': start_address, 'start_address': start_address,
'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);
}); });
} };
STM32DFU_protocol.prototype.controlTransfer = function (direction, request, value, _interface, length, data, callback, _timeout) { STM32DFU_protocol.prototype.controlTransfer = function (direction, request, value, _interface, length, data, callback, _timeout) {
var self = this; var self = this;
@ -626,7 +626,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
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) {
@ -667,14 +667,14 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
}, incr); }, incr);
} else { } else {
console.log('Failed to initiate unprotect memory command'); console.log('Failed to initiate unprotect memory command');
let messageUnprotectInitFailed = i18n.getMessage('stm32UnprotectInitFailed') let messageUnprotectInitFailed = i18n.getMessage('stm32UnprotectInitFailed');
GUI.log(messageUnprotectInitFailed); GUI.log(messageUnprotectInitFailed);
TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID) TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
self.cleanup(); self.cleanup();
} }
}); });
}); });
} };
var tryReadOB = function() { var tryReadOB = function() {
// the following should fail if read protection is active // the following should fail if read protection is active
@ -730,7 +730,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} }
}); });
}); });
} };
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
@ -747,7 +747,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
GUI.log(i18n.getMessage('stm32AddressLoadUnknown')); GUI.log(i18n.getMessage('stm32AddressLoadUnknown'));
self.cleanup(); self.cleanup();
} }
} };
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
@ -809,7 +809,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} else { } else {
erase_page(); erase_page();
} }
} };
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 +
@ -848,7 +848,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
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(); self.cleanup();
} }
}) });
}); });
} else if (data[4] == self.state.dfuDNLOAD_IDLE) { } else if (data[4] == self.state.dfuDNLOAD_IDLE) {
erase_page_next(); erase_page_next();
@ -918,7 +918,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
self.cleanup(); self.cleanup();
} }
}); });
}) });
} else { } else {
if (flashing_block < blocks) { if (flashing_block < blocks) {
// move to another block // move to another block
@ -937,7 +937,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
self.upload_procedure(5); self.upload_procedure(5);
} }
} }
} };
// start // start
self.loadAddress(address, write); self.loadAddress(address, write);
@ -1028,7 +1028,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
} }
} }
} }
} };
break; break;
} }
}; };

View file

@ -5,9 +5,9 @@ var ReleaseChecker = function (releaseName, releaseUrl) {
self._releaseName = releaseName; self._releaseName = releaseName;
self._releaseDataTag = `${self._releaseName}ReleaseData`; self._releaseDataTag = `${self._releaseName}ReleaseData`;
self._releaseLastUpdateTag = `${self._releaseName}ReleaseLastUpdate` self._releaseLastUpdateTag = `${self._releaseName}ReleaseLastUpdate`;
self._releaseUrl = releaseUrl; self._releaseUrl = releaseUrl;
} };
ReleaseChecker.prototype.loadReleaseData = function (processFunction) { ReleaseChecker.prototype.loadReleaseData = function (processFunction) {
const self = this; const self = this;
@ -42,7 +42,7 @@ ReleaseChecker.prototype.loadReleaseData = function (processFunction) {
self._processReleaseData(cacheReleaseData, processFunction); self._processReleaseData(cacheReleaseData, processFunction);
} }
}); });
} };
ReleaseChecker.prototype._processReleaseData = function (releaseData, processFunction) { ReleaseChecker.prototype._processReleaseData = function (releaseData, processFunction) {
@ -53,4 +53,4 @@ ReleaseChecker.prototype._processReleaseData = function (releaseData, processFun
processFunction(); processFunction();
} }
} };

View file

@ -285,7 +285,7 @@ TABS.auxiliary.initialize = function (callback) {
continue; // invalid! continue; // invalid!
} }
addRangeToMode(newMode, modeRange.auxChannelIndex, modeRangeExtra.modeLogic, range) addRangeToMode(newMode, modeRange.auxChannelIndex, modeRangeExtra.modeLogic, range);
} else { } else {
addLinkedToMode(newMode, modeRangeExtra.modeLogic, modeRangeExtra.linkedTo); addLinkedToMode(newMode, modeRangeExtra.modeLogic, modeRangeExtra.linkedTo);
@ -511,7 +511,7 @@ TABS.auxiliary.initialize = function (callback) {
const fillPrevChannelsValues = function () { const fillPrevChannelsValues = function () {
prevChannelsValues = RC_channels.slice(0); //clone array prevChannelsValues = RC_channels.slice(0); //clone array
} };
if (!prevChannelsValues || RC_channels.length === 0) return fillPrevChannelsValues(); if (!prevChannelsValues || RC_channels.length === 0) return fillPrevChannelsValues();

View file

@ -345,7 +345,7 @@ TABS.firmware_flasher.initialize = function (callback) {
title: job.title, title: job.title,
loader: () => self.jenkinsLoader.loadBuilds(job.name, loadUnifiedBuilds) loader: () => self.jenkinsLoader.loadBuilds(job.name, loadUnifiedBuilds)
}; };
}) });
var buildTypesToShow; var buildTypesToShow;
var buildType_e = $('select[name="build_type"]'); var buildType_e = $('select[name="build_type"]');
@ -741,7 +741,7 @@ TABS.firmware_flasher.initialize = function (callback) {
if ($('input.erase_chip').is(':checked')) { if ($('input.erase_chip').is(':checked')) {
options.erase_chip = true; options.erase_chip = true;
eraseAll = true eraseAll = true;
} }
analytics.setFirmwareData(analytics.DATA.FIRMWARE_ERASE_ALL, eraseAll.toString()); analytics.setFirmwareData(analytics.DATA.FIRMWARE_ERASE_ALL, eraseAll.toString());
@ -1249,7 +1249,7 @@ TABS.firmware_flasher.enableFlashing = function (enabled) {
} else { } else {
$('a.flash_firmware').addClass('disabled'); $('a.flash_firmware').addClass('disabled');
} }
} };
TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL', TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
VALID : 'VALID', VALID : 'VALID',

View file

@ -61,7 +61,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
usedWireNumbers.push(wireNumber); usedWireNumbers.push(wireNumber);
} }
}); });
usedWireNumbers.sort(function(a,b){return a - b}); usedWireNumbers.sort(function(a,b){return a - b;});
return usedWireNumbers; return usedWireNumbers;
} }
@ -1011,21 +1011,21 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
if (FC.LED_COLORS[selectedColorIndex].h != value) { if (FC.LED_COLORS[selectedColorIndex].h != value) {
FC.LED_COLORS[selectedColorIndex].h = value; FC.LED_COLORS[selectedColorIndex].h = value;
$('.colorDefineSliderValue.Hvalue').text(FC.LED_COLORS[selectedColorIndex].h); $('.colorDefineSliderValue.Hvalue').text(FC.LED_COLORS[selectedColorIndex].h);
change = true change = true;
} }
break; break;
case 1: case 1:
if (FC.LED_COLORS[selectedColorIndex].s != value) { if (FC.LED_COLORS[selectedColorIndex].s != value) {
FC.LED_COLORS[selectedColorIndex].s = value; FC.LED_COLORS[selectedColorIndex].s = value;
$('.colorDefineSliderValue.Svalue').text(FC.LED_COLORS[selectedColorIndex].s); $('.colorDefineSliderValue.Svalue').text(FC.LED_COLORS[selectedColorIndex].s);
change = true change = true;
} }
break; break;
case 2: case 2:
if (FC.LED_COLORS[selectedColorIndex].v != value) { if (FC.LED_COLORS[selectedColorIndex].v != value) {
FC.LED_COLORS[selectedColorIndex].v = value; FC.LED_COLORS[selectedColorIndex].v = value;
$('.colorDefineSliderValue.Vvalue').text(FC.LED_COLORS[selectedColorIndex].v); $('.colorDefineSliderValue.Vvalue').text(FC.LED_COLORS[selectedColorIndex].v);
change = true change = true;
} }
break; break;
} }

View file

@ -15,11 +15,11 @@ logging.initialize = function (callback) {
if (CONFIGURATOR.connectionValid) { if (CONFIGURATOR.connectionValid) {
const getMotorData = function () { const getMotorData = function () {
MSP.send_message(MSPCodes.MSP_MOTOR, false, false, loadHtml); MSP.send_message(MSPCodes.MSP_MOTOR, false, false, loadHtml);
} };
const loadHtml = function () { const loadHtml = function () {
$('#content').load("./tabs/logging.html", process_html); $('#content').load("./tabs/logging.html", process_html);
} };
MSP.send_message(MSPCodes.MSP_RC, false, false, getMotorData); MSP.send_message(MSPCodes.MSP_RC, false, false, getMotorData);
} }
@ -61,7 +61,7 @@ logging.initialize = function (callback) {
for (let i = 0; i < requestedProperties.length; i++, requests++) { for (let i = 0; i < requestedProperties.length; i++, requests++) {
MSP.send_message(MSPCodes[requestedProperties[i]]); MSP.send_message(MSPCodes[requestedProperties[i]]);
} }
} };
GUI.interval_add('log_data_poll', logDataPoll, parseInt($('select.speed').val()), true); // refresh rate goes here GUI.interval_add('log_data_poll', logDataPoll, parseInt($('select.speed').val()), true); // refresh rate goes here
GUI.interval_add('write_data', function write_data() { GUI.interval_add('write_data', function write_data() {

View file

@ -369,7 +369,7 @@ TABS.motors.initialize = function (callback) {
} }
$('.tab-motors .sensor select').change(function(){ $('.tab-motors .sensor select').change(function(){
TABS.motors.sensor = $('.tab-motors select[name="sensor_choice"]').val() TABS.motors.sensor = $('.tab-motors select[name="sensor_choice"]').val();
ConfigStorage.set({'motors_tab_sensor_settings': {'sensor': TABS.motors.sensor}}); ConfigStorage.set({'motors_tab_sensor_settings': {'sensor': TABS.motors.sensor}});
switch(TABS.motors.sensor){ switch(TABS.motors.sensor){

View file

@ -690,4 +690,4 @@ TABS.onboard_logging.mscRebootFailedCallback = function () {
.toggleClass("msc-supported", false); .toggleClass("msc-supported", false);
showErrorDialog(i18n.getMessage('operationNotSupported')); showErrorDialog(i18n.getMessage('operationNotSupported'));
} };

View file

@ -1036,7 +1036,7 @@ TABS.pid_tuning.initialize = function (callback) {
} }
return isVisible; return isVisible;
} };
let isVisibleBaroMagGps = false; let isVisibleBaroMagGps = false;
@ -1440,18 +1440,18 @@ TABS.pid_tuning.initialize = function (callback) {
{name: "MultiWii (2.3 - latest)"}, {name: "MultiWii (2.3 - latest)"},
{name: "MultiWii (2.3 - hybrid)"}, {name: "MultiWii (2.3 - hybrid)"},
{name: "Harakiri"} {name: "Harakiri"}
] ];
} else if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) { } else if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) {
pidControllerList = [ pidControllerList = [
{name: ""}, {name: ""},
{name: "Integer"}, {name: "Integer"},
{name: "Float"} {name: "Float"}
] ];
} else { } else {
pidControllerList = [ pidControllerList = [
{name: "Legacy"}, {name: "Legacy"},
{name: "Betaflight"} {name: "Betaflight"}
] ];
} }
for (let i = 0; i < pidControllerList.length; i++) { for (let i = 0; i < pidControllerList.length; i++) {
@ -2199,7 +2199,7 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
if (changedRateProfile) { if (changedRateProfile) {
GUI.log(i18n.getMessage('pidTuningReceivedRateProfile', [FC.CONFIG.rateProfile + 1])); GUI.log(i18n.getMessage('pidTuningReceivedRateProfile', [FC.CONFIG.rateProfile + 1]));
FC.CONFIG.rateProfile = self.currentRateProfile FC.CONFIG.rateProfile = self.currentRateProfile;
} }
}); });
} }
@ -2424,7 +2424,7 @@ TABS.pid_tuning.updateRatesLabels = function() {
$('.maxRateWarning').toggle(warningRates); $('.maxRateWarning').toggle(warningRates);
// and sort them in descending order so the largest value is at the top always // and sort them in descending order so the largest value is at the top always
balloons.sort(function(a,b) {return (b.value - a.value)}); balloons.sort(function(a,b) {return (b.value - a.value);});
// add the current rc values // add the current rc values
if (currentValues[0] && currentValues[1] && currentValues[2]) { if (currentValues[0] && currentValues[1] && currentValues[2]) {

View file

@ -89,7 +89,7 @@ TABS.power.initialize = function (callback) {
$(elementVoltageMeter).attr('id', `voltage-meter-${index}`); $(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) $(elementVoltageMeter).find('.label').text(message);
destinationVoltageMeter.append(elementVoltageMeter); destinationVoltageMeter.append(elementVoltageMeter);
elementVoltageMeter.hide(); elementVoltageMeter.hide();
@ -147,7 +147,7 @@ TABS.power.initialize = function (callback) {
$(elementAmperageMeter).attr('id', `amperage-meter-${index}`); $(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) $(elementAmperageMeter).find('.label').text(message);
destinationAmperageMeter.append(elementAmperageMeter); destinationAmperageMeter.append(elementAmperageMeter);
elementAmperageMeter.hide(); elementAmperageMeter.hide();

View file

@ -328,7 +328,7 @@ TABS.receiver.initialize = function (callback) {
} else { } else {
return false; return false;
} }
} };
windowWatcherUtil.passValue(createdWindow, 'darkTheme', DarkTheme.isDarkThemeEnabled(DarkTheme.configEnabled)); windowWatcherUtil.passValue(createdWindow, 'darkTheme', DarkTheme.isDarkThemeEnabled(DarkTheme.configEnabled));

View file

@ -273,7 +273,7 @@ TABS.setup.initialize = function (callback) {
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>');
} }
} }
} };
prepareDisarmFlags(); prepareDisarmFlags();

View file

@ -11,14 +11,14 @@ windowWatcherUtil.invokeWatcher = function(bindingKey, bindingVal, watchersObjec
if (watchersObject[bindingKey]) { if (watchersObject[bindingKey]) {
watchersObject[bindingKey](bindingVal); watchersObject[bindingKey](bindingVal);
} }
} };
windowWatcherUtil.iterateOverBindings = function(bindings, watchersObject) { windowWatcherUtil.iterateOverBindings = function(bindings, watchersObject) {
let entries = Object.entries(bindings); let entries = Object.entries(bindings);
for (const [key, val] of entries) { for (const [key, val] of entries) {
this.invokeWatcher(key, val, watchersObject); this.invokeWatcher(key, val, watchersObject);
} }
} };
windowWatcherUtil.bindWatchers = function(windowObject, watchersObject) { windowWatcherUtil.bindWatchers = function(windowObject, watchersObject) {
if (!windowObject.bindings) { if (!windowObject.bindings) {
@ -33,7 +33,7 @@ windowWatcherUtil.bindWatchers = function(windowObject, watchersObject) {
return Reflect.set(target, prop, val, receiver); return Reflect.set(target, prop, val, receiver);
} }
}); });
} };
// 'Windows' here could be array or single window reference // 'Windows' here could be array or single window reference
windowWatcherUtil.passValue = function(windows, key, val) { windowWatcherUtil.passValue = function(windows, key, val) {
@ -54,6 +54,6 @@ windowWatcherUtil.passValue = function(windows, key, val) {
if (Array.isArray(windows)) { if (Array.isArray(windows)) {
windows.forEach((el) => applyBinding(el, key, val)); windows.forEach((el) => applyBinding(el, key, val));
} else { } else {
applyBinding(windows, key, val) applyBinding(windows, key, val);
} }
} };

View file

@ -81,7 +81,7 @@ function read_hex_file(data) {
extended_linear_address = ((parseInt(content.substr(0, 2), 16) << 24) | parseInt(content.substr(2, 2), 16) << 16) >>> 0; extended_linear_address = ((parseInt(content.substr(0, 2), 16) << 24) | parseInt(content.substr(2, 2), 16) << 16) >>> 0;
break; break;
case 0x05: // start linear address record case 0x05: // start linear address record
result.start_linear_address = parseInt(content, 16) result.start_linear_address = parseInt(content, 16);
break; break;
} }
} }