Skip to content

Commit

Permalink
Merge branch 'pascallanger:master' into lemon-rx-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiearzu authored Feb 15, 2024
2 parents 417187b + 53d5684 commit 9d3fa11
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 66 deletions.
8 changes: 5 additions & 3 deletions Lua_scripts/MultiChan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@
49,0,KF606,KF606,1,Trim
49,1,KF606,MIG320,1,Trim,LED
49,2,KF606,ZCZ50,1,Trim,UNK
9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim
9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim
73,0,Kyosho,Std,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim,Rtrim,Hover
9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim,Rtrim,Hover
73,0,Kyosho,FHSS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
73,1,Kyosho,Hype,0,CH5,CH6
18,0,MJXQ,WHL08,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
18,1,MJXQ,X600,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
18,2,MJXQ,X800,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
Expand Down Expand Up @@ -211,3 +212,4 @@
94,0,Scorpio
95,0,Bluefly,HP100,0,CH5,CH6,CH7,CH8
96,0,BumbleB
97,0,SGF22,Std,1,Mode,Flip,LED,Pict
8 changes: 4 additions & 4 deletions Multiprotocol/A7105_SPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ void A7105_Init(void)
#ifdef KYOSHO_A7105_INO
if(protocol==PROTO_KYOSHO)
{
if(sub_protocol==KYOSHO_FHSS)
A7105_Regs=(uint8_t*)KYOSHO_A7105_regs;
else
if(sub_protocol==KYOSHO_HYPE)
A7105_Regs=(uint8_t*)KYOSHO_HYPE_A7105_regs;
else //FHSS && SYNCRO
A7105_Regs=(uint8_t*)KYOSHO_A7105_regs;
}
#endif
}
Expand All @@ -446,7 +446,7 @@ void A7105_Init(void)
}
A7105_Strobe(A7105_STANDBY);

