mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 21:48:12 +00:00
SLT Vista format
This commit is contained in:
parent
683bdc838d
commit
27b3a86155
@ -94,6 +94,11 @@ enum SYMAX
|
|||||||
SYMAX = 0,
|
SYMAX = 0,
|
||||||
SYMAX5C = 1
|
SYMAX5C = 1
|
||||||
};
|
};
|
||||||
|
enum SLT
|
||||||
|
{
|
||||||
|
SLT = 0,
|
||||||
|
VISTA = 1
|
||||||
|
};
|
||||||
enum CX10
|
enum CX10
|
||||||
{
|
{
|
||||||
CX10_GREEN = 0,
|
CX10_GREEN = 0,
|
||||||
@ -434,6 +439,9 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
JC3015_2 5
|
JC3015_2 5
|
||||||
MK33041 6
|
MK33041 6
|
||||||
Q242 7
|
Q242 7
|
||||||
|
sub_protocol==SLT
|
||||||
|
SLT 0
|
||||||
|
VISTA 1
|
||||||
sub_protocol==CG023
|
sub_protocol==CG023
|
||||||
CG023 0
|
CG023 0
|
||||||
YD829 1
|
YD829 1
|
||||||
|
@ -20,15 +20,20 @@
|
|||||||
|
|
||||||
// For code readability
|
// For code readability
|
||||||
#define SLT_PAYLOADSIZE 7
|
#define SLT_PAYLOADSIZE 7
|
||||||
|
#define SLT_VISTA_PAYLOADSIZE 11
|
||||||
#define SLT_NFREQCHANNELS 15
|
#define SLT_NFREQCHANNELS 15
|
||||||
#define SLT_TXID_SIZE 4
|
#define SLT_TXID_SIZE 4
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SLT_BUILD=0,
|
// flags going to packet[6]
|
||||||
SLT_DATA1,
|
SLT_VISTA_FLAG_FLIP = 0x04,
|
||||||
SLT_DATA2,
|
SLT_VISTA_FLAG_MODE = 0x20
|
||||||
SLT_DATA3,
|
};
|
||||||
SLT_BIND
|
|
||||||
|
enum {
|
||||||
|
SLT_BIND=0,
|
||||||
|
SLT_BUILD,
|
||||||
|
SLT_DATA,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __attribute__((unused)) SLT_init()
|
static void __attribute__((unused)) SLT_init()
|
||||||
@ -108,19 +113,37 @@ static void __attribute__((unused)) SLT_build_packet()
|
|||||||
if (++hopping_frequency_no >= SLT_NFREQCHANNELS)
|
if (++hopping_frequency_no >= SLT_NFREQCHANNELS)
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
|
|
||||||
// aileron, elevator, throttle, rudder, gear, pitch
|
// aileron, elevator, throttle, rudder, gear, pitch
|
||||||
uint8_t e = 0; // byte where extension 2 bits for every 10-bit channel are packed
|
uint8_t e = 0; // byte where extension 2 bits for every 10-bit channel are packed
|
||||||
for (uint8_t i = 0; i < 4; ++i)
|
for (uint8_t i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
uint16_t v = convert_channel_10b(CH_AETR[i]);
|
uint16_t v = convert_channel_10b(CH_AETR[i]);
|
||||||
|
if(sub_protocol==VISTA && CH_AETR[i]==THROTTLE)
|
||||||
|
v = (uint16_t) map(limit_channel_100(THROTTLE),servo_min_100,servo_max_100,850,150); // Throttel is between 850=0% and 150=100%
|
||||||
packet[i] = v;
|
packet[i] = v;
|
||||||
e = (e >> 2) | (uint8_t) ((v >> 2) & 0xC0);
|
e = (e >> 2) | (uint8_t) ((v >> 2) & 0xC0);
|
||||||
}
|
}
|
||||||
// Extra bits for AETR
|
// Extra bits for AETR
|
||||||
packet[4] = e;
|
packet[4] = e;
|
||||||
// 8-bit channels
|
if(sub_protocol==SLT)
|
||||||
packet[5] = convert_channel_8b(AUX1);
|
{
|
||||||
packet[6] = convert_channel_8b(AUX2);
|
// 8-bit channels
|
||||||
|
packet[5] = convert_channel_8b(AUX1);
|
||||||
|
packet[6] = convert_channel_8b(AUX2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // VISTA
|
||||||
|
packet[5] = 0xA6;
|
||||||
|
packet[6] = 0x00;
|
||||||
|
if(Servo_AUX1)
|
||||||
|
packet[6] = SLT_VISTA_FLAG_FLIP;
|
||||||
|
if(Servo_AUX2)
|
||||||
|
packet[6] |= SLT_VISTA_FLAG_MODE;
|
||||||
|
packet[7] = 0x00;
|
||||||
|
packet[8] = 0x7F;
|
||||||
|
packet[9] = 0xAA;
|
||||||
|
packet[10] = 0x00;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) SLT_send_bind_packet()
|
static void __attribute__((unused)) SLT_send_bind_packet()
|
||||||
@ -144,38 +167,48 @@ uint16_t SLT_callback()
|
|||||||
{
|
{
|
||||||
switch (phase)
|
switch (phase)
|
||||||
{
|
{
|
||||||
case SLT_BUILD:
|
case SLT_BIND:
|
||||||
SLT_build_packet();
|
bind_phase = 0;
|
||||||
phase++;
|
SLT_send_bind_packet();
|
||||||
return 1000;
|
if(sub_protocol == VISTA)
|
||||||
case SLT_DATA1:
|
|
||||||
SLT_send_data(packet, SLT_PAYLOADSIZE);
|
|
||||||
phase++;
|
|
||||||
return 1000;
|
|
||||||
case SLT_DATA2:
|
|
||||||
SLT_send_data(packet, SLT_PAYLOADSIZE);
|
|
||||||
phase++;
|
|
||||||
return 1000;
|
|
||||||
case SLT_DATA3:
|
|
||||||
SLT_send_data(packet, SLT_PAYLOADSIZE);
|
|
||||||
if (++packet_count >= 100)
|
|
||||||
{
|
{
|
||||||
packet_count = 0;
|
phase=SLT_DATA;
|
||||||
phase++;
|
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
else
|
phase++; // SLT_BUILD
|
||||||
|
return 18000;
|
||||||
|
case SLT_BUILD:
|
||||||
|
SLT_build_packet();
|
||||||
|
packet_count=0;
|
||||||
|
phase++; // SLT_DATA
|
||||||
|
return 1000;
|
||||||
|
case SLT_DATA:
|
||||||
|
SLT_send_data(packet, sub_protocol == VISTA?SLT_VISTA_PAYLOADSIZE:SLT_PAYLOADSIZE);
|
||||||
|
packet_count++;
|
||||||
|
if(packet_count >= (sub_protocol == VISTA?5:3))
|
||||||
{
|
{
|
||||||
|
bind_phase++;
|
||||||
NRF24L01_SetPower(); // Set tx_power
|
NRF24L01_SetPower(); // Set tx_power
|
||||||
phase = SLT_BUILD;
|
phase = SLT_BUILD; // Refresh data
|
||||||
|
if(sub_protocol == VISTA)
|
||||||
|
return 1000;
|
||||||
|
else
|
||||||
|
if(bind_phase>=100)
|
||||||
|
{
|
||||||
|
phase=SLT_BIND;
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
return 19000;
|
return 19000;
|
||||||
}
|
}
|
||||||
case SLT_BIND:
|
if(sub_protocol == VISTA)
|
||||||
SLT_send_bind_packet();
|
{ if(bind_phase>=150)
|
||||||
phase = SLT_BUILD;
|
phase=SLT_BIND;
|
||||||
return 18000;
|
else
|
||||||
|
return 2000;
|
||||||
|
}
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
return 19000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t initSLT()
|
uint16_t initSLT()
|
||||||
@ -183,7 +216,11 @@ uint16_t initSLT()
|
|||||||
packet_count = 0;
|
packet_count = 0;
|
||||||
packet_sent = 0;
|
packet_sent = 0;
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
|
if(sub_protocol == VISTA)
|
||||||
|
memcpy(rx_tx_addr,"\x00\x00\x23\x00",SLT_TXID_SIZE);
|
||||||
SLT_set_freq();
|
SLT_set_freq();
|
||||||
|
if(sub_protocol == VISTA)
|
||||||
|
memcpy(hopping_frequency+6,"\x13\x0F\x0B\x10\x08\x16\x1D\x24\x06",9);
|
||||||
SLT_init();
|
SLT_init();
|
||||||
phase = SLT_BIND;
|
phase = SLT_BIND;
|
||||||
return 50000;
|
return 50000;
|
||||||
|
@ -91,7 +91,6 @@
|
|||||||
#define ASSAN_NRF24L01_INO
|
#define ASSAN_NRF24L01_INO
|
||||||
#define HONTAI_NRF24L01_INO
|
#define HONTAI_NRF24L01_INO
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/*** TELEMETRY SETTINGS ***/
|
/*** TELEMETRY SETTINGS ***/
|
||||||
/**************************/
|
/**************************/
|
||||||
@ -218,6 +217,9 @@ const PPM_Parameters PPM_prot[15]= {
|
|||||||
JC3015_2
|
JC3015_2
|
||||||
MK33041
|
MK33041
|
||||||
Q242
|
Q242
|
||||||
|
MODE_SLT
|
||||||
|
SLT
|
||||||
|
VISTA
|
||||||
MODE_CG023
|
MODE_CG023
|
||||||
CG023
|
CG023
|
||||||
YD829
|
YD829
|
||||||
|
Loading…
x
Reference in New Issue
Block a user