Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifedHaybnzz patch 1 #4314

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 7 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -6,7 +6,11 @@
<script type="module" src="/src/js/utils/common.js"></script>
<script type="module" src="/src/js/browserMain.js"></script>

<title>Betaflight</title>
<title>HadesFligt



</title>
Comment on lines +9 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

<meta name="description" content="Configuration and management tool for the Betaflight flight control firmware">
<link rel="icon" href="/images/pwa/favicon.ico">
<link rel="apple-touch-icon" href="/images/pwa/apple-touch-icon.png" sizes="128x128">
@@ -123,7 +127,8 @@
:firmware-version="FC.CONFIG.flightControllerVersion"
:firmware-id="FC.CONFIG.flightControllerIdentifier"
:hardware-id="FC.CONFIG.hardwareName"
></betaflight-logo>
></
aflight-logo>
Comment on lines +130 to +131
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

<div id="tabs">
<ul class="mode-disconnected">
<li class="tab_landing" id="tab_landing"><a href="#" i18n="tabLanding" class="tabicon ic_welcome" i18n_title="tabLanding"></a></li>
132 changes: 58 additions & 74 deletions src/js/Beepers.js
Original file line number Diff line number Diff line change
@@ -1,109 +1,93 @@
import { bit_check, bit_clear, bit_set } from "./bit";
import $ from "jquery";
// Import bit manipulation functions for handling beeper statess
import { bit_check, bit_clear, bit_set } from './bit';