if(protocol==PROTO_KYOSHO && sub_protocol==KYOSHO_FHSS)
if(protocol==PROTO_KYOSHO && sub_protocol!=KYOSHO_HYPE)
{//strange calibration...
//IF Filter Bank Calibration
A7105_WriteReg(A7105_02_CALC,0x0F);
Expand Down
12 changes: 10 additions & 2 deletions Multiprotocol/CYRF6936_SPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void CYRF_FindBestChannels(uint8_t *channels, uint8_t len, uint8_t minspace, uin
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX
}

#if defined(DEVO_CYRF6936_INO) || defined(J6PRO_CYRF6936_INO)
#if defined(DEVO_CYRF6936_INO) || defined(J6PRO_CYRF6936_INO) || defined(TRAXXAS_CYRF6936_INO)
const uint8_t PROGMEM DEVO_j6pro_sopcodes[][8] = {
/* Note these are in order transmitted (LSB 1st) */
{0x3C, 0x37, 0xCC, 0x91, 0xE2, 0xF8, 0xCC, 0x91},
Expand All @@ -311,7 +311,7 @@ const uint8_t PROGMEM DEVO_j6pro_sopcodes[][8] = {
{0xB9, 0x8E, 0x19, 0x74, 0x6F, 0x65, 0x18, 0x74},
{0xDF, 0xB1, 0xC0, 0x49, 0x62, 0xDF, 0xC1, 0x49},
{0x97, 0xE5, 0x14, 0x72, 0x7F, 0x1A, 0x14, 0x72},
#if defined(J6PRO_CYRF6936_INO)
#if defined(J6PRO_CYRF6936_INO) || defined(TRAXXAS_CYRF6936_INO)
{0x82, 0xC7, 0x90, 0x36, 0x21, 0x03, 0xFF, 0x17},
{0xE2, 0xF8, 0xCC, 0x91, 0x3C, 0x37, 0xCC, 0x91}, //Note: the '03' was '9E' in the Cypress recommended table
{0xAD, 0x39, 0xA2, 0x0F, 0x9B, 0xC5, 0xA1, 0x0F}, //The following are the same as the 1st 8 above,
Expand All @@ -322,14 +322,22 @@ const uint8_t PROGMEM DEVO_j6pro_sopcodes[][8] = {
{0x9E, 0x82, 0xDC, 0x3C, 0xA1, 0x78, 0xDC, 0x3C},
{0x6F, 0x65, 0x18, 0x74, 0xB9, 0x8E, 0x19, 0x74},
#endif
#if defined(TRAXXAS_CYRF6936_INO)
{0x62, 0xDF, 0xC1, 0x49, 0xDF, 0xB1, 0xC0, 0x49},
#endif
};
#endif

static void __attribute__((unused)) CYRF_PROGMEM_ConfigSOPCode(const uint8_t *data)
{
uint8_t code[8];
//debug("SOP:");
for(uint8_t i=0;i<8;i++)
{
code[i]=pgm_read_byte_near(&data[i]);
//debug(" %02X",code[i]);
}
//debugln("");
CYRF_ConfigSOPCode(code);
}

Expand Down
22 changes: 8 additions & 14 deletions Multiprotocol/KN_nrf24l01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum {
KN_FLAG_DR = 0x01, // Dual Rate: 1 - full range
KN_FLAG_TH = 0x02, // Throttle Hold: 1 - hold
KN_FLAG_IDLEUP = 0x04, // Idle up: 1 - 3D
KN_FLAG_RES1 = 0x08,
KN_FLAG_RES1 = 0x08, // HoverDebugging
KN_FLAG_RES2 = 0x10,
KN_FLAG_RES3 = 0x20,
KN_FLAG_GYRO3 = 0x40, // 0 - 6G mode, 1 - 3G mode
Expand Down Expand Up @@ -141,19 +141,13 @@ static void __attribute__((unused)) kn_update_packet_control_data()
packet[8] = convert_channel_16b_limit(CH9,0,200); // 0x64; // T
packet[9] = convert_channel_16b_limit(CH10,0,200); // 0x64; // A
packet[10] = convert_channel_16b_limit(CH11,0,200); // 0x64; // E
packet[11] = 0x64; // R

flags=0;
if (CH5_SW)
flags = KN_FLAG_DR;
if (CH6_SW)
flags |= KN_FLAG_TH;
if (CH7_SW)
flags |= KN_FLAG_IDLEUP;
if (CH8_SW)
flags |= KN_FLAG_GYRO3;

packet[12] = flags;
packet[11] = convert_channel_16b_limit(CH12,0,200); // 0x64; // R

packet[12] = GET_FLAG(CH5_SW, KN_FLAG_DR)
|GET_FLAG(CH6_SW, KN_FLAG_TH)
|GET_FLAG(CH7_SW, KN_FLAG_IDLEUP)
|GET_FLAG(CH8_SW, KN_FLAG_GYRO3)
|GET_FLAG(CH13_SW, KN_FLAG_RES1); //Hover debugging

packet[13] = 0x00;
if(sub_protocol==WLTOYS)
Expand Down
43 changes: 31 additions & 12 deletions Multiprotocol/Kyosho_a7105.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

//#define KYOSHO_FORCE_ID_FHSS
//#define KYOSHO_FORCE_ID_HYPE
//#define KYOSHO_FORCE_ID_SYNCRO

//Kyosho constants & variables
#define KYOSHO_BIND_COUNT 2500
Expand All @@ -32,7 +33,7 @@ static void __attribute__((unused)) KYOSHO_send_packet()
packet[4] = rx_tx_addr[3];
//unknown may be RX ID on some other remotes
memset(packet+5,0xFF,4);

if(IS_BIND_IN_PROGRESS)
{
packet[ 0] = 0xBC; // bind indicator
Expand All @@ -42,8 +43,9 @@ static void __attribute__((unused)) KYOSHO_send_packet()
//RF table
for(uint8_t i=0; i<16;i++)
packet[i+11]=hopping_frequency[i+(packet[9]<<4)];
//unknwon
packet[27] = 0x05;
//TX type
packet[27] = (bind_counter & 0x40) ? 0x05:0x07; // FHSS is 5 and Syncro is 7
//Unknown
packet[28] = 0x00;
memset(packet+29,0xFF,8);
//frequency hop during bind
Expand All @@ -55,13 +57,23 @@ static void __attribute__((unused)) KYOSHO_send_packet()
else
{
packet[ 0] = 0x58; // normal packet
//14 channels: steering, throttle, ...
for(uint8_t i = 0; i < 14; i++)
//FHSS 14 channels: steering, throttle, ...
//Syncro 6 channels: steering, throttle, ...
for(uint8_t i = 0; i < 14; i++) //needed? i < (sub_protocol==KYOSHO_FHSS?14:6); i++)
{
uint16_t temp=convert_channel_ppm(i);
packet[9 + i*2]=temp&0xFF; // low byte of servo timing(1000-2000us)
packet[10 + i*2]=(temp>>8)&0xFF; // high byte of servo timing(1000-2000us)
uint16_t temp = convert_channel_ppm(i);
packet[ 9 + i*2] = temp&0xFF; // low byte of servo timing(1000-2000us)
packet[10 + i*2] = (temp>>8)&0xFF; // high byte of servo timing(1000-2000us)
}
// if(sub_protocol==KYOSHO_SYNCRO) // needed?
// {
// memcpy(&packet[21],&hopping_frequency[11],6);
// packet[27] = 0x07;
// packet[28] = 0x00;
// memset(packet+29,0xFF,8);
// packet[34] = 0x0F;
// packet[36] = 0x0F;
// }
rf_ch_num=hopping_frequency[hopping_frequency_no];
hopping_frequency_no++;
packet[34] |= (hopping_frequency_no&0x0F)<<4;
Expand Down Expand Up @@ -150,10 +162,10 @@ uint16_t KYOSHO_callback()
telemetry_set_input_sync(packet_period);
#endif
}
if(sub_protocol==KYOSHO_FHSS)
KYOSHO_send_packet();
else//HYPE
if(sub_protocol==KYOSHO_HYPE)
KYOSHO_hype_send_packet();
else //FHSS && SYNCRO
KYOSHO_send_packet();
return packet_period;
}

Expand All @@ -162,7 +174,7 @@ void KYOSHO_init()
A7105_Init();

// compute channels from ID
calc_fh_channels(sub_protocol==KYOSHO_FHSS?32:15);
calc_fh_channels(sub_protocol==KYOSHO_HYPE?15:32);
hopping_frequency_no=0;

#ifdef KYOSHO_FORCE_ID_FHSS
Expand All @@ -172,6 +184,13 @@ void KYOSHO_init()
memcpy(hopping_frequency,"\x29\x4C\x67\x92\x31\x1C\x77\x18\x23\x6E\x81\x5C\x8F\x5A\x51\x94\x7A\x12\x45\x6C\x7F\x1E\x0D\x88\x63\x8C\x4F\x37\x26\x61\x2C\x8A",32);
}
#endif
#ifdef KYOSHO_FORCE_ID_SYNCRO
if(sub_protocol==KYOSHO_FHSS)
{
memcpy(rx_tx_addr,"\x00\xC2\x24\x00",4);
memcpy(hopping_frequency,"\x73\x12\x7D\x88\x63\x4A\x8D\x60\x57\x16\x5D\x8B\x25\x53\x6E\x3C\x41\x70\x20\x83\x2A\x19\x94\x2F\x91\x4C\x47\x36\x78\x10\x5A\x31",32);
}
#endif
if(sub_protocol==KYOSHO_HYPE)
{
MProtocol_id &= 0x00FF00FF;
Expand Down
1 change: 1 addition & 0 deletions Multiprotocol/Multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@
94,Scorpio
95,BlueFly
96,BumbleB
97,SGF22
4 changes: 4 additions & 0 deletions Multiprotocol/Multi_Protos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const char STR_XERALL[] ="Xerall";
const char STR_SCORPIO[] ="Scorpio";
const char STR_BLUEFLY[] ="BlueFly";
const char STR_BUMBLEB[] ="BumbleB";
const char STR_SGF22[] ="SGF22";

const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
Expand Down Expand Up @@ -444,6 +445,9 @@ const mm_protocol_definition multi_protocols[] = {
#if defined(SCORPIO_CYRF6936_INO)
{PROTO_SCORPIO, STR_SCORPIO, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_CYRF, SCORPIO_init, SCORPIO_callback },
#endif
#if defined(SGF22_NRF24L01_INO)
{PROTO_SGF22, STR_SGF22, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, SGF22_init, SGF22_callback },
#endif
#if defined(SHENQI_NRF24L01_INO)
{PROTO_SHENQI, STR_SHENQI, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, SHENQI_init, SHENQI_callback },
#endif
Expand Down
7 changes: 4 additions & 3 deletions Multiprotocol/Multiprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 3
#define VERSION_PATCH_LEVEL 43
#define VERSION_PATCH_LEVEL 48

#define MODE_SERIAL 0

Expand Down Expand Up @@ -124,6 +124,7 @@ enum PROTOCOLS
PROTO_SCORPIO = 94, // =>CYRF6936
PROTO_BLUEFLY = 95, // =>CC2500 & NRF24L01
PROTO_BUMBLEB = 96, // =>CC2500 & NRF24L01
PROTO_SGF22 = 97, // =>NRF24L01


PROTO_NANORF = 126, // =>NRF24L01
Expand Down Expand Up @@ -833,8 +834,8 @@ enum {
#define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882
#define MOULDKG_EEPROM_OFFSET 882 // RX ID, 3 bytes per model, end is 882+64*3=1074
#define DSM_CLONE_EEPROM_OFFSET 1074 // (4) TX ID, (1) Initialized, end is 1079
#define TRAXXAS_EEPROM_OFFSET 1079 // RX ID, 2 bytes per model id, end is 1079+128=1207
//#define CONFIG_EEPROM_OFFSET 1207 // Current configuration of the multimodule
#define TRAXXAS_EEPROM_OFFSET 1079 // RX ID and SOP index, 3 bytes per model id, end is 1079+192=1271
//#define CONFIG_EEPROM_OFFSET 1271 // Current configuration of the multimodule

/* STM32 Flash Size */
#ifndef DISABLE_FLASH_SIZE_CHECK
Expand Down
Loading

0 comments on commit 9d3fa11

Please sign in to comment.