From 08dc0db2e217d03aacff9518cffb1c2d461baf76 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Mon, 1 Feb 2016 11:41:36 +0100 Subject: [PATCH] Preparation for new protocol MT99XX (includes H7) --- Multiprotocol/Multiprotocol.ino | 44 ++++++++++++++++++-------------- Multiprotocol/_Config.h | 5 ++++ Multiprotocol/multiprotocol.h | 45 +++++++++++++++++++++------------ 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 5b927bf..44a4bcf 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -33,12 +33,12 @@ uint32_t MProtocol_id;//tx id, uint32_t MProtocol_id_master; uint32_t Model_fixed_id=0; uint32_t fixed_id; -uint8_t cyrfmfg_id[6];//for dsm2 and devo +uint8_t cyrfmfg_id[6];//for dsm2 and devo uint32_t blink=0; // uint16_t counter; -uint8_t channel; -uint8_t packet[40]; +uint8_t channel; +uint8_t packet[40]; #define NUM_CHN 16 // Servo data @@ -48,26 +48,26 @@ uint8_t Servo_AUX; volatile uint16_t PPM_data[NUM_CHN]; // NRF variables -uint8_t rx_tx_addr[5]; -uint8_t phase; +uint8_t rx_tx_addr[5]; +uint8_t phase; uint16_t bind_counter; -uint8_t bind_phase; -uint8_t binding_idx; +uint8_t bind_phase; +uint8_t binding_idx; uint32_t packet_counter; uint16_t packet_period; -uint8_t packet_count; -uint8_t packet_sent; -uint8_t packet_length; -uint8_t hopping_frequency[23]; -uint8_t *hopping_frequency_ptr; -uint8_t hopping_frequency_no=0; -uint8_t rf_ch_num; -uint8_t throttle, rudder, elevator, aileron; -uint8_t flags; +uint8_t packet_count; +uint8_t packet_sent; +uint8_t packet_length; +uint8_t hopping_frequency[23]; +uint8_t *hopping_frequency_ptr; +uint8_t hopping_frequency_no=0; +uint8_t rf_ch_num; +uint8_t throttle, rudder, elevator, aileron; +uint8_t flags; // uint32_t state; -uint8_t len; -uint8_t RX_num; +uint8_t len; +uint8_t RX_num; // Mode_select variables uint8_t mode_select; @@ -414,6 +414,12 @@ static void protocol_init() next_callback=initESKY(); remote_callback = ESKY_callback; break; +#endif +#if defined(MT99XX_NRF24L01_INO) + case MODE_MT99XX: + next_callback=initMT99XX(); + remote_callback = MT99XX_callback; + break; #endif } @@ -496,7 +502,7 @@ static void module_reset() case MODE_DEVO: CYRF_Reset(); break; - default: // MODE_HISKY, MODE_V2X2, MODE_YD717, MODE_KN, MODE_SYMAX, MODE_SLT, MODE_CX10, MODE_CG023, MODE_BAYANG, MODE_ESKY + default: // MODE_HISKY, MODE_V2X2, MODE_YD717, MODE_KN, MODE_SYMAX, MODE_SLT, MODE_CX10, MODE_CG023, MODE_BAYANG, MODE_ESKY, MODE_MT99XX NRF24L01_Reset(); break; } diff --git a/Multiprotocol/_Config.h b/Multiprotocol/_Config.h index 9a8a8d2..44d44d6 100644 --- a/Multiprotocol/_Config.h +++ b/Multiprotocol/_Config.h @@ -42,6 +42,7 @@ #define V2X2_NRF24L01_INO #define YD717_NRF24L01_INO //#define FRSKYX_CC2500_INO +//#define MT99XX_NRF24L01_INO //Update this table to set which protocol and all associated settings are called for the corresponding dial number static const PPM_Parameters PPM_prot[15]= @@ -116,6 +117,10 @@ static const PPM_Parameters PPM_prot[15]= NONE MODE_ESKY NONE + MODE_MT99XX + MT99 + H7 + YZ RX_Num value between 0 and 15 diff --git a/Multiprotocol/multiprotocol.h b/Multiprotocol/multiprotocol.h index 717ada0..f3fa019 100644 --- a/Multiprotocol/multiprotocol.h +++ b/Multiprotocol/multiprotocol.h @@ -27,23 +27,25 @@ enum PROTOCOLS { MODE_SERIAL = 0, // Serial commands - MODE_FLYSKY = 1, // =>A7105 / FLYSKY protocol - MODE_HUBSAN = 2, // =>A7105 / HUBSAN protocol - MODE_FRSKY = 3, // =>CC2500 / FRSKY protocol - MODE_HISKY = 4, // =>NRF24L01 / HISKY protocol - MODE_V2X2 = 5, // =>NRF24L01 / V2x2 protocol - MODE_DSM2 = 6, // =>CYRF6936 / DSM2 protocol - MODE_DEVO =7, // =>CYRF6936 / DEVO protocol - MODE_YD717 = 8, // =>NRF24L01 / YD717 protocol (CX10 red pcb) - MODE_KN = 9, // =>NRF24L01 / KN protocol - MODE_SYMAX = 10, // =>NRF24L01 / SYMAX protocol - MODE_SLT = 11, // =>NRF24L01 / SLT protocol - MODE_CX10 = 12, // =>NRF24L01 / CX-10 protocol - MODE_CG023 = 13, // =>NRF24L01 / CG023 protocol - MODE_BAYANG = 14, // =>NRF24L01 / BAYANG protocol - MODE_FRSKYX = 15, // =>CC2500 / FRSKYX protocol - MODE_ESKY = 16, // =>NRF24L01 / ESKY protocol + MODE_FLYSKY = 1, // =>A7105 + MODE_HUBSAN = 2, // =>A7105 + MODE_FRSKY = 3, // =>CC2500 + MODE_HISKY = 4, // =>NRF24L01 + MODE_V2X2 = 5, // =>NRF24L01 + MODE_DSM2 = 6, // =>CYRF6936 + MODE_DEVO =7, // =>CYRF6936 + MODE_YD717 = 8, // =>NRF24L01 + MODE_KN = 9, // =>NRF24L01 + MODE_SYMAX = 10, // =>NRF24L01 + MODE_SLT = 11, // =>NRF24L01 + MODE_CX10 = 12, // =>NRF24L01 + MODE_CG023 = 13, // =>NRF24L01 + MODE_BAYANG = 14, // =>NRF24L01 + MODE_FRSKYX = 15, // =>CC2500 + MODE_ESKY = 16, // =>NRF24L01 + MODE_MT99XX=17, // =>NRF24L01 }; + enum Flysky { Flysky=0, @@ -95,6 +97,12 @@ enum CG023 YD829 = 1, H8_3D = 2 }; +enum MT99XX +{ + MT99 = 0, + H7 = 1, + YZ = 2 +}; #define NONE 0 #define P_HIGH 1 @@ -400,6 +408,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- Bayang 14 FrskyX 15 ESky 16 + MT99XX 17 BindBit=> 0x80 1=Bind/0=No AutoBindBit=> 0x40 1=Yes /0=No RangeCheck=> 0x20 1=Yes /0=No @@ -442,6 +451,10 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p -- CG023 0 YD829 1 H8_3D 2 + sub_protocol==MT99XX + MT99 0 + H7 1 + YZ 2 Power value => 0x80 0=High/1=Low Stream[3] = option_protocol; option_protocol value is -127..127