mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-09-13 08:01:03 +00:00
SGF22/CX10 new subprotocol
Only 2 IDs
This commit is contained in:
parent
e35c4d3ce8
commit
35f284763a
@ -189,7 +189,7 @@ const char STR_SUBTYPE_MOULDKG[] = "\x05""A4444""D4444""A664\0";
|
||||
const char STR_SUBTYPE_KF606[] = "\x06""KF606\0""MIG320""ZCZ50\0";
|
||||
const char STR_SUBTYPE_E129[] = "\x04""E129""C186";
|
||||
const char STR_SUBTYPE_FX[] = "\x05""816\0 ""620\0 ""9630\0""Q560\0""QF012";
|
||||
const char STR_SUBTYPE_SGF22[] = "\x04""F22\0""F22S""J20\0";
|
||||
const char STR_SUBTYPE_SGF22[] = "\x04""F22\0""F22S""J20\0""CX10";
|
||||
const char STR_SUBTYPE_JIABAILE[] = "\x04""Std\0""Gyro";
|
||||
#define NO_SUBTYPE nullptr
|
||||
|
||||
@ -474,7 +474,7 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{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, STR_SUBTYPE_SGF22, 3, OPTION_NONE, 0, 0, SW_NRF, SGF22_init, SGF22_callback },
|
||||
{PROTO_SGF22, STR_SGF22, STR_SUBTYPE_SGF22, 4, 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 },
|
||||
|
@ -499,6 +499,7 @@ enum SGF22
|
||||
SGF22_F22 = 0,
|
||||
SGF22_F22S = 1,
|
||||
SGF22_J20 = 2,
|
||||
SGF22_CX10 = 3,
|
||||
};
|
||||
enum JIABAILE
|
||||
{
|
||||
|
@ -19,14 +19,16 @@ Multiprotocol is distributed in the hope that it will be useful,
|
||||
#include "iface_xn297.h"
|
||||
|
||||
//#define FORCE_SGF22_ORIGINAL_ID
|
||||
#define FORCE_SGF22_CX10_ORIGINAL_ID
|
||||
|
||||
#define SGF22_PACKET_PERIOD 11950 //10240
|
||||
#define SGF22_BIND_RF_CHANNEL 78
|
||||
#define SGF22_PAYLOAD_SIZE 12
|
||||
#define SGF22_BIND_COUNT 50
|
||||
#define SGF22_RF_NUM_CHANNELS 4
|
||||
#define SGF22_BIND_RF_CHANNEL 78
|
||||
#define SGF22_F22S_BIND_RF_CHANNEL 10
|
||||
#define SGF22_J20_BIND_RF_CHANNEL 28
|
||||
#define SGF22_CX10_BIND_RF_CHANNEL 48
|
||||
|
||||
//packet[8]
|
||||
#define SGF22_FLAG_3D 0x00
|
||||
@ -79,26 +81,43 @@ static void __attribute__((unused)) SGF22_send_packet()
|
||||
packet_sent = 0;
|
||||
//packet
|
||||
packet[0] = 0x1B;
|
||||
packet[8] = SGF22_FLAG_3D // CH5 -100%, F22 & F22S - 3D mode, J20 - Gyro off
|
||||
| GET_FLAG(CH6_SW, SGF22_FLAG_ROLL) // roll
|
||||
| GET_FLAG(CH7_SW, SGF22_FLAG_LIGHT) // push up throttle trim for light in the stock TX
|
||||
| GET_FLAG(CH9_SW, SGF22_FLAG_VIDEO) // push down throttle trim for video in the stock TX
|
||||
| GET_FLAG(CH11_SW, SGF22_FX922_FLAG_BALANCE)
|
||||
| GET_FLAG(CH12_SW, SGF22_FX922_FLAG_BALANCEHIGH);
|
||||
if(Channel_data[CH5] > CHANNEL_MAX_COMMAND)
|
||||
packet[8] |= SGF22_FLAG_VERTICAL; // CH5 100%, vertical mode (torque)
|
||||
else if(Channel_data[CH5] > CHANNEL_MIN_COMMAND )
|
||||
if (sub_protocol != SGF22_CX10)
|
||||
{//SGF22_F22,SGF22_F22S,SGF22_J20
|
||||
packet[8] = SGF22_FLAG_3D // CH5 -100%, F22 & F22S - 3D mode, J20 - Gyro off
|
||||
| GET_FLAG(CH6_SW, SGF22_FLAG_ROLL) // roll
|
||||
| GET_FLAG(CH7_SW, SGF22_FLAG_LIGHT) // push up throttle trim for light in the stock TX
|
||||
| GET_FLAG(CH9_SW, SGF22_FLAG_VIDEO) // push down throttle trim for video in the stock TX
|
||||
| GET_FLAG(CH11_SW, SGF22_FX922_FLAG_BALANCE)
|
||||
| GET_FLAG(CH12_SW, SGF22_FX922_FLAG_BALANCEHIGH);
|
||||
if(Channel_data[CH5] > CHANNEL_MAX_COMMAND)
|
||||
packet[8] |= SGF22_FLAG_VERTICAL; // CH5 100%, vertical mode (torque)
|
||||
else if(Channel_data[CH5] > CHANNEL_MIN_COMMAND )
|
||||
packet[8] |= ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_HORIZONTAL : SGF22_FLAG_6G ); // CH5 0%, F22 & F22S - 6G mode, J20 - Horizontal mode
|
||||
packet[9] = GET_FLAG(CH8_SW, SGF22_FLAG_PHOTO) // F22: photo, press in throttle trim in the stock TX, J20: invert flight
|
||||
}
|
||||
else //SGF22_CX10 114548
|
||||
{
|
||||
if(CH6_SW)
|
||||
flags = 0x06; // high rate
|
||||
else
|
||||
if(Channel_data[CH6] < CHANNEL_MIN_COMMAND)
|
||||
flags = 0x04; // low rate
|
||||
else
|
||||
flags = 0x05; // mid rate
|
||||
packet[8] = flags
|
||||
| GET_FLAG(CH5_SW, 0x08); // flip
|
||||
}
|
||||
packet[9] = GET_FLAG(CH8_SW, SGF22_FLAG_PHOTO) // F22: photo, press in throttle trim in the stock TX, J20: invert flight
|
||||
| GET_FLAG(CH10_SW, ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_FIXHEIGHT : SGF22_FLAG_TRIMRESET )) ; // F22: Both sticks down inwards in the stock TX, J20: Altitude hold
|
||||
packet[10] = 0x42; // no fine tune
|
||||
packet[11] = 0x10; // no fine tune
|
||||
packet[10] = 0x42; // no fine tune
|
||||
packet[11] = 0x10; // no fine tune
|
||||
}
|
||||
if(sub_protocol == SGF22_F22S)
|
||||
packet[0] += 6;
|
||||
else if (sub_protocol == SGF22_J20)
|
||||
packet[0] += 3;
|
||||
packet[1] = packet_count; // sequence
|
||||
else if (sub_protocol == SGF22_CX10)
|
||||
packet[0] += 0x6A;
|
||||
packet[1] = packet_count; // sequence
|
||||
packet[2] = rx_tx_addr[2];
|
||||
packet[3] = rx_tx_addr[3];
|
||||
packet[4] = convert_channel_8b(THROTTLE);
|
||||
@ -108,7 +127,10 @@ static void __attribute__((unused)) SGF22_send_packet()
|
||||
|
||||
XN297_SetPower();
|
||||
XN297_SetTxRxMode(TX_EN);
|
||||
XN297_WriteEnhancedPayload(packet, SGF22_PAYLOAD_SIZE,0);
|
||||
if (sub_protocol != SGF22_CX10)
|
||||
XN297_WriteEnhancedPayload(packet, SGF22_PAYLOAD_SIZE,0);
|
||||
else
|
||||
XN297_WritePayload(packet, SGF22_PAYLOAD_SIZE);
|
||||
#if 0
|
||||
debug_time("");
|
||||
for(uint8_t i=0; i<SGF22_PAYLOAD_SIZE; i++)
|
||||
@ -132,7 +154,7 @@ static void __attribute__((unused)) SGF22_initialize_txid()
|
||||
{ 0x18, 0x37, 0x27, 0x47 } };
|
||||
memcpy(hopping_frequency, &hop[val], SGF22_RF_NUM_CHANNELS);
|
||||
|
||||
/*//Same code sze...
|
||||
/*//Same code size...
|
||||
hopping_frequency[0] = 0x0C + 3 * val;
|
||||
hopping_frequency[1] = hopping_frequency[0] + 0x1E;
|
||||
if(val > 1) hopping_frequency[1]++;
|
||||
@ -145,6 +167,20 @@ static void __attribute__((unused)) SGF22_initialize_txid()
|
||||
rx_tx_addr[3] = 0x61; // TX2:51 TX3:0C
|
||||
memcpy(hopping_frequency,"\x15\x34\x24\x44", SGF22_RF_NUM_CHANNELS); //Original dump=>21=0x15,52=0x34,36=0x24,68=0x44
|
||||
#endif
|
||||
#ifdef FORCE_SGF22_CX10_ORIGINAL_ID
|
||||
if(rx_tx_addr[3] & 1)
|
||||
{
|
||||
rx_tx_addr[2] = 0x4C;
|
||||
rx_tx_addr[3] = 0xD7;
|
||||
memcpy(hopping_frequency, "\x37\x42\x47\x3c", SGF22_RF_NUM_CHANNELS);
|
||||
}
|
||||
else
|
||||
{
|
||||
rx_tx_addr[2] = 0x50;
|
||||
rx_tx_addr[3] = 0xE1;
|
||||
memcpy(hopping_frequency, "\x3b\x4b\x46\x41", SGF22_RF_NUM_CHANNELS);
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
debug("ID: %02X %02X, C: ",rx_tx_addr[2],rx_tx_addr[3]);
|
||||
for(uint8_t i=0; i<SGF22_RF_NUM_CHANNELS; i++)
|
||||
@ -161,7 +197,7 @@ static void __attribute__((unused)) SGF22_RF_init()
|
||||
XN297_SetRXAddr((uint8_t*)"\xC7\x95\x3C\xBB\xA5", SGF22_PAYLOAD_SIZE);
|
||||
#endif
|
||||
|
||||
const uint8_t bind_chan[] = {SGF22_BIND_RF_CHANNEL, SGF22_F22S_BIND_RF_CHANNEL, SGF22_J20_BIND_RF_CHANNEL};
|
||||
const uint8_t bind_chan[] = {SGF22_BIND_RF_CHANNEL, SGF22_F22S_BIND_RF_CHANNEL, SGF22_J20_BIND_RF_CHANNEL, SGF22_CX10_BIND_RF_CHANNEL};
|
||||
XN297_RFChannel(bind_chan[sub_protocol]); // Set bind channel
|
||||
}
|
||||
|
||||
|
@ -835,6 +835,7 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
||||
SGF22
|
||||
F22S
|
||||
J20
|
||||
CX10
|
||||
PROTO_SHENQI
|
||||
NONE
|
||||
PROTO_SHENQI2
|
||||
|
@ -2253,12 +2253,19 @@ Manual CH11=-100% & CH12=-100%, Balance CH11=+100% & CH12=-100%, Large Angle Bal
|
||||
### Sub_protocol F22S
|
||||
Model: ParkTen F22S
|
||||
|
||||
F22S: Mode -100% = 3D, 0% = 6G
|
||||
Mode -100% = 3D, 0% = 6G
|
||||
|
||||
### Sub_protocol J20
|
||||
Model: KF700 J20
|
||||
|
||||
J20: Mode -100% = Gyro off, 0% = Horizontal, 100% = Vertical. CH8 - Invert, CH10 - Fix Height (Altitude hold)
|
||||
Mode -100% = Gyro off, 0% = Horizontal, 100% = Vertical. CH8 - Invert, CH10 - Fix Height (Altitude hold)
|
||||
|
||||
### Sub_protocol CX10
|
||||
Model: Cheerson CX-10 with red PCB
|
||||
|
||||
**Only 2 IDs available**, use RX num to cycle through them.
|
||||
|
||||
Mode -100% = Low, 0% = Medium, 100% = High
|
||||
|
||||
## Shenqi - *19*
|
||||
Autobind protocol
|
||||
|
Loading…
x
Reference in New Issue
Block a user