1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +03:00

Added UI for SPI RX configuration.

This commit is contained in:
mikeller 2017-08-16 01:20:20 +12:00
parent b604bc7dba
commit 8210653c1d
5 changed files with 60 additions and 3 deletions

View file

@ -550,7 +550,10 @@
"featureBLACKBOXTip": { "featureBLACKBOXTip": {
"message": "Configure via the BlackBox tab after enabling." "message": "Configure via the BlackBox tab after enabling."
}, },
"featureESC_SENSOR": { "featureRX_SPI": {
"message": "SPI RX support"
},
"featureESC_SENSOR": {
"message": "Use KISS/BLHeli_32 ESC telemetry as sensor" "message": "Use KISS/BLHeli_32 ESC telemetry as sensor"
}, },
"featureCHANNEL_FORWARDING": { "featureCHANNEL_FORWARDING": {
@ -631,6 +634,9 @@
"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) and choose a Serial Receiver Provider when using RX_SERIAL feature."
}, },
"configurationSpiRxHelp": {
"message": "<strong>Note:</strong> The SPI RX provider will only work if the required hardware is on board or connected to an SPI bus."
},
"configurationOtherFeaturesHelp": { "configurationOtherFeaturesHelp": {
"message": "<strong>Note:</strong> Some of the features of the firmware are not shown in this list any more, because they have been moved to other places in the configurator." "message": "<strong>Note:</strong> Some of the features of the firmware are not shown in this list any more, because they have been moved to other places in the configurator."
}, },
@ -811,6 +817,9 @@
"configurationSerialRX": { "configurationSerialRX": {
"message": "Serial Receiver Provider" "message": "Serial Receiver Provider"
}, },
"configurationSpiRx": {
"message": "SPI Bus Receiver Provider"
},
"configurationEepromSaved": { "configurationEepromSaved": {
"message": "EEPROM <span style=\"color: #ffbb00\">saved</span>" "message": "EEPROM <span style=\"color: #ffbb00\">saved</span>"
}, },

View file

@ -79,6 +79,7 @@ var Features = function (config) {
if (semver.gte(CONFIG.apiVersion, "1.31.0")) { if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
features.push( features.push(
{bit: 25, group: 'rxMode', mode: 'select', name: 'RX_SPI'},
{bit: 27, group: 'other', name: 'ESC_SENSOR'} {bit: 27, group: 'other', name: 'ESC_SENSOR'}
); );
} }

View file

@ -314,11 +314,11 @@
width: 30px; width: 30px;
} }
.tab-configuration .serialRXBox { .tab-configuration .serialRXBox, .spiRxBox {
padding-top: 0px; padding-top: 0px;
} }
.tab-configuration .serialRX, .rxMode { .tab-configuration .serialRX, .spiRx, .rxMode {
border: 1px solid silver; border: 1px solid silver;
width: 230px; width: 230px;
float: left; float: left;

View file

@ -345,6 +345,17 @@
</select> </select>
<span i18n="configurationSerialRX"></span> <span i18n="configurationSerialRX"></span>
</div> </div>
<div class="spiRxBox spacer_box" style="padding-bottom:10px;">
<div class="note spacerbottom">
<div class="note_spacer">
<p i18n="configurationSpiRxHelp"></p>
</div>
</div>
<select class="spiRx">
<!-- list generated here -->
</select>
<span i18n="configurationSpiRX"></span>
</div>
</div> </div>
</div> </div>

View file

@ -558,6 +558,32 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// select current serial RX type // select current serial RX type
serialRX_e.val(RX_CONFIG.serialrx_provider); serialRX_e.val(RX_CONFIG.serialrx_provider);
if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
var spiRxTypes = [
'NRF24_V202_250K',
'NRF24_V202_1M',
'NRF24_SYMA_X',
'NRF24_SYMA_X5C',
'NRF24_CX10',
'CX10A',
'NRF24_H8_3D',
'NRF24_INAV',
'FRSKY_D'
];
var spiRx_e = $('select.spiRx');
for (var i = 0; i < spiRxTypes.length; i++) {
spiRx_e.append('<option value="' + i + '">' + spiRxTypes[i] + '</option>');
}
spiRx_e.change(function () {
RX_CONFIG.rxSpiProtocol = parseInt($(this).val());
});
// select current serial RX type
spiRx_e.val(RX_CONFIG.rxSpiProtocol);
}
// 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)
@ -711,6 +737,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
} }
function checkShowSpiRxBox() {
if (FEATURE_CONFIG.features.isEnabled('RX_SPI')) {
$('div.spiRxBox').show();
} else {
$('div.spiRxBox').hide();
}
}
function checkUpdateGpsControls() { function checkUpdateGpsControls() {
if (FEATURE_CONFIG.features.isEnabled('GPS')) { if (FEATURE_CONFIG.features.isEnabled('GPS')) {
$('.gpsSettings').show(); $('.gpsSettings').show();
@ -771,6 +805,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
switch (element.attr('name')) { switch (element.attr('name')) {
case 'rxMode': case 'rxMode':
checkShowSerialRxBox(); checkShowSerialRxBox();
checkShowSpiRxBox();
break; break;
default: default:
@ -785,6 +820,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
checkShowDisarmDelay(); checkShowDisarmDelay();
checkShowSerialRxBox(); checkShowSerialRxBox();
checkShowSpiRxBox();
checkUpdateGpsControls(); checkUpdateGpsControls();
checkUpdate3dControls(); checkUpdate3dControls();