Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/js/DarkTheme.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import $ from "jquery";

const css_dark = ["./css/dark-theme.css"];

const DarkTheme = {
configSetting: undefined,
enabled: false,
Expand Down
4 changes: 1 addition & 3 deletions src/js/TuningSliders.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ const TuningSliders = {
expertMode: false,
};

const D_MAX_RATIO = 0.85;

TuningSliders.initialize = function () {
this.PID_DEFAULT = FC.getPidDefaults();
this.FILTER_DEFAULT = FC.getFilterDefaults();
Expand Down Expand Up @@ -441,7 +439,7 @@ TuningSliders.updateFormPids = function (updateSlidersOnly = false) {
this.updateSlidersWarning();
};

TuningSliders.calculateNewPids = function (updateSlidersOnly = false) {
TuningSliders.calculateNewPids = function () {
// this is the main calculation for PID sliders, inputs are in form of slider position values
// values get set both into forms and their respective variables
FC.TUNING_SLIDERS.slider_pids_mode = this.sliderPidsMode;
Expand Down
2 changes: 1 addition & 1 deletion src/js/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Model.prototype.optimizeGeometryForCanvas = function (geometry) {
const uniqueVertices = [];
const updatedFaces = [];

geometry.vertices.forEach((vertex, index) => {
geometry.vertices.forEach((vertex) => {
// Round coordinates with configurable tolerance
const key = [
Math.round(vertex.x * tolerance) / tolerance,
Expand Down
2 changes: 0 additions & 2 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ const ledDirectionLetters = ["n", "e", "s", "w", "u", "d"]; // in LSB bit order
const ledBaseFunctionLetters = ["c", "f", "a", "l", "s", "g", "r", "p", "e", "u"]; // in LSB bit
let ledOverlayLetters = ["t", "y", "o", "b", "v", "i", "w"]; // in LSB bit

const MAX_GYROS = 8; // maximum number of gyros supported by Betaflight

function MspHelper() {
const self = this;

Expand Down
4 changes: 2 additions & 2 deletions src/js/msp/debug/msp_queue_monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export class MSPQueueMonitor {
return true;
});
if (isDuplicate) this.metrics.duplicates++;
} catch (_) {
// best-effort only
} catch {
// Ignore errors in duplicate detection
}

// Check for queue size peaks
Expand Down
2 changes: 1 addition & 1 deletion src/js/msp/debug/msp_stress_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class MSPStressTest {
try {
await this.msp.promise(code, null);
return { error: "Expected timeout but request succeeded" };
} catch (error) {
} catch {
const timeoutTime = performance.now() - startTime;

// Test that new requests work after timeout
Expand Down
2 changes: 1 addition & 1 deletion src/js/protocols/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Websocket extends EventTarget {
return new Uint8Array(buffer);
}

async connect(path, options) {
async connect(path) {
this.address = path;
console.log(`${this.logHead} Connecting to ${this.address}`);

Expand Down
46 changes: 19 additions & 27 deletions src/js/protocols/webusbdfu.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class WEBUSBDFU_protocol extends EventTarget {
};
return memory;
};
const chipInfo = descriptors.map(parseDescriptor).reduce((o, v, i) => {
const chipInfo = descriptors.map(parseDescriptor).reduce((o, v) => {
o[v.type.toLowerCase().replace(" ", "_")] = v;
return o;
}, {});
Expand Down Expand Up @@ -500,7 +500,7 @@ class WEBUSBDFU_protocol extends EventTarget {
}
})
.catch((error) => {
console.log(`${this.logHead} USB controlTransfer IN failed for request: ${request}`);
console.log(`${this.logHead} USB controlTransfer IN failed for request: ${request} (${error})`);
callback([], 1);
});
} else {
Expand All @@ -525,7 +525,7 @@ class WEBUSBDFU_protocol extends EventTarget {
}
})
.catch((error) => {
console.log(`${this.logHead} USB controlTransfer OUT failed for request: ${request}`);
console.log(`${this.logHead} USB controlTransfer OUT failed for request: ${request} (${error})`);
});
}
}
Expand Down Expand Up @@ -900,7 +900,7 @@ class WEBUSBDFU_protocol extends EventTarget {
const spans_page = hexData.address < page_start && end_address > page_end;

if (starts_in_page || ends_in_page || spans_page) {
const idx = erase_pages.findIndex((element, index, array) => {
const idx = erase_pages.findIndex((element) => {
return element.sector === i && element.page === j;
});
if (idx === -1) {
Expand Down Expand Up @@ -1161,31 +1161,23 @@ class WEBUSBDFU_protocol extends EventTarget {
? this.transferSize
: this.hex.data[reading_block].bytes - bytes_verified;

this.controlTransfer(
"in",
this.request.UPLOAD,
wBlockNum++,
0,
bytes_to_read,
0,
(data, code) => {
for (const piece of data) {
this.verify_hex[reading_block].push(piece);
}
this.controlTransfer("in", this.request.UPLOAD, wBlockNum++, 0, bytes_to_read, 0, (data) => {
for (const piece of data) {
this.verify_hex[reading_block].push(piece);
}

address += bytes_to_read;
bytes_verified += bytes_to_read;
bytes_verified_total += bytes_to_read;
address += bytes_to_read;
bytes_verified += bytes_to_read;
bytes_verified_total += bytes_to_read;

// update progress bar
TABS.firmware_flasher.flashProgress(
((this.hex.bytes_total + bytes_verified_total) / (this.hex.bytes_total * 2)) * 100,
);
// update progress bar
TABS.firmware_flasher.flashProgress(
((this.hex.bytes_total + bytes_verified_total) / (this.hex.bytes_total * 2)) * 100,
);

// verify another page
read();
},
);
// verify another page
read();
});
} else {
if (reading_block < blocks) {
// move to another block
Expand Down Expand Up @@ -1261,7 +1253,7 @@ class WEBUSBDFU_protocol extends EventTarget {
this.loadAddress(address, () => {
// 'downloading' 0 bytes to the program start address followed by a GETSTATUS is used to trigger DFU exit on STM32
this.controlTransfer("out", this.request.DNLOAD, 0, 0, 0, 0, () => {
this.controlTransfer("in", this.request.GETSTATUS, 0, 0, 6, 0, (data) => {
this.controlTransfer("in", this.request.GETSTATUS, 0, 0, 6, 0, () => {
this.cleanup();
});
});
Expand Down
4 changes: 1 addition & 3 deletions src/js/receiver_msp/receiver_msp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import $ from "jquery";
// It seems than when node opens a new window, the module "context" is different, so the i18n var is not initialized
const i18n = opener.i18n;

const css_dark = ["/css/dark-theme.css"];

const CHANNEL_MIN_VALUE = 1000;
const CHANNEL_MID_VALUE = 1500;
const CHANNEL_MAX_VALUE = 2000;
Expand Down Expand Up @@ -191,7 +189,7 @@ $(".slider", sliderElems).each(function (sliderIndex) {
/*
* Mouseup handler needs to be bound to the window in order to receive mouseup if mouse leaves window.
*/
$(window).on("mouseup", function (e) {
$(window).on("mouseup", function () {
$(this).off("mousemove", handleGimbalMouseDrag);
});

Expand Down
4 changes: 2 additions & 2 deletions src/js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function disconnectHandler(event) {
export function initializeSerialBackend() {
$("a.connection_button__link").on("click", connectDisconnect);

EventBus.$on("port-handler:auto-select-serial-device", function (device) {
EventBus.$on("port-handler:auto-select-serial-device", function () {
if (
!GUI.connected_to &&
!GUI.connecting_to &&
Expand Down Expand Up @@ -658,7 +658,7 @@ function onConnect() {
// show only appropriate tabs
$("#tabs ul.mode-connected li").hide();
$("#tabs ul.mode-connected li")
.filter(function (index) {
.filter(function () {
const classes = $(this).attr("class").split(/\s+/);
let found = false;

Expand Down
4 changes: 2 additions & 2 deletions src/js/tabs/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ cli.initialize = function (callback) {
async function loadFile() {
const previewArea = $("#snippetpreviewcontent textarea#preview");

function executeSnippet(fileName) {
function executeSnippet() {
const commands = previewArea.val();
executeCommands(commands);
self.GUI.snippetPreviewWindow.close();
Expand All @@ -160,7 +160,7 @@ cli.initialize = function (callback) {
"cliConfirmSnippetDialogTitle",
{ fileName: fileName },
);
$("#snippetpreviewcontent a.confirm").click(() => executeSnippet(fileName));
$("#snippetpreviewcontent a.confirm").on("click", executeSnippet);
}

previewArea.val(result);
Expand Down
9 changes: 3 additions & 6 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ firmware_flasher.initialize = async function (callback) {

Object.keys(targets)
.sort((a, b) => a.target - b.target)
.forEach(function (target, i) {
.forEach(function (target) {
const descriptor = targets[target];
const select_e = $(`<option value='${descriptor.target}'>${descriptor.target}</option>`);
boards_e.append(select_e);
Expand Down Expand Up @@ -779,11 +779,8 @@ firmware_flasher.initialize = async function (callback) {
async function flashHexFirmware(firmware) {
const options = {};

let eraseAll = false;
if ($("input.erase_chip").is(":checked") || expertMode_e.is(":not(:checked)")) {
options.erase_chip = true;

eraseAll = true;
}

const port = PortHandler.portPicker.selectedPort;
Expand Down Expand Up @@ -992,7 +989,7 @@ firmware_flasher.initialize = async function (callback) {
selectFirmware($("option:selected", evt.target).val());
});

$("a.cloud_build_cancel").on("click", function (evt) {
$("a.cloud_build_cancel").on("click", function () {
$("a.cloud_build_cancel").toggleClass("disabled", true);
self.cancelBuild = true;
});
Expand Down Expand Up @@ -1021,7 +1018,7 @@ firmware_flasher.initialize = async function (callback) {
}
}

$("a.load_remote_file").on("click", async function (evt) {
$("a.load_remote_file").on("click", async function () {
if (!self.selectedBoard) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/tabs/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ landing.initialize = function (callback) {
$("#content").load("./tabs/landing.html", () => {
function showLang(newLang) {
bottomSection = $(".languageSwitcher");
bottomSection.find("a").each(function (index) {
bottomSection.find("a").each(function () {
const element = $(this);
const languageSelected = element.attr("lang");
if (newLang == languageSelected) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/tabs/led_strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const led_strip = {
directions: ["n", "e", "s", "w", "u", "d"],
};

led_strip.initialize = function (callback, scrollPosition) {
led_strip.initialize = function (callback) {
let selectedColorIndex = null;
let selectedModeColor = null;
const functionTag = ".function-";
Expand Down Expand Up @@ -226,7 +226,7 @@ led_strip.initialize = function (callback, scrollPosition) {
const colorDefineSliders = $(".colorDefineSliders");

// Color Buttons
$(".colors").on("click", "button", function (e) {
$(".colors").on("click", "button", function () {
const that = this;
const colorButtons = $(this).parent().find("button");

Expand Down
10 changes: 7 additions & 3 deletions src/js/tabs/onboard_logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ onboard_logging.initialize = function (callback) {
const deviceSelect = $(".blackboxDevice select");
const loggingRatesSelect = $(".blackboxRate select");
const debugModeSelect = $(".blackboxDebugMode select");
const debugFieldsSelect = $(".blackboxDebugFields select");

if (FC.BLACKBOX.supported) {
$(".tab-onboard_logging a.save-settings").on("click", async function () {
Expand All @@ -137,7 +136,7 @@ onboard_logging.initialize = function (callback) {
populateLoggingRates(loggingRatesSelect);
populateDevices(deviceSelect);
populateDebugModes(debugModeSelect);
populateDebugFields(debugFieldsSelect);
populateDebugFields();

deviceSelect
.change(function () {
Expand Down Expand Up @@ -262,7 +261,7 @@ onboard_logging.initialize = function (callback) {
});
}

function populateDebugFields(debugFieldsSelect) {
function populateDebugFields() {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
$(".blackboxDebugFields").show();

Expand Down Expand Up @@ -408,6 +407,11 @@ onboard_logging.initialize = function (callback) {
loggingStatus = "Dataflash";
}

tracking.sendEvent(tracking.EVENT_CATEGORIES.FLIGHT_CONTROLLER, "DataLogging", {
logSize: FC.DATAFLASH.usedSize,
logStatus: loggingStatus,
});

if (FC.SDCARD.supported && !sdcardTimer) {
// Poll for changes in SD card status
sdcardTimer = setTimeout(function () {
Expand Down
Loading