1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-26 01:35:28 +03:00

Motor output reordering feature

Fixed Sonar warnings

renaming MOTOR_REMAP to MOTOR_OUTPUT_REORDER<ING>

Sonar warning fix

Code style fixes after the code review

moving styles to css from the motors tab dialog

Dialog size of Androind devices

Raneming MSP_<SET>_MOTOR_OUTPUT_REORDERING to MSP2

removing old styles and js files reference to motor_remap folder

adding FC.* where needed to accomodate new master changes

fixed alphabetical order for FC settings MOTOR_OUTPUT_REORDER

css fix for Android for motor reordering dialog
This commit is contained in:
Ivan Efimov 2020-06-28 03:54:39 -05:00 committed by Ivan Efimov
parent b596c5fc76
commit e4a85ccc2f
13 changed files with 930 additions and 3 deletions

View file

@ -57,7 +57,11 @@ TABS.motors.initialize = function (callback) {
}
function load_esc_protocol() {
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, load_motor_data);
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, load_motor_output_reordering);
}
function load_motor_output_reordering() {
MSP.send_message(MSPCodes.MSP2_MOTOR_OUTPUT_REORDERING, false, false, load_motor_data);
}
function load_motor_data() {
@ -222,6 +226,13 @@ TABS.motors.initialize = function (callback) {
}
$('.mixerPreview img').attr('src', './resources/motor_order/' + mixerList[mixer - 1].image + reverse + '.svg');
const motorOutputReorderConfig = new MotorOutputReorderConfig(100);
const domMotorOutputReorderDialogOpen = $('#motorOutputReorderDialogOpen');
const isMotorReorderingAvailable = (mixerList[mixer - 1].name in motorOutputReorderConfig)
&& (FC.MOTOR_OUTPUT_ORDER) && (FC.MOTOR_OUTPUT_ORDER.length > 0);
domMotorOutputReorderDialogOpen.toggle(isMotorReorderingAvailable);
}
function process_html() {
@ -726,7 +737,50 @@ TABS.motors.initialize = function (callback) {
// enable Status and Motor data pulling
GUI.interval_add('motor_and_status_pull', get_status, 50, true);
GUI.content_ready(callback);
let zeroThrottleValue = rangeMin;
if (self.feature3DEnabled) {
zeroThrottleValue = neutral3d;
}
setup_motor_output_reordering_dialog(content_ready, zeroThrottleValue);
function content_ready() {
GUI.content_ready(callback);
}
GUI.content_ready(callback);
}
function setup_motor_output_reordering_dialog(callbackFunction, zeroThrottleValue)
{
const domDialogMotorOutputReorder = $('#dialogMotorOutputReorder');
const motorOutputReorderComponent = new MotorOutputReorderComponent($('#dialogMotorOutputReorderContent'),
callbackFunction, mixerList[FC.MIXER_CONFIG.mixer - 1].name,
zeroThrottleValue, zeroThrottleValue + 200);
$('#dialogMotorOutputReorder-closebtn').click(closeDialog);
function closeDialog()
{
domDialogMotorOutputReorder[0].close();
motorOutputReorderComponent.close();
$(document).off("keydown", onDocumentKeyPress);
}
function onDocumentKeyPress(event)
{
if (27 === event.which) {
closeDialog();
}
}
$('#motorOutputReorderDialogOpen').click(function()
{
$(document).on("keydown", onDocumentKeyPress);
domDialogMotorOutputReorder[0].showModal();
});
}
};