Enable custom address and radio channel

This commit is contained in:
Matej Karasek 2023-10-04 13:11:12 +02:00
parent 3433dd2c50
commit 7e671b98dc
4 changed files with 39 additions and 33 deletions

View File

@ -233,25 +233,25 @@ static void send_search_packet()
NRF24L01_WriteReg(NRF24L01_07_STATUS, (BV(NRF24L01_07_TX_DS) | BV(NRF24L01_07_MAX_RT)));
NRF24L01_FlushTx();
if (sub_protocol == CFLIE_AUTO)
{
if (rf_ch_num++ > 125)
{
rf_ch_num = 0;
switch(data_rate)
{
case NRF24L01_BR_250K:
data_rate = NRF24L01_BR_1M;
break;
case NRF24L01_BR_1M:
data_rate = NRF24L01_BR_2M;
break;
case NRF24L01_BR_2M:
data_rate = NRF24L01_BR_250K;
break;
}
}
}
// if (sub_protocol == CFLIE_AUTO)
// {
// if (rf_ch_num++ > 125)
// {
// rf_ch_num = 0;
// switch(data_rate)
// {
// case NRF24L01_BR_250K:
// data_rate = NRF24L01_BR_1M;
// break;
// case NRF24L01_BR_1M:
// data_rate = NRF24L01_BR_2M;
// break;
// case NRF24L01_BR_2M:
// data_rate = NRF24L01_BR_250K;
// break;
// }
// }
// }
set_rate_channel(data_rate, rf_ch_num);
NRF24L01_WritePayload(buf, sizeof(buf));
@ -789,25 +789,31 @@ static uint8_t CFLIE_initialize_rx_tx_addr()
rx_tx_addr[0] =
rx_tx_addr[1] =
rx_tx_addr[2] =
rx_tx_addr[3] =
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
rx_tx_addr[3] = 0xE7;
unsigned x10 = (RX_num / 10U) % 10;
unsigned x1 = RX_num - x10*10;
switch (sub_protocol) {
case CFLIE_2Mbps:
data_rate = NRF24L01_BR_2M;
rf_ch_num = option;
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
break;
case CFLIE_1Mbps:
data_rate = NRF24L01_BR_1M;
rf_ch_num = option;
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
break;
case CFLIE_250kbps:
data_rate = NRF24L01_BR_250K;
rf_ch_num = option;
rf_ch_num = option; // "RF channel" in the transmitter <0, 125>
rx_tx_addr[4] = x10*16 + x1; // "Receiver" in the transmitter <0, 63>
break;
default:
data_rate = NRF24L01_BR_2M;
rf_ch_num = 80;
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
}
return CFLIE_INIT_SEARCH;

View File

@ -174,7 +174,7 @@ const char STR_SUBTYPE_MOULKG[] = "\x06""Analog""Digit\0";
const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0";
const char STR_SUBTYPE_E129[] = "\x04""E129""C186";
const char STR_SUBTYPE_FX[] = "\x04""816\0""620\0""9630";
const char STR_SUBTYPE_CFLIE[] = "\x07""Auto\0 ""2Mbps\0 ""1Mbps\0 ""250kbps";
const char STR_SUBTYPE_CFLIE[] = "\x07""Default\0 ""2Mbps\0 ""1Mbps\0 ""250kbps";
#define NO_SUBTYPE nullptr
#ifdef SEND_CPPM

View File

@ -465,7 +465,7 @@ enum FX
};
enum CFLIE
{
CFLIE_AUTO = 0,
CFLIE_DEFAULT = 0,
CFLIE_2Mbps = 1,
CFLIE_1Mbps = 2,
CFLIE_250kbps = 3,

View File

@ -230,9 +230,9 @@
#define ESKY150_NRF24L01_INO
#define FQ777_NRF24L01_INO
#define FX_NRF24L01_INO
#define FY326_NRF24L01_INO
#define GW008_NRF24L01_INO
#define HISKY_NRF24L01_INO
//#define FY326_NRF24L01_INO
//#define GW008_NRF24L01_INO
//#define HISKY_NRF24L01_INO
#define HONTAI_NRF24L01_INO
#define H8_3D_NRF24L01_INO
#define JJRC345_NRF24L01_INO
@ -576,7 +576,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
CABELL_SET_FAIL_SAFE
CABELL_UNBIND
PROTO_CFLIE
CFLIE_AUTO
CFLIE_DEFAULT
CFLIE_2Mbps
CFLIE_1Mbps
CFLIE_250kbps