diff --git a/Multiprotocol/CX10_nrf24l01.ino b/Multiprotocol/CX10_nrf24l01.ino index de6cabc..f55204e 100644 --- a/Multiprotocol/CX10_nrf24l01.ino +++ b/Multiprotocol/CX10_nrf24l01.ino @@ -57,7 +57,7 @@ static void __attribute__((unused)) CX10_Write_Packet() if(sub_protocol == CX10_BLUE) offset = 4; -if (false) { +#if 0 packet[0] = IS_BIND_IN_PROGRESS ? 0xAA : 0x55; packet[1] = rx_tx_addr[0]; @@ -65,16 +65,14 @@ if (false) { packet[3] = rx_tx_addr[2]; packet[4] = rx_tx_addr[3]; -} else { +#endif packet[0] = IS_BIND_IN_PROGRESS ? 0xC5 : 0x85; packet[1] = IS_BIND_IN_PROGRESS ? 0x11 : packet_count++; - packet[2] = rx_tx_addr[0]; - packet[3] = rx_tx_addr[1]; + packet[2] = rx_tx_addr[2]; + packet[3] = rx_tx_addr[3]; -} - -/* +#if 0 // packet[5] to [8] (aircraft id) is filled during bind for blue board uint16_t aileron= convert_channel_16b_limit(AILERON ,1000,2000); @@ -82,7 +80,7 @@ if (false) { uint16_t throttle=convert_channel_16b_limit(THROTTLE,1000,2000); uint16_t rudder= convert_channel_16b_limit(RUDDER ,2000,1000); -*/ +#endif uint8_t aileron = convert_channel_8b(AILERON); uint8_t elevator = convert_channel_8b(ELEVATOR); @@ -102,7 +100,7 @@ if (false) { flags = 0x01; // rate 2 -if (false) { +#if 0 uint8_t flags2=0; // packet 14 @@ -183,7 +181,7 @@ if (false) { packet[13+offset]=flags; packet[14+offset]=flags2; -} else { +#endif packet[4] = throttle; packet[5] = rudder; @@ -205,8 +203,6 @@ if (false) { packet[11] = 0x55; } -} - // Send if(IS_BIND_DONE) { @@ -222,7 +218,7 @@ static void __attribute__((unused)) CX10_RF_init() { XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M); // XN297_SetTXAddr((uint8_t *)"\xcc\xcc\xcc\xcc\xcc", 5); - XN297_SetTXAddr((uint8_t *)"\xc7\x95\x3c\xbb\xa5", 5); + XN297_SetTXAddr((uint8_t *)"\xC7\x95\x3C\xBB\xA5", 5); XN297_SetRXAddr((uint8_t *)"\xcc\xcc\xcc\xcc\xcc", packet_length); // XN297_RFChannel(CX10_RF_BIND_CHANNEL); XN297_RFChannel(CX10N_RF_BIND_CHANNEL); @@ -293,17 +289,17 @@ static void __attribute__((unused)) CX10_initialize_txid() else { -if (false) { +#if 0 hopping_frequency[0] = 0x03 + (rx_tx_addr[0] & 0x0F); hopping_frequency[1] = 0x16 + (rx_tx_addr[0] >> 4); hopping_frequency[2] = 0x2D + (rx_tx_addr[1] & 0x0F); hopping_frequency[3] = 0x40 + (rx_tx_addr[1] >> 4); -} else { +#endif - rx_tx_addr[0] = 0x4C; - rx_tx_addr[1] = 0xD7; + rx_tx_addr[2] = 0x4C; + rx_tx_addr[3] = 0xD7; hopping_frequency[0] = 55; hopping_frequency[1] = 66; @@ -311,17 +307,14 @@ if (false) { hopping_frequency[3] = 60; /* - rx_tx_addr[0] = 0x50; - rx_tx_addr[1] = 0xE1; + rx_tx_addr[2] = 0x50; + rx_tx_addr[3] = 0xE1; hopping_frequency[0] = 59; hopping_frequency[1] = 75; hopping_frequency[2] = 70; hopping_frequency[3] = 65; */ - -} - } } @@ -329,7 +322,7 @@ void CX10_init(void) { BIND_IN_PROGRESS; // autobind protocol -if (false) { +#if 0 if(protocol == PROTO_Q2X2) sub_protocol|=0x08; // Increase the number of sub_protocols for CX-10 @@ -356,7 +349,7 @@ if (false) { bind_counter = CX10_BIND_COUNT; } -} else { +#endif packet_length = CX10N_PACKET_SIZE; packet_period = CX10N_PACKET_PERIOD; @@ -366,8 +359,6 @@ if (false) { packet[9] = 0x00; -} - CX10_initialize_txid(); CX10_RF_init(); }