mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-07-02 19:37:52 +00:00
Enable custom address and radio channel
This commit is contained in:
parent
3433dd2c50
commit
7e671b98dc
@ -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_WriteReg(NRF24L01_07_STATUS, (BV(NRF24L01_07_TX_DS) | BV(NRF24L01_07_MAX_RT)));
|
||||||
NRF24L01_FlushTx();
|
NRF24L01_FlushTx();
|
||||||
|
|
||||||
if (sub_protocol == CFLIE_AUTO)
|
// if (sub_protocol == CFLIE_AUTO)
|
||||||
{
|
// {
|
||||||
if (rf_ch_num++ > 125)
|
// if (rf_ch_num++ > 125)
|
||||||
{
|
// {
|
||||||
rf_ch_num = 0;
|
// rf_ch_num = 0;
|
||||||
switch(data_rate)
|
// switch(data_rate)
|
||||||
{
|
// {
|
||||||
case NRF24L01_BR_250K:
|
// case NRF24L01_BR_250K:
|
||||||
data_rate = NRF24L01_BR_1M;
|
// data_rate = NRF24L01_BR_1M;
|
||||||
break;
|
// break;
|
||||||
case NRF24L01_BR_1M:
|
// case NRF24L01_BR_1M:
|
||||||
data_rate = NRF24L01_BR_2M;
|
// data_rate = NRF24L01_BR_2M;
|
||||||
break;
|
// break;
|
||||||
case NRF24L01_BR_2M:
|
// case NRF24L01_BR_2M:
|
||||||
data_rate = NRF24L01_BR_250K;
|
// data_rate = NRF24L01_BR_250K;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
set_rate_channel(data_rate, rf_ch_num);
|
set_rate_channel(data_rate, rf_ch_num);
|
||||||
|
|
||||||
NRF24L01_WritePayload(buf, sizeof(buf));
|
NRF24L01_WritePayload(buf, sizeof(buf));
|
||||||
@ -789,25 +789,31 @@ static uint8_t CFLIE_initialize_rx_tx_addr()
|
|||||||
rx_tx_addr[0] =
|
rx_tx_addr[0] =
|
||||||
rx_tx_addr[1] =
|
rx_tx_addr[1] =
|
||||||
rx_tx_addr[2] =
|
rx_tx_addr[2] =
|
||||||
rx_tx_addr[3] =
|
rx_tx_addr[3] = 0xE7;
|
||||||
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
|
|
||||||
|
unsigned x10 = (RX_num / 10U) % 10;
|
||||||
|
unsigned x1 = RX_num - x10*10;
|
||||||
|
|
||||||
switch (sub_protocol) {
|
switch (sub_protocol) {
|
||||||
case CFLIE_2Mbps:
|
case CFLIE_2Mbps:
|
||||||
data_rate = NRF24L01_BR_2M;
|
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;
|
break;
|
||||||
case CFLIE_1Mbps:
|
case CFLIE_1Mbps:
|
||||||
data_rate = NRF24L01_BR_1M;
|
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;
|
break;
|
||||||
case CFLIE_250kbps:
|
case CFLIE_250kbps:
|
||||||
data_rate = NRF24L01_BR_250K;
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
data_rate = NRF24L01_BR_2M;
|
data_rate = NRF24L01_BR_2M;
|
||||||
rf_ch_num = 80;
|
rf_ch_num = 80;
|
||||||
|
rx_tx_addr[4] = 0xE7; // CFlie uses fixed address
|
||||||
}
|
}
|
||||||
|
|
||||||
return CFLIE_INIT_SEARCH;
|
return CFLIE_INIT_SEARCH;
|
||||||
|
@ -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_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0";
|
||||||
const char STR_SUBTYPE_E129[] = "\x04""E129""C186";
|
const char STR_SUBTYPE_E129[] = "\x04""E129""C186";
|
||||||
const char STR_SUBTYPE_FX[] = "\x04""816\0""620\0""9630";
|
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
|
#define NO_SUBTYPE nullptr
|
||||||
|
|
||||||
#ifdef SEND_CPPM
|
#ifdef SEND_CPPM
|
||||||
|
@ -465,7 +465,7 @@ enum FX
|
|||||||
};
|
};
|
||||||
enum CFLIE
|
enum CFLIE
|
||||||
{
|
{
|
||||||
CFLIE_AUTO = 0,
|
CFLIE_DEFAULT = 0,
|
||||||
CFLIE_2Mbps = 1,
|
CFLIE_2Mbps = 1,
|
||||||
CFLIE_1Mbps = 2,
|
CFLIE_1Mbps = 2,
|
||||||
CFLIE_250kbps = 3,
|
CFLIE_250kbps = 3,
|
||||||
|
@ -230,9 +230,9 @@
|
|||||||
#define ESKY150_NRF24L01_INO
|
#define ESKY150_NRF24L01_INO
|
||||||
#define FQ777_NRF24L01_INO
|
#define FQ777_NRF24L01_INO
|
||||||
#define FX_NRF24L01_INO
|
#define FX_NRF24L01_INO
|
||||||
#define FY326_NRF24L01_INO
|
//#define FY326_NRF24L01_INO
|
||||||
#define GW008_NRF24L01_INO
|
//#define GW008_NRF24L01_INO
|
||||||
#define HISKY_NRF24L01_INO
|
//#define HISKY_NRF24L01_INO
|
||||||
#define HONTAI_NRF24L01_INO
|
#define HONTAI_NRF24L01_INO
|
||||||
#define H8_3D_NRF24L01_INO
|
#define H8_3D_NRF24L01_INO
|
||||||
#define JJRC345_NRF24L01_INO
|
#define JJRC345_NRF24L01_INO
|
||||||
@ -576,7 +576,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
CABELL_SET_FAIL_SAFE
|
CABELL_SET_FAIL_SAFE
|
||||||
CABELL_UNBIND
|
CABELL_UNBIND
|
||||||
PROTO_CFLIE
|
PROTO_CFLIE
|
||||||
CFLIE_AUTO
|
CFLIE_DEFAULT
|
||||||
CFLIE_2Mbps
|
CFLIE_2Mbps
|
||||||
CFLIE_1Mbps
|
CFLIE_1Mbps
|
||||||
CFLIE_250kbps
|
CFLIE_250kbps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user