mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Change mixer
This commit is contained in:
parent
6f3b50d7eb
commit
54820d43c6
3 changed files with 35 additions and 30 deletions
|
@ -2559,7 +2559,7 @@
|
||||||
"message": "<strong>I understand the risks</strong>, the propellers are removed - enable motor control and arming, and disable Runaway Takeoff Prevention."
|
"message": "<strong>I understand the risks</strong>, the propellers are removed - enable motor control and arming, and disable Runaway Takeoff Prevention."
|
||||||
},
|
},
|
||||||
"motorsDialogMixerReset": {
|
"motorsDialogMixerReset": {
|
||||||
"message": "<strong>Invalid mixer mode selected.</strong><br /><br />The {{mixerName}} model needs {{mixerMotors}} motor resources.<br /><br />If using a custom mixer mode you need to define a custom mmix before changing mixer mode. If you come back to the motor tab after setting a mmix for your mode it won't reset the mode anymore. Please see the wiki for more information how to set this up.<br /><br />You are not able to test any motors or fly because firmware has {{outputs}} outputs for the selected mode.<br /><br />Resetting to default mixer mode"
|
"message": "<strong>Mixer mode problem detected</strong><br /><br />The {{mixerName}} model needs <strong class=\"message-positive\">{{mixerMotors}}</strong> motor resources and the current configuration of the firmware provides <strong class=\"message-positive\">{{outputs}}</strong> usable output(s) for the selected mode.<br /><br />If using a custom mixer mode you need to define a custom mmix before changing mixer mode.<br /><br />Please check your configuration and add the required motor resources."
|
||||||
},
|
},
|
||||||
"motorsDialogSettingsChanged": {
|
"motorsDialogSettingsChanged": {
|
||||||
"message": "Configuration changes have been detected.<br /><br /><strong class=\"message-negative-italic\">Motor Test Mode is disabled until the settings have seen saved.</strong>"
|
"message": "Configuration changes have been detected.<br /><br /><strong class=\"message-negative-italic\">Motor Test Mode is disabled until the settings have seen saved.</strong>"
|
||||||
|
|
|
@ -330,6 +330,8 @@ TABS.motors.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortElement('select.mixerList');
|
||||||
|
|
||||||
function refreshMixerPreview() {
|
function refreshMixerPreview() {
|
||||||
const mixer = FC.MIXER_CONFIG.mixer;
|
const mixer = FC.MIXER_CONFIG.mixer;
|
||||||
const reverse = FC.MIXER_CONFIG.reverseMotorDir ? "_reversed" : "";
|
const reverse = FC.MIXER_CONFIG.reverseMotorDir ? "_reversed" : "";
|
||||||
|
@ -608,6 +610,12 @@ TABS.motors.initialize = function (callback) {
|
||||||
neutral3d = (FC.MOTOR_3D_CONFIG.neutral > 1575 || FC.MOTOR_3D_CONFIG.neutral < 1425) ? 1500 : FC.MOTOR_3D_CONFIG.neutral;
|
neutral3d = (FC.MOTOR_3D_CONFIG.neutral > 1575 || FC.MOTOR_3D_CONFIG.neutral < 1425) ? 1500 : FC.MOTOR_3D_CONFIG.neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let zeroThrottleValue = rangeMin;
|
||||||
|
|
||||||
|
if (self.feature3DEnabled) {
|
||||||
|
zeroThrottleValue = neutral3d;
|
||||||
|
}
|
||||||
|
|
||||||
const motorsWrapper = $('.motors .bar-wrapper');
|
const motorsWrapper = $('.motors .bar-wrapper');
|
||||||
|
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 8; i++) {
|
||||||
|
@ -643,6 +651,8 @@ TABS.motors.initialize = function (callback) {
|
||||||
escProtocolElement.append(`<option value="${j + 1}">${escProtocols[j]}</option>`);
|
escProtocolElement.append(`<option value="${j + 1}">${escProtocols[j]}</option>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortElement('select.escprotocol');
|
||||||
|
|
||||||
const unsyncedPWMSwitchElement = $("input[id='unsyncedPWMSwitch']");
|
const unsyncedPWMSwitchElement = $("input[id='unsyncedPWMSwitch']");
|
||||||
const divUnsyncedPWMFreq = $('div.unsyncedpwmfreq');
|
const divUnsyncedPWMFreq = $('div.unsyncedpwmfreq');
|
||||||
|
|
||||||
|
@ -743,7 +753,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
escProtocolElement.val(FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
escProtocolElement.val(FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
||||||
console.log(FC.PID_ADVANCED_CONFIG.fast_pwm_protocol);
|
|
||||||
escProtocolElement.on("change", function () {
|
escProtocolElement.on("change", function () {
|
||||||
const escProtocolValue = parseInt($(this).val()) - 1;
|
const escProtocolValue = parseInt($(this).val()) - 1;
|
||||||
|
|
||||||
|
@ -818,11 +828,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
|
|
||||||
function setSlidersDefault() {
|
function setSlidersDefault() {
|
||||||
// change all values to default
|
// change all values to default
|
||||||
if (self.feature3DEnabled) {
|
$('div.sliders input').val(zeroThrottleValue);
|
||||||
$('div.sliders input').val(neutral3d);
|
|
||||||
} else {
|
|
||||||
$('div.sliders input').val(rangeMin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSlidersEnabled(isEnabled) {
|
function setSlidersEnabled(isEnabled) {
|
||||||
|
@ -903,7 +909,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
|
|
||||||
for (let i = 0; i < self.numberOfValidOutputs; i++) {
|
for (let i = 0; i < self.numberOfValidOutputs; i++) {
|
||||||
if (!self.feature3DEnabled) {
|
if (!self.feature3DEnabled) {
|
||||||
if (FC.MOTOR_DATA[i] > rangeMin) {
|
if (FC.MOTOR_DATA[i] > zeroThrottleValue) {
|
||||||
motorsRunning = true;
|
motorsRunning = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -965,7 +971,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
const motorsTesting = motorsEnableTestModeElement.is(':checked');
|
const motorsTesting = motorsEnableTestModeElement.is(':checked');
|
||||||
|
|
||||||
for (let i = 0; i < self.numberOfValidOutputs; i++) {
|
for (let i = 0; i < self.numberOfValidOutputs; i++) {
|
||||||
motorData[i] = motorsTesting ? FC.MOTOR_DATA[i] : rangeMin;
|
motorData[i] = motorsTesting ? FC.MOTOR_DATA[i] : zeroThrottleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return motorData;
|
return motorData;
|
||||||
|
@ -1034,7 +1040,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
//keep the following here so at least we get a visual cue of our motor setup
|
//keep the following here so at least we get a visual cue of our motor setup
|
||||||
update_arm_status();
|
update_arm_status();
|
||||||
|
|
||||||
if (previousArmState != self.armed) {
|
if (previousArmState !== self.armed) {
|
||||||
console.log('arm state change detected');
|
console.log('arm state change detected');
|
||||||
|
|
||||||
motorsEnableTestModeElement.change();
|
motorsEnableTestModeElement.change();
|
||||||
|
@ -1083,12 +1089,6 @@ TABS.motors.initialize = function (callback) {
|
||||||
// enable Status and Motor data pulling
|
// enable Status and Motor data pulling
|
||||||
GUI.interval_add('motor_and_status_pull', get_status, 50, true);
|
GUI.interval_add('motor_and_status_pull', get_status, 50, true);
|
||||||
|
|
||||||
let zeroThrottleValue = rangeMin;
|
|
||||||
|
|
||||||
if (self.feature3DEnabled) {
|
|
||||||
zeroThrottleValue = neutral3d;
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_motor_output_reordering_dialog(SetupEscDshotDirectionDialogCallback, zeroThrottleValue);
|
setup_motor_output_reordering_dialog(SetupEscDshotDirectionDialogCallback, zeroThrottleValue);
|
||||||
|
|
||||||
function SetupEscDshotDirectionDialogCallback() {
|
function SetupEscDshotDirectionDialogCallback() {
|
||||||
|
@ -1116,12 +1116,6 @@ TABS.motors.initialize = function (callback) {
|
||||||
dialogMixerReset.showModal();
|
dialogMixerReset.showModal();
|
||||||
$('#dialog-mixer-reset-confirmbtn').click(function() {
|
$('#dialog-mixer-reset-confirmbtn').click(function() {
|
||||||
dialogMixerReset.close();
|
dialogMixerReset.close();
|
||||||
|
|
||||||
FC.MIXER_CONFIG.mixer = 3;
|
|
||||||
|
|
||||||
MSP.promise(MSPCodes.MSP_SET_MIXER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_MIXER_CONFIG))
|
|
||||||
.then(() => MSP.promise(MSPCodes.MSP_EEPROM_WRITE))
|
|
||||||
.then(() => reboot());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,8 @@ export function bytesToSize(bytes) {
|
||||||
|
|
||||||
export function checkChromeRuntimeError() {
|
export function checkChromeRuntimeError() {
|
||||||
if (chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
console.error(
|
console.error(`Chrome API Error: ${chrome.runtime.lastError.message}.\n Traced ${new Error().stack}`);
|
||||||
`Chrome API Error: ${chrome.runtime.lastError.message}.\n Traced ${
|
|
||||||
new Error().stack
|
|
||||||
}`
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -54,9 +51,7 @@ const majorFirmwareVersions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function generateVirtualApiVersions() {
|
export function generateVirtualApiVersions() {
|
||||||
const firmwareVersionDropdown = document.getElementById(
|
const firmwareVersionDropdown = document.getElementById("firmware-version-dropdown");
|
||||||
"firmware-version-dropdown"
|
|
||||||
);
|
|
||||||
const max = semver.minor(CONFIGURATOR.API_VERSION_MAX_SUPPORTED);
|
const max = semver.minor(CONFIGURATOR.API_VERSION_MAX_SUPPORTED);
|
||||||
|
|
||||||
for (let i = max; i > 0; i--) {
|
for (let i = max; i > 0; i--) {
|
||||||
|
@ -94,6 +89,21 @@ export function getTextWidth(text) {
|
||||||
return Math.ceil(context.measureText(text).width);
|
return Math.ceil(context.measureText(text).width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortElement(element, keepDown = "DISABLED") {
|
||||||
|
const list = document.querySelector(element);
|
||||||
|
[...list.children]
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (a.innerText === keepDown) {
|
||||||
|
return 1;
|
||||||
|
} else if (b.innerText === keepDown) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return a.innerText > b.innerText ? 1 : -1;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.forEach(node => list.appendChild(node));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: these are temp binding while transition to module happens
|
// TODO: these are temp binding while transition to module happens
|
||||||
window.degToRad = degToRad;
|
window.degToRad = degToRad;
|
||||||
window.bytesToSize = bytesToSize;
|
window.bytesToSize = bytesToSize;
|
||||||
|
@ -101,3 +111,4 @@ window.checkChromeRuntimeError = checkChromeRuntimeError;
|
||||||
window.generateVirtualApiVersions = generateVirtualApiVersions;
|
window.generateVirtualApiVersions = generateVirtualApiVersions;
|
||||||
window.getMixerImageSrc = getMixerImageSrc;
|
window.getMixerImageSrc = getMixerImageSrc;
|
||||||
window.getTextWidth = getTextWidth;
|
window.getTextWidth = getTextWidth;
|
||||||
|
window.sortElement = sortElement;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue