mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
Move receiver and rssi configuration to receiver tab
This commit is contained in:
parent
168e778487
commit
a4ba1adb97
7 changed files with 444 additions and 431 deletions
|
@ -718,6 +718,11 @@ progress[value]::-webkit-progress-bar {
|
|||
|
||||
/* RECEIVER TAB */
|
||||
|
||||
.tab-receiver .gui_box span {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tab-receiver input,
|
||||
.tab-receiver select {
|
||||
background-color: #3a3a3a;
|
||||
color: white;
|
||||
|
|
|
@ -201,13 +201,7 @@
|
|||
float: left;
|
||||
}
|
||||
|
||||
.tab-configuration .rssi td {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-configuration .rssi .gui_box, .tab-configuration .system .gui_box {
|
||||
.tab-configuration .tab-configuration .system .gui_box {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
@ -220,27 +214,6 @@
|
|||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.tab-configuration .current .gui_box {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-configuration .current td:nth-child(2) {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.tab-configuration .rssi td:nth-child(2) {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.tab-configuration .rxFailsafe td:nth-child(2) {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.tab-configuration .serialRXBox, .spiRxBox {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
|
||||
.tab-configuration .gps td:nth-child(2) {
|
||||
width: 38px;
|
||||
}
|
||||
|
@ -336,7 +309,7 @@
|
|||
.tab-configuration .gui_box span {
|
||||
line-height: 17px;
|
||||
}
|
||||
.tab-configuration .rssi .gui_box, .tab-configuration .system .gui_box {
|
||||
.tab-configuration .system .gui_box {
|
||||
float: left;
|
||||
}
|
||||
.tab-configuration .board .gui_box, .tab-configuration .acc .gui_box {
|
||||
|
@ -345,30 +318,15 @@
|
|||
.tab-configuration .gps .gui_box, .tab-configuration .other .gui_box {
|
||||
float: left;
|
||||
}
|
||||
.tab-configuration .current .gui_box {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
@media all and (max-width: 575px) {
|
||||
.tab-configuration .rssi .gui_box, .tab-configuration .system .gui_box {
|
||||
.tab-configuration .system .gui_box {
|
||||
min-height: auto;
|
||||
}
|
||||
.tab-configuration .current td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
.tab-configuration .voltage td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
.tab-configuration .rssi td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
.tab-configuration .rxFailsafe td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
.tab-configuration .gps td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
select.features.rxMode, select.serialRX, .dshotbeacon > td > div.select > div, .dshotbeacon select.dshotBeeperBeaconTone {
|
||||
.dshotbeacon > td > div.select > div, .dshotbeacon select.dshotBeeperBeaconTone {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -577,3 +577,149 @@
|
|||
display: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* rx configuration */
|
||||
|
||||
.tab-receiver .rssi input,
|
||||
.tab-receiver .receiver select {
|
||||
border: 1px solid var(--subtleAccent);
|
||||
width: 230px;
|
||||
height: 20px;
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.tab-receiver table {
|
||||
margin-bottom: 0;
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-receiver table, .tab-receiver table th, .tab-receiver table td {
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tab-receiver table th {
|
||||
padding: 3px;
|
||||
border-bottom: 1px solid var(--subtleAccent);
|
||||
}
|
||||
|
||||
.tab-receiver table td {
|
||||
border-bottom: 1px solid var(--subtleAccent);
|
||||
}
|
||||
|
||||
.tab-receiver table tr td:first-child {
|
||||
text-align: left;
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
.tab-receiver table thead tr:first-child {
|
||||
background-color: #ececec;
|
||||
}
|
||||
|
||||
.tab-receiver dl.features dt {
|
||||
float: left;
|
||||
width: 10px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.tab-receiver dl.features dt input {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.tab-receiver dl.features dd {
|
||||
margin: 0 0 0 20px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.tab-receiver span {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tab-receiver .spacer_box {
|
||||
padding-bottom: 10px;
|
||||
float: left;
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
.tab-receiver .select
|
||||
{
|
||||
margin-bottom: 5px;
|
||||
clear: left;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid var(--subtleAccent);
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-receiver .select:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-receiver .gui_box_titlebar {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-receiver .rssi thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-receiver .gui_box {
|
||||
margin-bottom: 10px;
|
||||
float: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tab-receiver .rssi td {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-receiver .rssi .gui_box {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-receiver .rssi td:nth-child(2) {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.tab-receiver .serialRXBox, .spiRxBox {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.tab-receiver .gui_box span {
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
line-height: 19px;
|
||||
color: #4f4f4f;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
||||
.tab-receiver .gui_box span {
|
||||
line-height: 17px;
|
||||
}
|
||||
.tab-receiver .rssi .gui_box {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 575px) {
|
||||
.tab-receiver .rssi .gui_box {
|
||||
min-height: auto;
|
||||
}
|
||||
.tab-receiver .rssi td:nth-child(2) {
|
||||
width: auto;
|
||||
}
|
||||
.tab-receiver .features.rxMode, .tab-receiver .serialRX {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ TABS.configuration = {
|
|||
analyticsChanges: {},
|
||||
};
|
||||
|
||||
TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||
TABS.configuration.initialize = function (callback) {
|
||||
const self = this;
|
||||
|
||||
if (GUI.active_tab != 'configuration') {
|
||||
|
@ -12,129 +12,34 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
GUI.configuration_loaded = true;
|
||||
}
|
||||
|
||||
function load_config() {
|
||||
MSP.send_message(MSPCodes.MSP_FEATURE_CONFIG, false, false, load_beeper_config);
|
||||
}
|
||||
|
||||
function load_beeper_config() {
|
||||
const nextCallBack = load_serial_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
|
||||
MSP.send_message(MSPCodes.MSP_BEEPER_CONFIG, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_serial_config() {
|
||||
mspHelper.loadSerialConfig(load_board_alignment_config);
|
||||
mspHelper.loadSerialConfig(load_config);
|
||||
}
|
||||
|
||||
function load_board_alignment_config() {
|
||||
MSP.send_message(MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG, false, false, load_rx_map);
|
||||
}
|
||||
|
||||
function load_rx_map() {
|
||||
MSP.send_message(MSPCodes.MSP_RX_MAP, false, false, load_rssi_config);
|
||||
}
|
||||
|
||||
function load_rssi_config() {
|
||||
MSP.send_message(MSPCodes.MSP_RSSI_CONFIG, false, false, load_gps_config);
|
||||
}
|
||||
|
||||
function load_gps_config() {
|
||||
const nextCallBack = load_acc_trim;
|
||||
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
|
||||
MSP.send_message(MSPCodes.MSP_GPS_CONFIG, false, false, load_acc_trim);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_acc_trim() {
|
||||
MSP.send_message(MSPCodes.MSP_ACC_TRIM, false, false, load_misc);
|
||||
}
|
||||
|
||||
function load_misc() {
|
||||
const nextCallBack = load_arming_config;
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
|
||||
MSP.send_message(MSPCodes.MSP_MISC, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_arming_config() {
|
||||
const nextCallBack = load_rc_deadband;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.8.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_ARMING_CONFIG, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_rc_deadband() {
|
||||
const nextCallBack = load_sensor_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.17.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_sensor_config() {
|
||||
const nextCallBack = load_sensor_alignment;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_CONFIG, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_sensor_alignment() {
|
||||
const nextCallBack = load_name;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_ALIGNMENT, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_name() {
|
||||
const nextCallBack = load_rx_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_rx_config() {
|
||||
const nextCallBack = load_filter_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_filter_config() {
|
||||
const nextCallBack = load_advanced_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
MSP.send_message(MSPCodes.MSP_FILTER_CONFIG, false, false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function load_advanced_config() {
|
||||
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, load_html);
|
||||
function load_config() {
|
||||
Promise
|
||||
.resolve(true)
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_FEATURE_CONFIG); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36) ? MSP.promise(MSPCodes.MSP_BEEPER_CONFIG) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG); })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33) ? MSP.promise(MSPCodes.MSP_GPS_CONFIG) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_ACC_TRIM); })
|
||||
.then(() => { return semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_33) ? MSP.promise(MSPCodes.MSP_MISC) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.8.0") ? MSP.promise(MSPCodes.MSP_ARMING_CONFIG) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.17.0") ? MSP.promise(MSPCodes.MSP_RC_DEADBAND) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.16.0") ? MSP.promise(MSPCodes.MSP_SENSOR_CONFIG) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.15.0") ? MSP.promise(MSPCodes.MSP_SENSOR_ALIGNMENT) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, "1.20.0") ? MSP.promise(MSPCodes.MSP_NAME) : true; })
|
||||
.then(() => { return semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31) ? MSP.promise(MSPCodes.MSP_RX_CONFIG) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_ADVANCED_CONFIG); })
|
||||
.then(() => { load_html(); });
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/configuration.html", process_html);
|
||||
}
|
||||
|
||||
load_config();
|
||||
load_serial_config();
|
||||
|
||||
function process_html() {
|
||||
self.analyticsChanges = {};
|
||||
|
@ -455,8 +360,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
// Only show these sections for supported FW
|
||||
if (semver.lt(FC.CONFIG.apiVersion, "1.16.0")) {
|
||||
$('.selectProtocol').hide();
|
||||
$('.checkboxPwm').hide();
|
||||
$('.selectPidProcessDenom').hide();
|
||||
}
|
||||
|
||||
|
@ -586,96 +489,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
gpsBaudrateElement.parent().hide();
|
||||
}
|
||||
|
||||
const serialRXSelectEl = $('select.serialRX');
|
||||
FC.getSerialRxTypes().forEach(function(serialRxType, index) {
|
||||
serialRXSelectEl.append(`<option value="${index}">${serialRxType}</option>`);
|
||||
});
|
||||
|
||||
serialRXSelectEl.change(function () {
|
||||
const serialRxValue = parseInt($(this).val());
|
||||
|
||||
let newValue;
|
||||
if (serialRxValue !== FC.RX_CONFIG.serialrx_provider) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
}
|
||||
self.analyticsChanges['SerialRx'] = newValue;
|
||||
|
||||
FC.RX_CONFIG.serialrx_provider = serialRxValue;
|
||||
});
|
||||
|
||||
// select current serial RX type
|
||||
serialRXSelectEl.val(FC.RX_CONFIG.serialrx_provider);
|
||||
const spiRxTypes = [];
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||
spiRxTypes.push(
|
||||
'NRF24_V202_250K',
|
||||
'NRF24_V202_1M',
|
||||
'NRF24_SYMA_X',
|
||||
'NRF24_SYMA_X5C',
|
||||
'NRF24_CX10',
|
||||
'CX10A',
|
||||
'NRF24_H8_3D',
|
||||
'NRF24_INAV',
|
||||
'FRSKY_D'
|
||||
);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X',
|
||||
'A7105_FLYSKY',
|
||||
'A7105_FLYSKY_2A',
|
||||
'NRF24_KN',
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||
spiRxTypes.push(
|
||||
'SFHSS',
|
||||
'SPEKTRUM',
|
||||
'FRSKY_X_LBT',
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
spiRxTypes.push(
|
||||
'REDPINE',
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X_V2',
|
||||
'FRSKY_X_LBT_V2',
|
||||
);
|
||||
}
|
||||
|
||||
const spiRx_e = $('select.spiRx');
|
||||
for (let i = 0; i < spiRxTypes.length; i++) {
|
||||
spiRx_e.append(`<option value="${i}">${spiRxTypes[i]}</option>`);
|
||||
}
|
||||
|
||||
spiRx_e.change(function () {
|
||||
const value = parseInt($(this).val());
|
||||
|
||||
let newValue = undefined;
|
||||
if (value !== FC.RX_CONFIG.rxSpiProtocol) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
}
|
||||
self.analyticsChanges['SPIRXProtocol'] = newValue;
|
||||
|
||||
FC.RX_CONFIG.rxSpiProtocol = value;
|
||||
});
|
||||
|
||||
// select current serial RX type
|
||||
spiRx_e.val(FC.RX_CONFIG.rxSpiProtocol);
|
||||
}
|
||||
|
||||
// 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
|
||||
// code below is a temporary fix, which we will be able to remove in the future (hopefully)
|
||||
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
|
||||
|
||||
// fill board alignment
|
||||
$('input[name="board_align_roll"]').val(FC.BOARD_ALIGNMENT_CONFIG.roll);
|
||||
$('input[name="board_align_pitch"]').val(FC.BOARD_ALIGNMENT_CONFIG.pitch);
|
||||
|
@ -691,21 +504,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
// UI hooks
|
||||
function checkShowSerialRxBox() {
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SERIAL')) {
|
||||
$('div.serialRXBox').show();
|
||||
} else {
|
||||
$('div.serialRXBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkShowSpiRxBox() {
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI')) {
|
||||
$('div.spiRxBox').show();
|
||||
} else {
|
||||
$('div.spiRxBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkUpdateGpsControls() {
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('GPS')) {
|
||||
|
@ -738,11 +536,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
FC.FEATURE_CONFIG.features.updateData(element);
|
||||
updateTabList(FC.FEATURE_CONFIG.features);
|
||||
|
||||
if (element.attr('name') === 'rxMode') {
|
||||
checkShowSerialRxBox();
|
||||
checkShowSpiRxBox();
|
||||
}
|
||||
});
|
||||
|
||||
$('input.condition', beeper_e).change(function () {
|
||||
|
@ -750,8 +543,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
FC.BEEPER_CONFIG.beepers.updateData(element);
|
||||
});
|
||||
|
||||
checkShowSerialRxBox();
|
||||
checkShowSpiRxBox();
|
||||
checkUpdateGpsControls();
|
||||
|
||||
$('a.save').on('click', function() {
|
||||
|
@ -805,96 +596,30 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
FC.CONFIG.name = $.trim($('input[name="craftName"]').val());
|
||||
|
||||
function save_serial_config() {
|
||||
const nextCallBack = save_feature_config;
|
||||
mspHelper.sendSerialConfig(nextCallBack);
|
||||
mspHelper.sendSerialConfig(save_config);
|
||||
}
|
||||
|
||||
function save_feature_config() {
|
||||
const nextCallBack = save_beeper_config;
|
||||
MSP.send_message(MSPCodes.MSP_SET_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG), false, nextCallBack);
|
||||
}
|
||||
|
||||
function save_beeper_config() {
|
||||
const nextCallBack = save_misc;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_BEEPER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BEEPER_CONFIG), false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function save_misc() {
|
||||
const nextCallBack = save_board_alignment_config;
|
||||
if(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function save_board_alignment_config() {
|
||||
const nextCallBack = save_gps_config;
|
||||
MSP.send_message(MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG), false, nextCallBack);
|
||||
}
|
||||
|
||||
|
||||
function save_gps_config() {
|
||||
const nextCallBack = save_rc_deadband;
|
||||
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_GPS_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_GPS_CONFIG), false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function save_rc_deadband() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, save_sensor_alignment);
|
||||
}
|
||||
|
||||
function save_sensor_alignment() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_SENSOR_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_ALIGNMENT), false, save_esc_protocol);
|
||||
}
|
||||
|
||||
function save_esc_protocol() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG), false, save_acc_trim);
|
||||
}
|
||||
|
||||
function save_acc_trim() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_ACC_TRIM, mspHelper.crunch(MSPCodes.MSP_SET_ACC_TRIM), false, save_arming_config);
|
||||
}
|
||||
|
||||
function save_arming_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_ARMING_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ARMING_CONFIG), false, save_sensor_config);
|
||||
}
|
||||
|
||||
function save_sensor_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_SENSOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_CONFIG), false, save_name);
|
||||
}
|
||||
|
||||
function save_name() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME), false, save_rx_config);
|
||||
}
|
||||
|
||||
function save_rx_config() {
|
||||
const nextCallBack = save_filter_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function save_filter_config() {
|
||||
const nextCallBack = save_to_eeprom;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG), false, nextCallBack);
|
||||
} else {
|
||||
nextCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
function save_config() {
|
||||
Promise
|
||||
.resolve(true)
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG)); })
|
||||
.then(() => { return (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) ?
|
||||
MSP.promise(MSPCodes.MSP_SET_BEEPER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BEEPER_CONFIG)) : true; })
|
||||
.then(() => { return (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_33)) ?
|
||||
MSP.promise(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC)) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG)); })
|
||||
.then(() => { return (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33)) ?
|
||||
MSP.promise(MSPCodes.MSP_SET_GPS_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_GPS_CONFIG)) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_SENSOR_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_ALIGNMENT)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_ACC_TRIM, mspHelper.crunch(MSPCodes.MSP_SET_ACC_TRIM)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_ARMING_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ARMING_CONFIG)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_SENSOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_CONFIG)); })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME)); })
|
||||
.then(() => { return (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) ? MSP.promise(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG)) : true; })
|
||||
.then(() => { return MSP.promise(MSPCodes.MSP_EEPROM_WRITE); })
|
||||
.then(() => { reboot(); });
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
|
|
|
@ -4,7 +4,9 @@ TABS.receiver = {
|
|||
rateChartHeight: 117,
|
||||
useSuperExpo: false,
|
||||
deadband: 0,
|
||||
yawDeadband: 0
|
||||
yawDeadband: 0,
|
||||
analyticsChanges: {},
|
||||
needReboot: false,
|
||||
};
|
||||
|
||||
TABS.receiver.initialize = function (callback) {
|
||||
|
@ -59,6 +61,12 @@ TABS.receiver.initialize = function (callback) {
|
|||
MSP.send_message(MSPCodes.MSP_FEATURE_CONFIG, false, false, get_rc_data);
|
||||
|
||||
function process_html() {
|
||||
self.analyticsChanges = {};
|
||||
|
||||
const featuresElement = $('.tab-receiver .features');
|
||||
|
||||
FC.FEATURE_CONFIG.features.generateElements(featuresElement);
|
||||
|
||||
// translate to user-selected language
|
||||
i18n.localizePage();
|
||||
|
||||
|
@ -230,14 +238,158 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
$('select[name="rssi_channel"]').val(FC.RSSI_CONFIG.channel);
|
||||
|
||||
const serialRxSelectElement = $('select.serialRX');
|
||||
FC.getSerialRxTypes().forEach((serialRxType, index) => {
|
||||
serialRxSelectElement.append(`<option value="${index}">${serialRxType}</option>`);
|
||||
});
|
||||
|
||||
serialRxSelectElement.change(function () {
|
||||
const serialRxValue = parseInt($(this).val());
|
||||
|
||||
let newValue;
|
||||
if (serialRxValue !== FC.RX_CONFIG.serialrx_provider) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
updateSaveButton(true);
|
||||
}
|
||||
tab.analyticsChanges['SerialRx'] = newValue;
|
||||
|
||||
FC.RX_CONFIG.serialrx_provider = serialRxValue;
|
||||
});
|
||||
|
||||
// select current serial RX type
|
||||
serialRxSelectElement.val(FC.RX_CONFIG.serialrx_provider);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||
const spiRxTypes = [
|
||||
'NRF24_V202_250K',
|
||||
'NRF24_V202_1M',
|
||||
'NRF24_SYMA_X',
|
||||
'NRF24_SYMA_X5C',
|
||||
'NRF24_CX10',
|
||||
'CX10A',
|
||||
'NRF24_H8_3D',
|
||||
'NRF24_INAV',
|
||||
'FRSKY_D',
|
||||
];
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X',
|
||||
'A7105_FLYSKY',
|
||||
'A7105_FLYSKY_2A',
|
||||
'NRF24_KN'
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||
spiRxTypes.push(
|
||||
'SFHSS',
|
||||
'SPEKTRUM',
|
||||
'FRSKY_X_LBT'
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
spiRxTypes.push(
|
||||
'REDPINE'
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X_V2',
|
||||
'FRSKY_X_LBT_V2'
|
||||
);
|
||||
}
|
||||
|
||||
const spiRxElement = $('select.spiRx');
|
||||
for (let i = 0; i < spiRxTypes.length; i++) {
|
||||
spiRxElement.append(`<option value="${i}">${spiRxTypes[i]}</option>`);
|
||||
}
|
||||
|
||||
spiRxElement.change(function () {
|
||||
const value = parseInt($(this).val());
|
||||
|
||||
let newValue = undefined;
|
||||
if (value !== FC.RX_CONFIG.rxSpiProtocol) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
updateSaveButton(true);
|
||||
}
|
||||
tab.analyticsChanges['SPIRXProtocol'] = newValue;
|
||||
|
||||
FC.RX_CONFIG.rxSpiProtocol = value;
|
||||
});
|
||||
|
||||
// select current serial RX type
|
||||
spiRxElement.val(FC.RX_CONFIG.rxSpiProtocol);
|
||||
}
|
||||
|
||||
|
||||
// UI Hooks
|
||||
|
||||
function updateSaveButton(reboot=false) {
|
||||
if (reboot) {
|
||||
tab.needReboot = true;
|
||||
}
|
||||
if (tab.needReboot) {
|
||||
$('.update_btn').hide();
|
||||
$('.save_btn').show();
|
||||
} else {
|
||||
$('.update_btn').show();
|
||||
$('.save_btn').hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('input.feature', featuresElement).change(function () {
|
||||
const element = $(this);
|
||||
|
||||
FC.FEATURE_CONFIG.features.updateData(element);
|
||||
updateTabList(FC.FEATURE_CONFIG.features);
|
||||
|
||||
if (element.attr('name') === "RSSI_ADC") {
|
||||
updateSaveButton(true);
|
||||
}
|
||||
});
|
||||
|
||||
function checkShowSerialRxBox() {
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SERIAL')) {
|
||||
$('div.serialRXBox').show();
|
||||
} else {
|
||||
$('div.serialRXBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkShowSpiRxBox() {
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI')) {
|
||||
$('div.spiRxBox').show();
|
||||
} else {
|
||||
$('div.spiRxBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(featuresElement).filter('select').change(function () {
|
||||
const element = $(this);
|
||||
FC.FEATURE_CONFIG.features.updateData(element);
|
||||
updateTabList(FC.FEATURE_CONFIG.features);
|
||||
if (element.attr('name') === 'rxMode') {
|
||||
checkShowSerialRxBox();
|
||||
checkShowSpiRxBox();
|
||||
updateSaveButton(true);
|
||||
}
|
||||
});
|
||||
|
||||
checkShowSerialRxBox();
|
||||
checkShowSpiRxBox();
|
||||
updateSaveButton();
|
||||
|
||||
$('a.refresh').click(function () {
|
||||
tab.refresh(function () {
|
||||
GUI.log(i18n.getMessage('receiverDataRefreshed'));
|
||||
});
|
||||
});
|
||||
|
||||
$('a.update').click(function () {
|
||||
function saveConfiguration(boot=false) {
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
FC.RX_CONFIG.stick_max = parseInt($('.sticks input[name="stick_max"]').val());
|
||||
FC.RX_CONFIG.stick_center = parseInt($('.sticks input[name="stick_center"]').val());
|
||||
|
@ -290,7 +442,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_rx_config() {
|
||||
const nextCallback = save_to_eeprom;
|
||||
const nextCallback = (boot) ? save_feature_config : save_to_eeprom;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, nextCallback);
|
||||
} else {
|
||||
|
@ -298,13 +450,37 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(i18n.getMessage('receiverEepromSaved'));
|
||||
});
|
||||
function save_feature_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(i18n.getMessage('configurationEepromSaved'));
|
||||
if (boot) {
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false);
|
||||
reinitialiseConnection(tab);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
analytics.sendChangeEvents(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, tab.analyticsChanges);
|
||||
tab.analyticsChanges = {};
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_MAP, mspHelper.crunch(MSPCodes.MSP_SET_RX_MAP), false, save_rssi_config);
|
||||
}
|
||||
|
||||
$('a.update').click(function () {
|
||||
saveConfiguration(false);
|
||||
});
|
||||
|
||||
$('a.save').click(function () {
|
||||
saveConfiguration(true);
|
||||
tab.needReboot = false;
|
||||
});
|
||||
|
||||
$("a.sticks").click(function() {
|
||||
|
@ -328,7 +504,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
windowWatcherUtil.passValue(createdWindow, 'darkTheme', DarkTheme.isDarkThemeEnabled(DarkTheme.configEnabled));
|
||||
|
||||
|
|
|
@ -68,66 +68,6 @@
|
|||
</div>
|
||||
<!-- END SYSTEM CONFIGURATION-->
|
||||
|
||||
<!-- RECEIVER -->
|
||||
<!-- FIXME move receiver and RSSI to receiver tab -->
|
||||
<div class="receiver">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="configurationReceiver"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<select class="features rxMode" name="rxMode">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationReceiverMode"></span>
|
||||
</div>
|
||||
<div class="serialRXBox spacer_box">
|
||||
<div class="note">
|
||||
<p i18n="configurationSerialRXHelp"></p>
|
||||
</div>
|
||||
<select class="serialRX">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationSerialRX"></span>
|
||||
</div>
|
||||
<div class="spiRxBox spacer_box">
|
||||
<div class="note">
|
||||
<p i18n="configurationSpiRxHelp"></p>
|
||||
</div>
|
||||
<select class="spiRx">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationSpiRX"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END RECEIVER-->
|
||||
|
||||
<!-- RSSI -->
|
||||
<div class="rssi">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="configurationRSSI"></div>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationRSSIHelp"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="configurationFeatureEnabled"></th>
|
||||
<th i18n="configurationFeatureDescription"></th>
|
||||
<th i18n="configurationFeatureName"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="features rssi">
|
||||
<!-- table generated here -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END RSSI-->
|
||||
|
||||
<!-- PERSONALIZATION-->
|
||||
<div class="gui_box grey miscSettings">
|
||||
<div class="gui_box_titlebar">
|
||||
|
|
|
@ -10,6 +10,66 @@
|
|||
<div class="grid-row">
|
||||
<div class="grid-col col6 bars"></div>
|
||||
<div class="grid-col col6">
|
||||
|
||||
<!-- RECEIVER -->
|
||||
<div class="receiver">
|
||||
<div class="gui_box receiver grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="configurationReceiver"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<select class="features rxMode" name="rxMode">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationReceiverMode"></span>
|
||||
</div>
|
||||
<div class="serialRXBox spacer_box">
|
||||
<div class="note">
|
||||
<p i18n="configurationSerialRXHelp"></p>
|
||||
</div>
|
||||
<select class="serialRX">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationSerialRX"></span>
|
||||
</div>
|
||||
<div class="spiRxBox spacer_box">
|
||||
<div class="note">
|
||||
<p i18n="configurationSpiRxHelp"></p>
|
||||
</div>
|
||||
<select class="spiRx">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<span i18n="configurationSpiRX"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RSSI -->
|
||||
<div class="rssi">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="configurationRSSI"></div>
|
||||
<div class="helpicon cf_tip" i18n_title="configurationRSSIHelp"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="rssi" i18n="configurationFeatureEnabled"></th>
|
||||
<th scope="rssi" i18n="configurationFeatureDescription"></th>
|
||||
<th scope="rssi" i18n="configurationFeatureName"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="features rssi">
|
||||
<!-- table generated here -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RSSI CHANNEL-->
|
||||
|
||||
<div class="rssi_channel_wrapper grey">
|
||||
<div class="head" i18n="receiverRssiChannel"></div>
|
||||
<select name="rssi_channel">
|
||||
|
@ -372,5 +432,8 @@
|
|||
<div class="btn update_btn">
|
||||
<a class="update" href="#" i18n="receiverButtonSave"></a>
|
||||
</div>
|
||||
<div class="btn save_btn">
|
||||
<a class="save" href="#" i18n="configurationButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue