Pelikan/SCX24: new sub protocol

This commit is contained in:
Pascal Langer 2021-04-16 14:50:53 +02:00
parent 9e0684b6cb
commit 39410c290b
9 changed files with 173 additions and 68 deletions

View File

@ -134,6 +134,7 @@
77,0,OMP,M2,0,THold,IdleUp,6G_3D 77,0,OMP,M2,0,THold,IdleUp,6G_3D
60,0,Pelikan,PRO_V4,0,CH5,CH6,CH7,CH8 60,0,Pelikan,PRO_V4,0,CH5,CH6,CH7,CH8
60,1,Pelikan,LITE_V4,0,CH5,CH6,CH7,CH8 60,1,Pelikan,LITE_V4,0,CH5,CH6,CH7,CH8
60,2,Pelikan,SCX24,0
51,0,Potensic,A20,1,TakLan,Emerg,Mode,HLess 51,0,Potensic,A20,1,TakLan,Emerg,Mode,HLess
66,0,Propel,74-Z,1,LEDs,RollCW,RolCCW,Fire,Weapon,Calib,AltHol,TakeOf,Land,Train 66,0,Propel,74-Z,1,LEDs,RollCW,RolCCW,Fire,Weapon,Calib,AltHol,TakeOf,Land,Train
29,0,Q2x2,Q222,1,Flip,LED,Mod2,Mod1,HLess,RTH,XCal,YCal 29,0,Q2x2,Q222,1,Flip,LED,Mod2,Mod1,HLess,RTH,XCal,YCal

View File

@ -280,12 +280,16 @@ local function Multi_Init()
end end
--Exceptions on first 4 channels... --Exceptions on first 4 channels...
if ( protocol == 73 or (protocol == 74 and sub_protocol == 0) ) then -- Kyosho or RadioLink Surface if ( protocol == 73 or (protocol == 74 and sub_protocol == 0) or (protocol == 60 and sub_protocol == 2) ) then -- Kyosho or RadioLink Surface or Pelikan/SCX24
channel_names[1] = "ST" channel_names[1] = "ST"
channel_names[2] = "THR" channel_names[2] = "THR"
channel_names[3] = "CH3" channel_names[3] = "CH3"
if(protocol == 60 and sub_protocol == 2) then
channel_names[4] = "n-a"
else
channel_names[4] = "CH4" channel_names[4] = "CH4"
end end
end
if ( protocol == 6 and sub_protocol == 5 ) then -- DSMR if ( protocol == 6 and sub_protocol == 5 ) then -- DSMR
channel_names[1] = "ST" channel_names[1] = "ST"
channel_names[2] = "THR" channel_names[2] = "THR"

View File

@ -499,6 +499,11 @@ void A7105_Init(void)
vco_calibration1=0x02; vco_calibration1=0x02;
break; break;
case PROTO_PELIKAN: case PROTO_PELIKAN:
if(sub_protocol == PELIKAN_SCX24)
{
vco_calibration1=0x0A;
break;
}
case PROTO_KYOSHO: //sub_protocol Hype case PROTO_KYOSHO: //sub_protocol Hype
vco_calibration1=0x0C; vco_calibration1=0x0C;
break; break;

View File

@ -57,7 +57,7 @@
57,HoTT,Sync,No_Sync 57,HoTT,Sync,No_Sync
58,FX816,P38 58,FX816,P38
59,Bayang_RX,Multi,CPPM 59,Bayang_RX,Multi,CPPM
60,Pelikan,Pro,Lite 60,Pelikan,Pro,Lite,SCX24
61,Tiger 61,Tiger
62,XK,X450,X420 62,XK,X450,X420
63,XN_DUMP,250K,1M,2M,AUTO 63,XN_DUMP,250K,1M,2M,AUTO

View File

@ -148,7 +148,7 @@ const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch";
const char STR_SUBTYPE_WFLY[] = "\x05""WFR0x"; const char STR_SUBTYPE_WFLY[] = "\x05""WFR0x";
const char STR_SUBTYPE_WFLY2[] = "\x05""RF20x"; const char STR_SUBTYPE_WFLY2[] = "\x05""RF20x";
const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync"; const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync";
const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite"; const char STR_SUBTYPE_PELIKAN[] = "\x05""Pro\0 ""Lite\0""SCX24";
const char STR_SUBTYPE_V761[] = "\x03""3ch""4ch"; const char STR_SUBTYPE_V761[] = "\x03""3ch""4ch";
const char STR_SUBTYPE_RLINK[] = "\x07""Surface""Air\0 ""DumboRC"; const char STR_SUBTYPE_RLINK[] = "\x07""Surface""Air\0 ""DumboRC";
const char STR_SUBTYPE_REALACC[] = "\x03""R11"; const char STR_SUBTYPE_REALACC[] = "\x03""R11";
@ -367,7 +367,7 @@ const mm_protocol_definition multi_protocols[] = {
{PROTO_OMP, STR_OMP, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, OMP_init, OMP_callback }, {PROTO_OMP, STR_OMP, NO_SUBTYPE, 0, OPTION_NONE, 0, 0, SW_NRF, OMP_init, OMP_callback },
#endif #endif
#if defined(PELIKAN_A7105_INO) #if defined(PELIKAN_A7105_INO)
{PROTO_PELIKAN, STR_PELIKAN, STR_SUBTYPE_PELIKAN, 2, OPTION_NONE, 0, 1, SW_A7105, PELIKAN_init, PELIKAN_callback }, {PROTO_PELIKAN, STR_PELIKAN, STR_SUBTYPE_PELIKAN, 3, OPTION_NONE, 0, 1, SW_A7105, PELIKAN_init, PELIKAN_callback },
#endif #endif
#if defined(POTENSIC_NRF24L01_INO) #if defined(POTENSIC_NRF24L01_INO)
{PROTO_POTENSIC, STR_POTENSIC, STR_SUBTYPE_POTENSIC, 1, OPTION_NONE, 0, 0, SW_NRF, POTENSIC_init, POTENSIC_callback }, {PROTO_POTENSIC, STR_POTENSIC, STR_SUBTYPE_POTENSIC, 1, OPTION_NONE, 0, 0, SW_NRF, POTENSIC_init, POTENSIC_callback },

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_REVISION 2 #define VERSION_REVISION 2
#define VERSION_PATCH_LEVEL 72 #define VERSION_PATCH_LEVEL 73
#define MODE_SERIAL 0 #define MODE_SERIAL 0
@ -400,6 +400,7 @@ enum PELIKAN
{ {
PELIKAN_PRO = 0, PELIKAN_PRO = 0,
PELIKAN_LITE= 1, PELIKAN_LITE= 1,
PELIKAN_SCX24=2,
}; };
enum V761 enum V761
@ -1086,6 +1087,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
sub_protocol==PELIKAN sub_protocol==PELIKAN
PELIKAN_PRO 0 PELIKAN_PRO 0
PELIKAN_LITE 1 PELIKAN_LITE 1
PELIKAN_SCX24 2
sub_protocol==V761 sub_protocol==V761
V761_3CH 0 V761_3CH 0
V761_4CH 1 V761_4CH 1

View File

@ -21,29 +21,48 @@
//#define PELIKAN_FORCE_ID //#define PELIKAN_FORCE_ID
//#define PELIKAN_LITE_FORCE_ID //#define PELIKAN_LITE_FORCE_ID
#define PELIKAN_LITE_FORCE_HOP #define PELIKAN_LITE_FORCE_HOP
#define PELIKAN_SCX24_FORCE_ID
#define PELIKAN_SCX24_FORCE_HOP
#define PELIKAN_BIND_COUNT 400 #define PELIKAN_BIND_COUNT 400
#define PELIKAN_BIND_RF 0x3C #define PELIKAN_BIND_RF 0x3C
#define PELIKAN_NUM_RF_CHAN 0x1D #define PELIKAN_NUM_RF_CHAN 0x1D
#define PELIKAN_PACKET_PERIOD 7980 #define PELIKAN_PACKET_PERIOD 7980
#define PELIKAN_LITE_PACKET_PERIOD 18000 #define PELIKAN_LITE_PACKET_PERIOD 18000
#define PELIKAN_SCX24_PACKET_PERIOD 15069
static void __attribute__((unused)) pelikan_build_packet() static void __attribute__((unused)) pelikan_build_packet()
{ {
static boolean upper=false; static boolean upper=false;
uint8_t sum;
uint16_t channel;
if(sub_protocol == PELIKAN_SCX24)
packet[0] = 0x11;
else //PELIKAN_PRO & PELIKAN_LITE
packet[0] = 0x15; packet[0] = 0x15;
if(IS_BIND_IN_PROGRESS) if(IS_BIND_IN_PROGRESS)
{ {
packet[1] = 0x04; //version??
packet[2] = rx_tx_addr[0]; packet[2] = rx_tx_addr[0];
packet[3] = rx_tx_addr[1]; packet[3] = rx_tx_addr[1];
packet[4] = rx_tx_addr[2]; packet[4] = rx_tx_addr[2];
packet[5] = rx_tx_addr[3]; packet[5] = rx_tx_addr[3];
if(sub_protocol == PELIKAN_SCX24)
{
packet[1] = 0x65;
packet[6] = 0x55;
packet[7] = 0xAA;
}
else
{//PELIKAN_PRO & PELIKAN_LITE
packet[1] = 0x04; //version??
if(sub_protocol==PELIKAN_PRO) if(sub_protocol==PELIKAN_PRO)
packet[6] = 0x05; //sub version?? packet[6] = 0x05; //sub version??
else //PELIKAN_LITE else //PELIKAN_LITE
packet[6] = 0x03; //sub version?? packet[6] = 0x03; //sub version??
packet[7] = 0x00; //?? packet[7] = 0x00; //??
}
packet[8] = 0x55; //?? packet[8] = 0x55; //??
packet_length = 10; packet_length = 10;
} }
@ -51,12 +70,37 @@ static void __attribute__((unused)) pelikan_build_packet()
{ {
//ID //ID
packet[1] = rx_tx_addr[0]; packet[1] = rx_tx_addr[0];
if(sub_protocol == PELIKAN_SCX24)
{
//ID
packet[4] = rx_tx_addr[1];
//Channels
channel = Channel_data[0]; //STEERING: 1B1..23B..2C5 ???
packet[2] = channel >> 9;
packet[3] = channel >> 1;
channel = Channel_data[1]; //THROTTLE: 0DB..1FF..30E
packet[5] = channel >> 9;
packet[6] = channel >> 1;
channel = Channel_data[2]; //CH3: 055..3AA
packet[7] = channel >> 9;
packet[8] = channel >> 1;
//Hopping counters
if(++packet_count>2)
{
packet_count=0;
if(++hopping_frequency_no>=PELIKAN_NUM_RF_CHAN)
hopping_frequency_no=0;
}
//Length
packet_length = 14;
}
else
{//PELIKAN_PRO & PELIKAN_LITE
//ID
packet[7] = rx_tx_addr[1]; packet[7] = rx_tx_addr[1];
packet[12] = rx_tx_addr[2];
packet[13] = rx_tx_addr[3];
//Channels //Channels
uint8_t offset=upper?4:0; uint8_t offset=upper?4:0;
uint16_t channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871,false); channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871,false);
uint8_t top=(channel>>2) & 0xC0; uint8_t top=(channel>>2) & 0xC0;
packet[2] = channel; packet[2] = channel;
channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871,false); channel=convert_channel_16b_nolimit(CH_AETR[offset++], 153, 871,false);
@ -70,10 +114,10 @@ static void __attribute__((unused)) pelikan_build_packet()
packet[5] = channel; packet[5] = channel;
packet[6] = top; packet[6] = top;
//Check //Check
crc8=0x15; sum=0x00;
for(uint8_t i=1;i<8;i++) for(uint8_t i=0;i<8;i++)
crc8+=packet[i]; sum+=packet[i];
packet[8]=crc8; packet[8]=sum;
//Low/Up channel flag //Low/Up channel flag
packet[9]=upper?0xAA:0x00; packet[9]=upper?0xAA:0x00;
upper=!upper; upper=!upper;
@ -84,27 +128,29 @@ static void __attribute__((unused)) pelikan_build_packet()
if(++hopping_frequency_no>=PELIKAN_NUM_RF_CHAN) if(++hopping_frequency_no>=PELIKAN_NUM_RF_CHAN)
hopping_frequency_no=0; hopping_frequency_no=0;
} }
packet[10]=hopping_frequency_no; //Length
packet[11]=packet_count;
packet_length = 15; packet_length = 15;
} }
//Hopping
packet[packet_length-5] = hopping_frequency_no;
packet[packet_length-4] = packet_count;
//ID
packet[packet_length-3] = rx_tx_addr[2];
packet[packet_length-2] = rx_tx_addr[3];
}
//Check //Check
crc8=0x15; sum=0x00;
for(uint8_t i=1; i<packet_length-1 ;i++) for(uint8_t i=0; i<packet_length-1 ;i++)
crc8+=packet[i]; sum+=packet[i];
packet[packet_length-1]=crc8; packet[packet_length-1] = sum;
//Send //Send
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
if(packet[9]==0x00)
{
debug("C: %02X P(%d):",IS_BIND_IN_PROGRESS?PELIKAN_BIND_RF:hopping_frequency[hopping_frequency_no],packet_length); debug("C: %02X P(%d):",IS_BIND_IN_PROGRESS?PELIKAN_BIND_RF:hopping_frequency[hopping_frequency_no],packet_length);
for(uint8_t i=0;i<packet_length;i++) for(uint8_t i=0;i<packet_length;i++)
debug(" %02X",packet[i]); debug(" %02X",packet[i]);
debugln(""); debugln("");
}
#endif #endif
A7105_WriteData(packet_length, IS_BIND_IN_PROGRESS?PELIKAN_BIND_RF:hopping_frequency[hopping_frequency_no]); A7105_WriteData(packet_length, IS_BIND_IN_PROGRESS?PELIKAN_BIND_RF:hopping_frequency[hopping_frequency_no]);
A7105_SetPower(); A7105_SetPower();
@ -126,16 +172,18 @@ uint16_t PELIKAN_callback()
A7105_Strobe(A7105_STANDBY); A7105_Strobe(A7105_STANDBY);
if(sub_protocol==PELIKAN_PRO) if(sub_protocol==PELIKAN_PRO)
A7105_WriteReg(A7105_03_FIFOI,0x28); A7105_WriteReg(A7105_03_FIFOI,0x28);
else if(sub_protocol==PELIKAN_SCX24)
A7105_WriteReg(A7105_03_FIFOI,0x0D);
else//PELIKAN_LITE else//PELIKAN_LITE
A7105_WriteID(MProtocol_id); A7105_WriteID(MProtocol_id);
} }
} }
#ifdef MULTI_SYNC #ifdef MULTI_SYNC
telemetry_set_input_sync(sub_protocol==PELIKAN_PRO?PELIKAN_PACKET_PERIOD:PELIKAN_LITE_PACKET_PERIOD); telemetry_set_input_sync(packet_period);
#endif #endif
pelikan_build_packet(); pelikan_build_packet();
if(sub_protocol==PELIKAN_PRO || IS_BIND_IN_PROGRESS) if(IS_BIND_IN_PROGRESS || sub_protocol != PELIKAN_LITE)
return PELIKAN_PACKET_PERIOD; return packet_period;
//PELIKAN_LITE //PELIKAN_LITE
phase++; phase++;
return 942; return 942;
@ -241,6 +289,11 @@ const uint8_t PROGMEM pelikan_lite_hopp[][PELIKAN_NUM_RF_CHAN] = {
{ 0x46,0x2A,0x3E,0x5A,0x5C,0x24,0x4E,0x32,0x54,0x26,0x2C,0x34,0x56,0x1E,0x3A,0x3C,0x50,0x4A,0x2E,0x42,0x20,0x52,0x28,0x22,0x44,0x58,0x36,0x38,0x4C } { 0x46,0x2A,0x3E,0x5A,0x5C,0x24,0x4E,0x32,0x54,0x26,0x2C,0x34,0x56,0x1E,0x3A,0x3C,0x50,0x4A,0x2E,0x42,0x20,0x52,0x28,0x22,0x44,0x58,0x36,0x38,0x4C }
}; };
#endif #endif
#ifdef PELIKAN_SCX24_FORCE_HOP
const uint8_t PROGMEM pelikan_scx24_hopp[][PELIKAN_NUM_RF_CHAN] = {
{ 0x1E,0x32,0x46,0x5A,0x44,0x58,0x2E,0x42,0x56,0x2C,0x40,0x54,0x2A,0x3E,0x52,0x28,0x3C,0x50,0x26,0x3A,0x4E,0x24,0x38,0x4C,0x22,0x36,0x4A,0x20,0x1A }
};
#endif
void PELIKAN_init() void PELIKAN_init()
{ {
@ -280,13 +333,43 @@ void PELIKAN_init()
#endif #endif
} }
#endif #endif
#if defined(PELIKAN_SCX24_FORCE_ID) || defined(PELIKAN_SCX24_FORCE_HOP)
if(sub_protocol==PELIKAN_SCX24)
{
#if defined(PELIKAN_SCX24_FORCE_ID)
// ID
rx_tx_addr[2]=0x80;
rx_tx_addr[3]=0x19;
#endif
#if defined(PELIKAN_SCX24_FORCE_HOP)
// Hop frequency table
rx_tx_addr[0]=0x12; // hopping freq
rx_tx_addr[1]=0x46; // hopping freq
for(uint8_t i=0;i<PELIKAN_NUM_RF_CHAN;i++)
hopping_frequency[i]=pgm_read_byte_near(&pelikan_scx24_hopp[0][i]);
#endif
}
#endif
MProtocol_id=((uint32_t)rx_tx_addr[0]<<24)|((uint32_t)rx_tx_addr[1]<<16)|((uint32_t)rx_tx_addr[2]<<8)|(rx_tx_addr[3]); MProtocol_id = ((uint32_t)rx_tx_addr[0]<<24)|((uint32_t)rx_tx_addr[1]<<16)|((uint32_t)rx_tx_addr[2]<<8)|(rx_tx_addr[3]);
if(sub_protocol==PELIKAN_LITE && IS_BIND_DONE)
if(sub_protocol==PELIKAN_LITE)
{
if(IS_BIND_DONE)
A7105_WriteID(MProtocol_id); A7105_WriteID(MProtocol_id);
packet_period = PELIKAN_LITE_PACKET_PERIOD;
}
else if(sub_protocol==PELIKAN_SCX24)
{
if(IS_BIND_DONE)
A7105_WriteReg(A7105_03_FIFOI,0x0D);
packet_period = PELIKAN_SCX24_PACKET_PERIOD;
}
else//PELIKAN_PRO
packet_period = PELIKAN_PACKET_PERIOD;
hopping_frequency_no=PELIKAN_NUM_RF_CHAN; hopping_frequency_no = PELIKAN_NUM_RF_CHAN;
packet_count=5; packet_count = 5;
phase=0; phase = 0;
} }
#endif #endif

View File

@ -735,6 +735,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
PROTO_PELIKAN PROTO_PELIKAN
PELIKAN_PRO PELIKAN_PRO
PELIKAN_LITE PELIKAN_LITE
PELIKAN_SCX24
PROTO_POTENSIC PROTO_POTENSIC
NONE NONE
PROTO_PROPEL PROTO_PROPEL

View File

@ -356,6 +356,15 @@ Models: TX: CADET 4 LITE
**Only 1 frequency hopping table** **Only 1 frequency hopping table**
### Sub_protocol SCX24 - *2*
Models: SCX24
**Only 1 frequency hopping table**
CH1|CH2|CH3
---|---|---
STEERING|THROTTLE|CH3
## WFLY2 - *79* ## WFLY2 - *79*
Receivers: RF201S,RF206S,RF207S,RF209S Receivers: RF201S,RF206S,RF207S,RF209S