@@ -233,25 +233,25 @@ static void send_search_packet()
233
233
NRF24L01_WriteReg (NRF24L01_07_STATUS, (BV (NRF24L01_07_TX_DS) | BV (NRF24L01_07_MAX_RT)));
234
234
NRF24L01_FlushTx ();
235
235
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
+ // }
255
255
set_rate_channel (data_rate, rf_ch_num);
256
256
257
257
NRF24L01_WritePayload (buf, sizeof (buf));
@@ -789,25 +789,31 @@ static uint8_t CFLIE_initialize_rx_tx_addr()
789
789
rx_tx_addr[0 ] =
790
790
rx_tx_addr[1 ] =
791
791
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
+
795
797
switch (sub_protocol) {
796
798
case CFLIE_2Mbps:
797
799
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>
799
802
break ;
800
803
case CFLIE_1Mbps:
801
804
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>
803
807
break ;
804
808
case CFLIE_250kbps:
805
809
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>
807
812
break ;
808
813
default :
809
814
data_rate = NRF24L01_BR_2M;
810
815
rf_ch_num = 80 ;
816
+ rx_tx_addr[4 ] = 0xE7 ; // CFlie uses fixed address
811
817
}
812
818
813
819
return CFLIE_INIT_SEARCH;
0 commit comments