class Beepers {
constructor(config, supportedConditions) {
const self = this;

const beepers = [
{ bit: 0, name: "GYRO_CALIBRATED", visible: true },
{ bit: 1, name: "RX_LOST", visible: true },
{ bit: 2, name: "RX_LOST_LANDING", visible: true },
{ bit: 3, name: "DISARMING", visible: true },
{ bit: 4, name: "ARMING", visible: true },
{ bit: 5, name: "ARMING_GPS_FIX", visible: true },
{ bit: 6, name: "BAT_CRIT_LOW", visible: true },
{ bit: 7, name: "BAT_LOW", visible: true },
{ bit: 8, name: "GPS_STATUS", visible: true },
{ bit: 9, name: "RX_SET", visible: true },
{ bit: 10, name: "ACC_CALIBRATION", visible: true },
{ bit: 11, name: "ACC_CALIBRATION_FAIL", visible: true },
{ bit: 12, name: "READY_BEEP", visible: true },
{ bit: 13, name: "MULTI_BEEPS", visible: false },
{ bit: 14, name: "DISARM_REPEAT", visible: true },
{ bit: 15, name: "ARMED", visible: true },
{ bit: 16, name: "SYSTEM_INIT", visible: true },
{ bit: 17, name: "USB", visible: true },
{ bit: 18, name: "BLACKBOX_ERASE", visible: true },
{ bit: 19, name: "CRASH_FLIP", visible: true },
{ bit: 20, name: "CAM_CONNECTION_OPEN", visible: true },
{ bit: 21, name: "CAM_CONNECTION_CLOSE", visible: true },
{ bit: 22, name: "RC_SMOOTHING_INIT_FAIL", visible: true },
{ bit: 0, name: 'GYRO_CALIBRATED', visible: true },
{ bit: 1, name: 'RX_LOST', visible: true },
{ bit: 2, name: 'RX_LOST_LANDING', visible: true },
{ bit: 3, name: 'DISARMING', visible: true },
{ bit: 4, name: 'ARMING', visible: true },
{ bit: 5, name: 'ARMING_GPS_FIX', visible: true },
{ bit: 6, name: 'BAT_CRIT_LOW', visible: true },
{ bit: 7, name: 'BAT_LOW', visible: true },
{ bit: 8, name: 'GPS_STATUS', visible: true },
{ bit: 9, name: 'RX_SET', visible: true },
{ bit: 10, name: 'ACC_CALIBRATION', visible: true },
{ bit: 11, name: 'ACC_CALIBRATION_FAIL', visible: true },
{ bit: 12, name: 'READY_BEEP', visible: true },
{ bit: 13, name: 'MULTI_BEEPS', visible: false },
{ bit: 14, name: 'DISARM_REPEAT', visible: true },
{ bit: 15, name: 'ARMED', visible: true },
{ bit: 16, name: 'SYSTEM_INIT', visible: true },
{ bit: 17, name: 'USB', visible: true },
{ bit: 18, name: 'BLACKBOX_ERASE', visible: true },
{ bit: 19, name: 'CRASH_FLIP', visible: true },
{ bit: 20, name: 'CAM_CONNECTION_OPEN', visible: true },
{ bit: 21, name: 'CAM_CONNECTION_CLOSE', visible: true },
{ bit: 22, name: 'RC_SMOOTHING_INIT_FAIL', visible: true },
];

if (supportedConditions) {
self._beepers = [];
beepers.forEach(function (beeper) {
if (
supportedConditions.some(function (supportedCondition) {
return supportedCondition === beeper.name;
})
) {
self._beepers.push(beeper);
}
});
self._beepers = beepers.filter(beeper =>
supportedConditions.includes(beeper.name)
);
} else {
self._beepers = beepers.slice();
self._beepers = [...beepers]; // Use spread operator for shallow copy
}

self._beeperDisabledMask = 0;
}
getDisabledMask() {
const self = this;

return self._beeperDisabledMask;
getDisabledMask() {
return this._beeperDisabledMask; // Use 'this' instead of 'self'
}
setDisabledMask(beeperDisabledMask) {
const self = this;

self._beeperDisabledMask = beeperDisabledMask;
setDisabledMask(beeperDisabledMask) {
this._beeperDisabledMask = beeperDisabledMask; // Use 'this' instead of 'self'
}
isEnabled(beeperName) {
const self = this;

for (let i = 0; i < self._beepers.length; i++) {
if (self._beepers[i].name === beeperName && bit_check(self._beeperOfMask, self._beepers[i].bit)) {
return true;
}
}
return false;
isEnabled(beeperName) {
return this._beepers.some(beeper =>
beeper.name === beeperName && bit_check(this._beeperDisabledMask, beeper.bit)
);
}
generateElements(template, destination) {
const self = this;

for (let i = 0; i < self._beepers.length; i++) {
if (self._beepers[i].visible) {
generateElements(template, destination) {
for (let beeper of this._beepers) {
if (beeper.visible) {
const element = template.clone();
destination.append(element);

const inputElement = $(element).find("input");
const labelElement = $(element).find("div");
const spanElement = $(element).find("span");

inputElement.attr("id", `beeper-${i}`);
inputElement.attr("name", self._beepers[i].name);
inputElement.attr("title", self._beepers[i].name);
inputElement.prop("checked", !bit_check(self._beeperDisabledMask, self._beepers[i].bit));
inputElement.data("bit", self._beepers[i].bit);
const inputElement = element.find('input');
const labelElement = element.find('div');
const spanElement = element.find('span');

labelElement.text(self._beepers[i].name);

spanElement.attr("i18n", `beeper${self._beepers[i].name}`);
inputElement.attr({
id: `beeper-${beeper.bit}`,
name: beeper.name,
title: beeper.name,
}).prop('checked', !bit_check(this._beeperDisabledMask, beeper.bit))
.data('bit', beeper.bit);

labelElement.text(beeper.name);
spanElement.attr('i18n', `beeper${beeper.name}`);

element.show();
}
}
}
updateData(beeperElement) {
const self = this;

if (beeperElement.attr("type") === "checkbox") {
const bit = beeperElement.data("bit");

if (beeperElement.is(":checked")) {
self._beeperDisabledMask = bit_clear(self._beeperDisabledMask, bit);
updateData(beeperElement) {
if (beeperElement.attr('type') === 'checkbox') {
const bit = beeperElement.data('bit');
if (beeperElement.is(':checked')) {
this._beeperDisabledMask = bit_clear(this._beeperDisabledMask, bit);
} else {
self._beeperDisabledMask = bit_set(self._beeperDisabledMask, bit);
this._beeperDisabledMask = bit_set(this._beeperDisabledMask, bit);
}
}
}
2 changes: 1 addition & 1 deletion src/js/receiver_msp/receiver_msp.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import DarkTheme from "../DarkTheme.js";
import { isWeb } from "../utils/isWeb.js";
import $ from "jquery";

// This is a hack to get the i18n var of the parent, but the i18n.localizePage not works
// This is a hack to get the i18n var of the parent, but the i18n.localizePage not work
// 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;