Merge pull request #2366 from limonspb/fix_auto_aux_detection

Fix auto AUX detection on Modes tab
10.8-maintenance
Michael Keller 2021-01-01 13:20:20 +01:00 committed by GitHub
commit 163840a3ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -486,7 +486,7 @@ TABS.auxiliary.initialize = function (callback) {
}
}
auto_select_channel(FC.RC.channels, FC.RSSI_CONFIG.channel);
auto_select_channel(FC.RC.channels, FC.RC.active_channels, FC.RSSI_CONFIG.channel);
auxChannelCount = FC.RC.active_channels - 4;
@ -502,7 +502,7 @@ TABS.auxiliary.initialize = function (callback) {
* @param RC_channels
* @param RC_channels
*/
function auto_select_channel(RC_channels, RSSI_channel) {
function auto_select_channel(RC_channels, activeChannels, RSSI_channel) {
const auto_option = $('.tab-auxiliary select.channel option[value="-1"]:selected');
if (auto_option.length === 0) {
prevChannelsValues = null;
@ -515,10 +515,12 @@ TABS.auxiliary.initialize = function (callback) {
if (!prevChannelsValues || RC_channels.length === 0) return fillPrevChannelsValues();
const diff_array = RC_channels.map(function(currentValue, index) {
let diff_array = RC_channels.map(function(currentValue, index) {
return Math.abs(prevChannelsValues[index] - currentValue);
});
diff_array = diff_array.slice(0, activeChannels);
const largest = diff_array.reduce(function(x,y){
return (x > y) ? x : y;
}, 0);