Skip to content

Commit 7e671b9

Browse files
committed
Enable custom address and radio channel
1 parent 3433dd2 commit 7e671b9

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

Multiprotocol/CFlie_nrf24l01.ino

+31-25
Original file line numberDiff line numberDiff line change
@@ -233,25 +233,25 @@ static void send_search_packet()
233233
NRF24L01_WriteReg(NRF24L01_07_STATUS, (BV(NRF24L01_07_TX_DS) | BV(NRF24L01_07_MAX_RT)));
234234
NRF24L01_FlushTx();
235235

236-
if (sub_protocol == CFLIE_AUTO)
237-
{
238-
if (rf_ch_num++ > 125)
239-
{
240-
rf_ch_num = 0;
241-
switch(data_rate)
242-
{
243-
case NRF24L01_BR_250K:
244-
data_rate = NRF24L01_BR_1M;
245-
break;
246-
case NRF24L01_BR_1M:
247-
data_rate = NRF24L01_BR_2M;
248-
break;
249-
case NRF24L01_BR_2M:
250-
data_rate = NRF24L01_BR_250K;
251-
break;
252-
}
253-
}
254-
}
236+
// if (sub_protocol == CFLIE_AUTO)
237+
// {
238+
// if (rf_ch_num++ > 125)
239+
// {
240+
// rf_ch_num = 0;
241+
// switch(data_rate)
242+
// {
243+
// case NRF24L01_BR_250K:
244+
// data_rate = NRF24L01_BR_1M;
245+
// break;
246+
// case NRF24L01_BR_1M:
247+
// data_rate = NRF24L01_BR_2M;
248+
// break;
249+
// case NRF24L01_BR_2M:
250+
// data_rate = NRF24L01_BR_250K;
251+
// break;
252+
// }
253+
// }
254+
// }
255255
set_rate_channel(data_rate, rf_ch_num);
256256

257257
NRF24L01_WritePayload(buf, sizeof(buf));
@@ -789,25 +789,31 @@ static uint8_t CFLIE_initialize_rx_tx_addr()
789789
rx_tx_addr[0] =
790790
rx_tx_addr[1] =
791791
rx_tx_addr[2] =
792-
rx_tx_addr[3] =
793-
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
794-
792+
rx_tx_addr[3] = 0xE7;
793+
794+
unsigned x10 = (RX_num / 10U) % 10;
795+
unsigned x1 = RX_num - x10*10;
796+
795797
switch (sub_protocol) {
796798
case CFLIE_2Mbps:
797799
data_rate = NRF24L01_BR_2M;
798-
rf_ch_num = option;
800+
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
801+
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
799802
break;
800803
case CFLIE_1Mbps:
801804
data_rate = NRF24L01_BR_1M;
802-
rf_ch_num = option;
805+
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
806+
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
803807
break;
804808
case CFLIE_250kbps:
805809
data_rate = NRF24L01_BR_250K;
806-
rf_ch_num = option;
810+
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
811+
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
807812
break;
808813
default:
809814
data_rate = NRF24L01_BR_2M;
810815
rf_ch_num = 80;
816+
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
811817
}
812818

813819
return CFLIE_INIT_SEARCH;

Multiprotocol/Multi_Protos.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const char STR_SUBTYPE_MOULKG[] = "\x06""Analog""Digit\0";
174174
const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0";
175175
const char STR_SUBTYPE_E129[] = "\x04""E129""C186";
176176
const char STR_SUBTYPE_FX[] = "\x04""816\0""620\0""9630";
177-
const char STR_SUBTYPE_CFLIE[] = "\x07""Auto\0 ""2Mbps\0 ""1Mbps\0 ""250kbps";
177+
const char STR_SUBTYPE_CFLIE[] = "\x07""Default\0 ""2Mbps\0 ""1Mbps\0 ""250kbps";
178178
#define NO_SUBTYPE nullptr
179179

180180
#ifdef SEND_CPPM

Multiprotocol/Multiprotocol.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ enum FX
465465
};
466466
enum CFLIE
467467
{
468-
CFLIE_AUTO = 0,
468+
CFLIE_DEFAULT = 0,
469469
CFLIE_2Mbps = 1,
470470
CFLIE_1Mbps = 2,
471471
CFLIE_250kbps = 3,

Multiprotocol/_Config.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@
230230
#define ESKY150_NRF24L01_INO
231231
#define FQ777_NRF24L01_INO
232232
#define FX_NRF24L01_INO
233-
#define FY326_NRF24L01_INO
234-
#define GW008_NRF24L01_INO
235-
#define HISKY_NRF24L01_INO
233+
//#define FY326_NRF24L01_INO
234+
//#define GW008_NRF24L01_INO
235+
//#define HISKY_NRF24L01_INO
236236
#define HONTAI_NRF24L01_INO
237237
#define H8_3D_NRF24L01_INO
238238
#define JJRC345_NRF24L01_INO
@@ -576,10 +576,10 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
576576
CABELL_SET_FAIL_SAFE
577577
CABELL_UNBIND
578578
PROTO_CFLIE
579-
CFLIE_AUTO
580-
CFLIE_2Mbps
579+
CFLIE_DEFAULT
580+
CFLIE_2Mbps
581581
CFLIE_1Mbps
582-
CFLIE_250kbps
582+
CFLIE_250kbps
583583
PROTO_CG023
584584
CG023
585585
YD829

0 commit comments

Comments
 (0)