diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 9788e6f8..86497858 100755
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -531,6 +531,15 @@
"featureTRANSPONDERTip": {
"message": "Configure via the Race Transponder tab after enabling."
},
+ "featureRX_NRF24": {
+ "message": "NRF24L01 based receiver"
+ },
+ "featureRX_NRF24Tip": {
+ "message": "Remember to set the NRF24 protocol after enabling."
+ },
+ "featureSOFTSPI": {
+ "message": "Enable CPU based SPI"
+ },
"configurationFeatureEnabled": {
"message": "Enabled"
@@ -691,6 +700,9 @@
"configurationSerialRX": {
"message": "Serial Receiver Provider"
},
+ "configurationNrf24Protocol": {
+ "message": "NRF24 protocol"
+ },
"configurationEepromSaved": {
"message": "EEPROM saved"
},
diff --git a/js/backup_restore.js b/js/backup_restore.js
index d48e6777..52298840 100644
--- a/js/backup_restore.js
+++ b/js/backup_restore.js
@@ -546,7 +546,9 @@ function configuration_restore(callback) {
mincheck: 1100,
maxcheck: 1900,
rx_min_usec: 885,
- rx_max_usec: 2115
+ rx_max_usec: 2115,
+ nrf24rx_protocol: 0,
+ nrf24rx_id: 0
};
}
diff --git a/js/fc.js b/js/fc.js
index 6f1e080c..e76aa7ae 100644
--- a/js/fc.js
+++ b/js/fc.js
@@ -253,7 +253,9 @@ var FC = {
mincheck: 0,
spektrum_sat_bind: 0,
rx_min_usec: 0,
- rx_max_usec: 0
+ rx_max_usec: 0,
+ nrf24rx_protocol: 0,
+ nrf24rx_id: 0
};
FAILSAFE_CONFIG = {
diff --git a/js/msp.js b/js/msp.js
index c47e9932..e062b324 100644
--- a/js/msp.js
+++ b/js/msp.js
@@ -853,6 +853,12 @@ var MSP = {
offset += 2;
RX_CONFIG.rx_max_usec = data.getUint16(offset, 1);
offset += 2;
+ if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
+ RX_CONFIG.nrf24rx_protocol = data.getUint8(offset, 1);
+ offset++;
+ RX_CONFIG.nrf24rx_id = data.getUint32(offset, 1);
+ offset += 4;
+ }
break;
case MSP_codes.MSP_FAILSAFE_CONFIG:
@@ -1380,6 +1386,13 @@ MSP.crunch = function (code) {
buffer.push(highByte(RX_CONFIG.rx_min_usec));
buffer.push(lowByte(RX_CONFIG.rx_max_usec));
buffer.push(highByte(RX_CONFIG.rx_max_usec));
+ if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
+ buffer.push(RX_CONFIG.nrf24rx_protocol);
+ buffer.push(RX_CONFIG.nrf24rx_id & 0xFF);
+ buffer.push((RX_CONFIG.nrf24rx_id >> 8) & 0xFF);
+ buffer.push((RX_CONFIG.nrf24rx_id >> 16) & 0xFF);
+ buffer.push((RX_CONFIG.nrf24rx_id >> 24) & 0xFF);
+ }
break;
case MSP_codes.MSP_SET_FAILSAFE_CONFIG:
diff --git a/tabs/configuration.css b/tabs/configuration.css
index e97c2cc0..1e4302cf 100644
--- a/tabs/configuration.css
+++ b/tabs/configuration.css
@@ -126,6 +126,12 @@
margin-bottom: 5px;
}
+.tab-configuration .nrf24Protocol {
+ width: 100%;
+ border: 1px solid silver;
+ margin-bottom: 5px;
+}
+
.tab-configuration .current .checkbox {
margin-top: 0px;
float: left;
@@ -274,6 +280,10 @@
min-height: 214px;
}
+.tab-configuration .nrf24provider {
+ min-height: 140px;
+}
+
.tab-configuration .current td:nth-child(2) {
width: 30px;
}
diff --git a/tabs/configuration.html b/tabs/configuration.html
index 3219426f..c1d9bcaf 100644
--- a/tabs/configuration.html
+++ b/tabs/configuration.html
@@ -212,6 +212,16 @@
+
diff --git a/tabs/configuration.js b/tabs/configuration.js
index f56a198c..e335b6e8 100644
--- a/tabs/configuration.js
+++ b/tabs/configuration.js
@@ -41,7 +41,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function load_loop_time() {
- var next_callback = load_3d;
+ var next_callback = load_rx_config;
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
MSP.send_message(MSP_codes.MSP_LOOP_TIME, false, false, next_callback);
} else {
@@ -49,6 +49,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
}
+ function load_rx_config() {
+ var next_callback = load_3d;
+ if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
+ MSP.send_message(MSP_codes.MSP_RX_CONFIG, false, false, next_callback);
+ } else {
+ next_callback();
+ }
+ }
+
function load_3d() {
var next_callback = load_sensor_alignment;
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
@@ -145,6 +154,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
);
}
+ if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
+ features.push(
+ {bit: 22, group: 'rxMode', mode: 'group', name: 'RX_NRF24', haveTip: true},
+ {bit: 23, group: 'other', name: 'SOFTSPI'}
+ );
+ }
+
function isFeatureEnabled(featureName) {
for (var i = 0; i < features.length; i++) {
if (features[i].name == featureName && bit_check(BF_CONFIG.features, features[i].bit)) {
@@ -347,6 +363,30 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// code below is a temporary fix, which we will be able to remove in the future (hopefully)
$('#content').scrollTop((scrollPosition) ? scrollPosition : 0);
+ var nrf24Protocoltypes = [
+ 'V202 250Kbps',
+ 'V202 1Mbps',
+ 'Syma X',
+ 'Syma X5C',
+ 'Cheerson CX10',
+ 'Cheerson CX10A',
+ 'JJRC H8_3D',
+ 'iNav Reference protocol'
+ ];
+
+ var nrf24Protocol_e = $('select.nrf24Protocol');
+ for (var i = 0; i < nrf24Protocoltypes.length; i++) {
+ nrf24Protocol_e.append('');
+ }
+
+ nrf24Protocol_e.change(function () {
+ RX_CONFIG.nrf24rx_protocol = parseInt($(this).val());
+ RX_CONFIG.nrf24rx_id = 0;
+ });
+
+ // select current nrf24 protocol
+ nrf24Protocol_e.val(RX_CONFIG.nrf24rx_protocol);
+
// fill board alignment
$('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));
@@ -492,7 +532,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
if (isFeatureEnabled('RX_SERIAL')) {
googleAnalytics.sendEvent('Setting', 'SerialRxProvider', serialRXtypes[BF_CONFIG.serialrx_type]);
}
-
+
+ // track feature usage
+ if (isFeatureEnabled('RX_NRF24')) {
+ googleAnalytics.sendEvent('Setting', 'nrf24Protocol', nrf24Protocoltypes[RX_CONFIG.nrf24rx_protocol]);
+ }
+
for (var i = 0; i < features.length; i++) {
var featureName = features[i].name;
if (isFeatureEnabled(featureName)) {
@@ -541,7 +586,16 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function save_looptime_config() {
- MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, save_to_eeprom);
+ MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, save_rx_config);
+ }
+
+ function save_rx_config() {
+ var next_callback = save_to_eeprom;
+ if(semver.gte(CONFIG.apiVersion, "1.21.0")) {
+ MSP.send_message(MSP_codes.MSP_SET_RX_CONFIG, MSP.crunch(MSP_codes.MSP_SET_RX_CONFIG), false, next_callback);
+ } else {
+ next_callback();
+ }
}
function save_to_eeprom() {