1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-25 17:25:14 +03:00

Only show EzTune tab when platform is multirotor

The PR only shows the Ez Tune tab when the platform is either `PLATFORM_MULTIROTOR ` or `PLATFORM_TRICOPTER`. More platforms can be added in the function in main.js.

When changing the mixer to a non-supported platform. Ez Tune is automatically disabled.
This commit is contained in:
Darren Lines 2023-11-04 21:34:40 +00:00
parent 5ccb534baa
commit 6a34f6b349
4 changed files with 34 additions and 3 deletions

View file

@ -1552,7 +1552,7 @@
"message": "Pitch trim for self-leveling flight modes. In degrees. +5 means airplane nose should be raised 5 deg from level" "message": "Pitch trim for self-leveling flight modes. In degrees. +5 means airplane nose should be raised 5 deg from level"
}, },
"pidTuning_ButtonSave": { "pidTuning_ButtonSave": {
"message": "Save" "message": "Save and Reboot"
}, },
"pidTuning_ButtonRefresh": { "pidTuning_ButtonRefresh": {
"message": "Refresh" "message": "Refresh"
@ -2220,7 +2220,7 @@
"message": "Blackbox configuration" "message": "Blackbox configuration"
}, },
"blackboxButtonSave": { "blackboxButtonSave": {
"message": "Save and reboot" "message": "Save and Reboot"
}, },
"serialLogging": { "serialLogging": {
"message": "Outboard serial logging device" "message": "Outboard serial logging device"
@ -4452,7 +4452,7 @@
"message": "Confirm" "message": "Confirm"
}, },
"mixerButtonSaveAndReboot": { "mixerButtonSaveAndReboot": {
"message": "Save and reboot" "message": "Save and Reboot"
}, },
"mixerApplyDescription": { "mixerApplyDescription": {
"message": "This action overrides all current mixer settings and replaces them with default values. There is no 'Undo' option!" "message": "This action overrides all current mixer settings and replaces them with default values. There is no 'Undo' option!"

View file

@ -257,6 +257,7 @@ function onValidFirmware()
$('#tabs ul.mode-connected .tab_setup a').click(); $('#tabs ul.mode-connected .tab_setup a').click();
updateEzTuneTabVisibility(true);
updateFirmwareVersion(); updateFirmwareVersion();
}); });
}); });

25
main.js
View file

@ -717,3 +717,28 @@ function updateFirmwareVersion() {
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/'; globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
} }
} }
function updateEzTuneTabVisibility(loadMixerConfig) {
let useEzTune = true;
if (CONFIGURATOR.connectionValid) {
if (loadMixerConfig) {
mspHelper.loadMixerConfig(function() {
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
$('.tab_ez_tune').removeClass("is-hidden");
} else {
$('.tab_ez_tune').addClass("is-hidden");
useEzTune = false;
}
});
} else {
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
$('.tab_ez_tune').removeClass("is-hidden");
} else {
$('.tab_ez_tune').addClass("is-hidden");
useEzTune = false;
}
}
}
return useEzTune;
}

View file

@ -668,6 +668,11 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
$('#platform-type').parent('.select').addClass('no-bottom-border'); $('#platform-type').parent('.select').addClass('no-bottom-border');
} }
if (!updateEzTuneTabVisibility(false)) {
EZ_TUNE.enabled = 0;
mspHelper.saveEzTune();
}
updateRefreshButtonStatus(); updateRefreshButtonStatus();
updateMotorDirection(); updateMotorDirection();