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

Move RX configuration to Receiver tab

This commit is contained in:
Pawel Spychalski (DzikuVx) 2020-02-25 17:52:42 +01:00
parent 31cf34bda9
commit 180bc84e2c
9 changed files with 102 additions and 243 deletions

View file

@ -636,11 +636,17 @@
"configurationEscFeatures": { "configurationEscFeatures": {
"message": "ESC/Motor Features" "message": "ESC/Motor Features"
}, },
"serialrx_inverted": {
"message": "Serial Port Inverted (comparing to protocol default)"
},
"serialrx_halfduplex" : {
"message": "Serial receiver half-duplex"
},
"configurationFeaturesHelp": { "configurationFeaturesHelp": {
"message": "<strong>Note:</strong> Not all combinations of features are valid. When the flight controller firmware detects invalid feature combinations conflicting features will be disabled.<br /><strong>Note:</strong> Configure serial ports <span style=\"color: red\">before</span> enabling the features that will use the ports." "message": "<strong>Note:</strong> Not all combinations of features are valid. When the flight controller firmware detects invalid feature combinations conflicting features will be disabled.<br /><strong>Note:</strong> Configure serial ports <span style=\"color: red\">before</span> enabling the features that will use the ports."
}, },
"configurationSerialRXHelp": { "configurationSerialRXHelp": {
"message": "<strong>Note:</strong> Remember to configure a Serial Port (via Ports tab) and choose a Serial Receiver Provider when using RX_SERIAL feature." "message": "<strong>Note:</strong> Remember to configure a Serial Port (via Ports tab) for the serial receiver"
}, },
"configurationBoardAlignment": { "configurationBoardAlignment": {
"message": "Board and Sensor Alignment" "message": "Board and Sensor Alignment"
@ -789,6 +795,9 @@
"configurationGPSHelp": { "configurationGPSHelp": {
"message": "<strong>Note:</strong> Remember to configure a Serial Port (via Ports tab) when using GPS feature." "message": "<strong>Note:</strong> Remember to configure a Serial Port (via Ports tab) when using GPS feature."
}, },
"receiverType": {
"message": "Receiver type"
},
"configurationSerialRX": { "configurationSerialRX": {
"message": "Serial Receiver Provider" "message": "Serial Receiver Provider"
}, },

View file

@ -699,95 +699,6 @@ var FC = {
'Disabled' 'Disabled'
]; ];
}, },
getRxTypes: function() {
// Keep value field in sync with rxReceiverType_e in rx.h
var rxTypes = [
{
name: 'RX_SERIAL',
bit: 3,
value: 3,
},
{
name: 'RX_PPM',
bit: 0,
value: 2,
},
{
name: 'RX_PWM',
bit: 13,
value: 1,
},
];
if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
rxTypes.push({
name: 'RX_SPI',
bit: 25,
value: 5,
});
}
rxTypes.push({
name: 'RX_MSP',
bit: 14,
value: 4,
});
// Versions using feature bits don't allow not having an
// RX and fallback to RX_PPM.
rxTypes.push({
name: 'RX_NONE',
value: 0,
});
return rxTypes;
},
isRxTypeEnabled: function(rxType) {
if (typeof rxType === 'string') {
var types = this.getRxTypes();
for (var ii = 0; ii < types.length; ii++) {
if (types[ii].name == rxType) {
rxType = types[ii];
break;
}
}
}
return RX_CONFIG.receiver_type == rxType.value;
},
setRxTypeEnabled: function(rxType) {
RX_CONFIG.receiver_type = rxType.value;
},
getSerialRxTypes: function () {
var data = [
'SPEKTRUM1024',
'SPEKTRUM2048',
'SBUS',
'SUMD',
'SUMH',
'XBUS_MODE_B',
'XBUS_MODE_B_RJ01',
'IBUS',
'JETI EXBUS',
'TBS Crossfire',
'FPort',
'SBUS Fast',
];
return data;
},
getSPIProtocolTypes: function () {
return [
'V202 250Kbps',
'V202 1Mbps',
'Syma X',
'Syma X5C',
'Cheerson CX10',
'Cheerson CX10A',
'JJRC H8_3D',
'iNav Reference protocol',
'eLeReS'
];
},
getSensorAlignments: function () { getSensorAlignments: function () {
return [ return [
'CW 0°', 'CW 0°',

View file

@ -1,4 +1,3 @@
/*.rate-tpa.rate-tpa--inav input[type="number"],*/
.rate-tpa_input { .rate-tpa_input {
margin: 4px; margin: 4px;
width: 5em; width: 5em;
@ -9,20 +8,20 @@
text-align: right; text-align: right;
} }
.rate-tpa.rate-tpa--inav td, .settings-table.settings-table--inav td,
.rate-tpa.rate-tpa--filtering td, .settings-table.settings-table--filtering td,
.rate-tpa.rate-tpa--misc td { .settings-table.settings-table--misc td {
background-color: #f3f3f3; background-color: #f3f3f3;
width: auto; width: auto;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
.tab-pid_tuning .rate-tpa.rate-tpa--filtering th, .settings-table.settings-table--filtering th,
.tab-pid_tuning .rate-tpa.rate-tpa--misc th { .settings-table.settings-table--misc th {
width: 18em; width: 18em;
} }
.tab-pid_tuning .rate-tpa th { .settings-table th {
background-color: #828885; background-color: #828885;
padding: 4px; padding: 4px;
border-left: 0 solid #ccc; border-left: 0 solid #ccc;
@ -68,15 +67,15 @@
width: calc(100% - 10px); width: calc(100% - 10px);
} }
.tab-pid_tuning .rate-tpa tr:first-child th { .settings-table tr:first-child th {
border-top-left-radius: 5px; border-top-left-radius: 5px;
} }
.tab-pid_tuning .rate-tpa tr:first-child td { .settings-table tr:first-child td {
border-top-right-radius: 5px; border-top-right-radius: 5px;
} }
.tab-pid_tuning .rate-tpa { .settings-table {
/*border: 0px solid #ccc; */ /*border: 0px solid #ccc; */
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -101,13 +100,6 @@
border-bottom: 0 solid #ccc; border-bottom: 0 solid #ccc;
} }
.tab-pid_tuning table th {
padding: 0;
border: 0;
height: 10px;
font-weight: normal;
}
.tab-pid_tuning .pid_titlebar th { .tab-pid_tuning .pid_titlebar th {
padding: 5px; padding: 5px;
text-align: left; text-align: left;
@ -200,9 +192,11 @@
width: 25%; width: 25%;
} }
.tab-pid_tuning .rate-tpa { .settings-table {
float: right; float: right;
width: calc(100% - 2px); /* - ( "virtual" margin) */ width: calc(100% - 2px); /* - ( "virtual" margin) */
margin: 0;
border-collapse: collapse;
} }
.tab-pid_tuning .top-buttons { .tab-pid_tuning .top-buttons {
@ -372,11 +366,11 @@
margin-top:15px; margin-top:15px;
} }
.rate-tpa .helpicon { .settings-table .helpicon {
top: 10px; top: 10px;
position: relative; position: relative;
} }
.rate-tpa tbody { .settings-table tbody {
/* background: #D6D6D6 linear-gradient(-45deg, rgba(255, 255, 255, .2) 10%, transparent 10%, transparent 20%, rgba(255, 255, 255, .2) 20%, rgba(255, 255, 255, .2) 30%, transparent 30%, transparent 40%, rgba(255, 255, 255, .2) 40%, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent 60%, rgba(255, 255, 255, .2) 60%, rgba(255, 255, 255, .2) 70%, transparent 70%, transparent 80%, rgba(255, 255, 255, .2) 80%, rgba(255, 255, 255, .2) 90%, transparent 90%, transparent 100%, rgba(255, 255, 255, .2) 100%, transparent); */ /* background: #D6D6D6 linear-gradient(-45deg, rgba(255, 255, 255, .2) 10%, transparent 10%, transparent 20%, rgba(255, 255, 255, .2) 20%, rgba(255, 255, 255, .2) 30%, transparent 30%, transparent 40%, rgba(255, 255, 255, .2) 40%, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent 60%, rgba(255, 255, 255, .2) 60%, rgba(255, 255, 255, .2) 70%, transparent 70%, transparent 80%, rgba(255, 255, 255, .2) 80%, rgba(255, 255, 255, .2) 90%, transparent 90%, transparent 100%, rgba(255, 255, 255, .2) 100%, transparent); */
} }

View file

@ -100,33 +100,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationReceiver"></div>
</div>
<div class="spacer_box">
<select id="rxType" class="full-width">
</select>
</div>
<div data-rx-type="RX_SERIAL" class="spacer_box">
<h3 data-i18n="configurationSerialRX"></h3>
<div class="note">
<div class="note_spacer">
<p data-i18n="configurationSerialRXHelp"></p>
</div>
</div>
<select id="serial-rx-protocol" class="full-width" size="1">
<!-- list generated here -->
</select>
</div>
<div data-rx-type="RX_SPI" class="spacer_box">
<h3 data-i18n="configurationSPIProtocol"></h3>
<select id="spi-protocol" class="full-width" size="1">
<!-- list generated here -->
</select>
</div>
</div>
<div class="config-section gui_box grey"> <div class="config-section gui_box grey">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationGPS"></div> <div class="spacer_box_title" data-i18n="configurationGPS"></div>

View file

@ -33,7 +33,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
mspHelper.loadBfConfig, mspHelper.loadBfConfig,
mspHelper.loadArmingConfig, mspHelper.loadArmingConfig,
mspHelper.loadLoopTime, mspHelper.loadLoopTime,
mspHelper.loadRxConfig,
mspHelper.load3dConfig, mspHelper.load3dConfig,
mspHelper.loadSensorAlignment, mspHelper.loadSensorAlignment,
mspHelper.loadAdvancedConfig, mspHelper.loadAdvancedConfig,
@ -58,7 +57,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
mspHelper.saveAccTrim, mspHelper.saveAccTrim,
mspHelper.saveArmingConfig, mspHelper.saveArmingConfig,
mspHelper.saveLooptimeConfig, mspHelper.saveLooptimeConfig,
mspHelper.saveRxConfig,
mspHelper.saveAdvancedConfig, mspHelper.saveAdvancedConfig,
mspHelper.saveINAVPidConfig, mspHelper.saveINAVPidConfig,
mspHelper.saveSensorConfig, mspHelper.saveSensorConfig,
@ -92,59 +90,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
function process_html() { function process_html() {
let i, let i;
mixer_list_e = $('select.mixerList'),
legacyMixers = helper.mixer.getLegacyList();
for (i in legacyMixers) {
if (legacyMixers.hasOwnProperty(i)) {
mixer_list_e.append('<option value="' + legacyMixers[i].id + '">' + legacyMixers[i].name + '</option>');
}
}
mixer_list_e.change(function () {
BF_CONFIG.mixerConfiguration = parseInt($(this).val(), 10);
$('.mixerPreview img').attr('src', './resources/motor_order/' +
helper.mixer.getById(BF_CONFIG.mixerConfiguration).image + '.svg');
});
// select current mixer configuration
mixer_list_e.val(BF_CONFIG.mixerConfiguration).change();
// receiver configuration
var rxTypesSelect = $('#rxType');
var rxTypes = FC.getRxTypes();
for (var ii = 0; ii < rxTypes.length; ii++) {
var rxType = rxTypes[ii];
var option = $('<option value="' + rxType.name + '" >' + chrome.i18n.getMessage(rxType.name) + '</option>');
option.data('rx-type', rxType);
if (FC.isRxTypeEnabled(rxType)) {
option.prop('selected', true);
}
option.appendTo(rxTypesSelect);
}
var rxTypeOptions = $('[data-rx-type]');
var updateRxOptions = function (animated) {
var duration = animated ? 400 : 0;
rxTypeOptions.each(function (ii, obj) {
var $obj = $(obj);
var rxType = $obj.data('rx-type');
if (rxType && rxType != rxTypesSelect.val()) {
$obj.slideUp(duration);
} else {
$obj.slideDown(duration);
}
});
};
updateRxOptions(false);
rxTypesSelect.change(function () {
updateRxOptions(true);
var rxType = rxTypesSelect.find(':selected').data('rx-type');
FC.setRxTypeEnabled(rxType);
});
// generate features // generate features
var features = FC.getFeatures(); var features = FC.getFeatures();
@ -299,38 +245,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
config_vtx.hide(); config_vtx.hide();
} }
// generate serial RX
var serialRxTypes = FC.getSerialRxTypes();
var serialRX_e = $('#serial-rx-protocol');
for (i = 0; i < serialRxTypes.length; i++) {
serialRX_e.append('<option value="' + i + '">' + serialRxTypes[i] + '</option>');
}
serialRX_e.change(function () {
RX_CONFIG.serialrx_provider = parseInt($(this).val());
});
// select current serial RX type
serialRX_e.val(RX_CONFIG.serialrx_provider);
// for some odd reason chrome 38+ changes scroll according to the touched select element // for some odd reason chrome 38+ changes scroll according to the touched select element
// i am guessing this is a bug, since this wasn't happening on 37 // i am guessing this is a bug, since this wasn't happening on 37
// code below is a temporary fix, which we will be able to remove in the future (hopefully) // code below is a temporary fix, which we will be able to remove in the future (hopefully)
//noinspection JSValidateTypes //noinspection JSValidateTypes
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0); $('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
var spiProtocol_e = $('#spi-protocol');
GUI.fillSelect(spiProtocol_e, FC.getSPIProtocolTypes());
spiProtocol_e.change(function () {
RX_CONFIG.spirx_protocol = parseInt($(this).val());
RX_CONFIG.spirx_id = 0;
});
// select current spi protocol
spiProtocol_e.val(RX_CONFIG.spirx_protocol);
// fill board alignment // fill board alignment
$('input[name="board_align_roll"]').val((BF_CONFIG.board_align_roll / 10.0).toFixed(1)); $('input[name="board_align_roll"]').val((BF_CONFIG.board_align_roll / 10.0).toFixed(1));
$('input[name="board_align_pitch"]').val((BF_CONFIG.board_align_pitch / 10.0).toFixed(1)); $('input[name="board_align_pitch"]').val((BF_CONFIG.board_align_pitch / 10.0).toFixed(1));
@ -534,22 +454,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
craftName = $('input[name="craft_name"]').val(); craftName = $('input[name="craft_name"]').val();
// track feature usage
if ($('#rxType').val() == 'RX_SERIAL') {
googleAnalytics.sendEvent('Setting', 'SerialRxProvider', $('#serial-rx-protocol').find(':selected').text());
}
// track feature usage
if ($('#rxType').val() == 'RX_SPI') {
googleAnalytics.sendEvent('Setting', 'nrf24Protocol', FC.getSPIProtocolTypes()[RX_CONFIG.spirx_protocol]);
}
if (FC.isFeatureEnabled('GPS', features)) { if (FC.isFeatureEnabled('GPS', features)) {
googleAnalytics.sendEvent('Setting', 'GpsProtocol', gpsProtocols[MISC.gps_type]); googleAnalytics.sendEvent('Setting', 'GpsProtocol', gpsProtocols[MISC.gps_type]);
googleAnalytics.sendEvent('Setting', 'GpsSbas', gpsSbas[MISC.gps_ubx_sbas]); googleAnalytics.sendEvent('Setting', 'GpsSbas', gpsSbas[MISC.gps_ubx_sbas]);
} }
googleAnalytics.sendEvent('Setting', 'ReceiverMode', $('#rxType').val());
googleAnalytics.sendEvent('Setting', 'Looptime', FC_CONFIG.loopTime); googleAnalytics.sendEvent('Setting', 'Looptime', FC_CONFIG.loopTime);
/* /*

View file

@ -1,6 +1,6 @@
<div class="tab-motors toolbar_fixed_bottom"> <div class="tab-motors toolbar_fixed_bottom">
<div class="content_wrapper"> <div class="content_wrapper">
<div class="tab_title" i18n="tabMotorTesting"></div> <div class="tab_title" data-i18n="tabOutputs"></div>
<div class="gui_box grey config-section"> <div class="gui_box grey config-section">
<div class="gui_box_titlebar"> <div class="gui_box_titlebar">

View file

@ -158,7 +158,7 @@
</div> </div>
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="cf_column" style="margin-top:1em;"> <div class="cf_column" style="margin-top:1em;">
<table class="rate-tpa rate-tpa--misc"> <table class="settings-table settings-table--misc">
<tr> <tr>
<th data-i18n="pidTuningTPA"></th> <th data-i18n="pidTuningTPA"></th>
<td> <td>
@ -183,7 +183,7 @@
<div class="tab_subtitle" style="margin-top: 1em;">Rates & Expo</div> <div class="tab_subtitle" style="margin-top: 1em;">Rates & Expo</div>
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--inav"> <table class="settings-table settings-table--inav">
<tbody> <tbody>
<tr> <tr>
<th class="roll" data-i18n="pidTuningRollRate"></th> <th class="roll" data-i18n="pidTuningRollRate"></th>
@ -274,7 +274,7 @@
<div class="tab_subtitle" data-i18n="mainFilters" style="margin-top: 1em;"></div> <div class="tab_subtitle" data-i18n="mainFilters" style="margin-top: 1em;"></div>
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th>Gyro Dynamic Notch Filter</th> <th>Gyro Dynamic Notch Filter</th>
@ -337,7 +337,7 @@
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="tab_subtitle" data-i18n="dtermFilters" style="margin-top: 1em;"></div> <div class="tab_subtitle" data-i18n="dtermFilters" style="margin-top: 1em;"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th data-i18n="dterm_lpf_type"></th> <th data-i18n="dterm_lpf_type"></th>
@ -375,7 +375,7 @@
<div class="clear-both requires-v2_4"></div> <div class="clear-both requires-v2_4"></div>
<div class="tab_subtitle requires-v2_4" data-i18n="rpmFilters" style="margin-top: 1em;"></div> <div class="tab_subtitle requires-v2_4" data-i18n="rpmFilters" style="margin-top: 1em;"></div>
<div class="cf_column requires-v2_4"> <div class="cf_column requires-v2_4">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th data-i18n="rpm_gyro_filter_enabled"></th> <th data-i18n="rpm_gyro_filter_enabled"></th>
@ -396,7 +396,7 @@
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="tab_subtitle" data-i18n="tabFilteringAdvanced" style="margin-top: 1em;"></div> <div class="tab_subtitle" data-i18n="tabFilteringAdvanced" style="margin-top: 1em;"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th data-i18n="accLpfCutoffFrequency"></th> <th data-i18n="accLpfCutoffFrequency"></th>
@ -431,7 +431,7 @@
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="tab_subtitle" data-i18n="iTermMechanics" style="margin-top: 1em;"></div> <div class="tab_subtitle" data-i18n="iTermMechanics" style="margin-top: 1em;"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th data-i18n="mc_airmode_type"></th> <th data-i18n="mc_airmode_type"></th>
@ -493,7 +493,7 @@
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="tab_subtitle" data-i18n="dTermMechanics" style="margin-top: 1em;"></div> <div class="tab_subtitle" data-i18n="dTermMechanics" style="margin-top: 1em;"></div>
<div class="cf_column"> <div class="cf_column">
<table class="rate-tpa rate-tpa--filtering"> <table class="settings-table settings-table--filtering">
<tbody> <tbody>
<tr> <tr>
<th data-i18n="dtermSetpointWeight"></th> <th data-i18n="dtermSetpointWeight"></th>

View file

@ -33,7 +33,43 @@
</div> </div>
</div> </div>
<div class="fc_column half" style="margin-left: 20px;"> <div class="fc_column half" style="margin-left: 20px;">
<div class="gui_box grey" style="float: right;">
<div class="gui_box grey config-section">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationReceiver"></div>
</div>
<div class="spacer_box">
<div class="select">
<select id="receiver_type" data-setting="receiver_type"/>
<label for="receiver_type">
<span data-i18n="receiverType"></span>
</label>
</div>
<div id="serialrx_provider-wrapper">
<div class="info-box ok-box" data-i18n="configurationSerialRXHelp"></div>
<div class="select">
<select id="serialrx_provider" data-setting="serialrx_provider"/>
<label for="serialrx_provider">
<span data-i18n="configurationSerialRX"></span>
</label>
</div>
<div class="select">
<select id="serialrx_inverted" data-setting="serialrx_inverted"/>
<label for="serialrx_inverted">
<span data-i18n="serialrx_inverted"></span>
</label>
</div><div class="select">
<select id="serialrx_halfduplex" data-setting="serialrx_halfduplex"/>
<label for="serialrx_halfduplex">
<span data-i18n="serialrx_halfduplex"></span>
</label>
</div>
</div>
</div>
</div>
<div class="gui_box grey">
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;"> <div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
<div class="cf_column curves" style="width: calc(55% - 10px); min-width: 200px;"> <div class="cf_column curves" style="width: calc(55% - 10px); min-width: 200px;">
<div class="throttle_curve"> <div class="throttle_curve">
@ -72,7 +108,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="gui_box grey" style="float: right;"> <div class="gui_box grey">
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;"> <div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
<div class="fc_column curves" style="width: calc(50% - 10px);"> <div class="fc_column curves" style="width: calc(50% - 10px);">
<table> <table>

View file

@ -30,7 +30,11 @@ TABS.receiver.initialize = function (callback) {
loadChainer.execute(); loadChainer.execute();
function load_html() { function load_html() {
GUI.load("./tabs/receiver.html", process_html); GUI.load("./tabs/receiver.html", Settings.processHtml(process_html));
}
function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete);
} }
function drawRollPitchExpo() { function drawRollPitchExpo() {
@ -72,6 +76,21 @@ TABS.receiver.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); localize();
let $receiverMode = $('#receiver_type'),
$serialWrapper = $('#serialrx_provider-wrapper');
$receiverMode.change(function () {
if ($(this).find("option:selected").text() == "SERIAL") {
$serialWrapper.show();
$receiverMode.parent().removeClass("no-bottom-border");
} else {
$serialWrapper.hide();
$receiverMode.parent().addClass("no-bottom-border");
}
});
$receiverMode.trigger("change");
// fill in data from RC_tuning // fill in data from RC_tuning
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2)); $('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2)); $('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2));
@ -306,7 +325,11 @@ TABS.receiver.initialize = function (callback) {
} }
function save_rc_configs() { function save_rc_configs() {
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, save_to_eeprom); MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, storeSettings);
}
function storeSettings() {
saveSettings(save_to_eeprom);
} }
function save_to_eeprom() { function save_to_eeprom() {
@ -345,7 +368,11 @@ TABS.receiver.initialize = function (callback) {
}); });
// Only show the MSP control sticks if the MSP Rx feature is enabled // Only show the MSP control sticks if the MSP Rx feature is enabled
$(".sticks_btn").toggle(FC.isRxTypeEnabled('RX_MSP')); mspHelper.getSetting("receiver_type").then(function (s) {
if (s && s.setting.table && s.setting.table.values) {
$(".sticks_btn").toggle(s.setting.table.values[s.value] == 'MSP');
}
});
function get_rc_data() { function get_rc_data() {