mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 18:38:13 +00:00
Compare commits
3 Commits
5542e7005d
...
b3537ea75a
Author | SHA1 | Date | |
---|---|---|---|
|
b3537ea75a | ||
|
bccc050165 | ||
|
0f0df176de |
@ -267,6 +267,7 @@ uint16_t DSM_RX_callback()
|
|||||||
0x01 => 22ms 1024 DSM2 1 packet => number of channels is <8
|
0x01 => 22ms 1024 DSM2 1 packet => number of channels is <8
|
||||||
0x02 => 22ms 1024 DSM2 2 packets => either a number of channel >7
|
0x02 => 22ms 1024 DSM2 2 packets => either a number of channel >7
|
||||||
0x12 => 11ms 2048 DSM2 2 packets => can be any number of channels
|
0x12 => 11ms 2048 DSM2 2 packets => can be any number of channels
|
||||||
|
0x23 => DX3R DSM2 2 surface packets
|
||||||
0xA2 => 22ms 2048 DSMX 1 packet => number of channels is <8
|
0xA2 => 22ms 2048 DSMX 1 packet => number of channels is <8
|
||||||
0xB2 => 11ms 2048 DSMX => can be any number of channels
|
0xB2 => 11ms 2048 DSMX => can be any number of channels
|
||||||
(0x01 or 0xA2) and num_ch < 7 => 22ms else 11ms
|
(0x01 or 0xA2) and num_ch < 7 => 22ms else 11ms
|
||||||
|
@ -94,9 +94,12 @@ static void __attribute__((unused)) DSM_build_bind_packet()
|
|||||||
packet[11] = 12;
|
packet[11] = 12;
|
||||||
else
|
else
|
||||||
packet[11] = num_ch; // DX5 DSMR sends 0x48...
|
packet[11] = num_ch; // DX5 DSMR sends 0x48...
|
||||||
|
//packet[11] = 3; // DX3R
|
||||||
|
|
||||||
if (sub_protocol==DSMR)
|
if (sub_protocol==DSMR)
|
||||||
packet[12] = 0xa2;
|
packet[12] = 0xa2;
|
||||||
|
else if (sub_protocol==DSM2_SFC)
|
||||||
|
packet[12] = 0x23; // DX3R
|
||||||
else if (sub_protocol==DSM2_1F)
|
else if (sub_protocol==DSM2_1F)
|
||||||
packet[12] = num_ch<8?0x01:0x02; // DSM2/1024 1 or 2 packets depending on the number of channels
|
packet[12] = num_ch<8?0x01:0x02; // DSM2/1024 1 or 2 packets depending on the number of channels
|
||||||
else if(sub_protocol==DSM2_2F)
|
else if(sub_protocol==DSM2_2F)
|
||||||
@ -179,12 +182,16 @@ static void __attribute__((unused)) DSM_build_data_packet(uint8_t upper)
|
|||||||
|
|
||||||
#ifndef MULTI_AIR
|
#ifndef MULTI_AIR
|
||||||
if(sub_protocol == DSMR || sub_protocol == DSM2_SFC)
|
if(sub_protocol == DSMR || sub_protocol == DSM2_SFC)
|
||||||
{
|
{ // 12 bits, full range, no reassignment
|
||||||
for (uint8_t i = 0; i < 7; i++)
|
for (uint8_t i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
uint16_t value = 0x0000;
|
uint16_t value = 0x0000;
|
||||||
if(i < num_ch)
|
if(i < num_ch)
|
||||||
|
{
|
||||||
value=Channel_data[i]<<1;
|
value=Channel_data[i]<<1;
|
||||||
|
if(sub_protocol == DSM2_SFC)
|
||||||
|
value |= i<<12;
|
||||||
|
}
|
||||||
packet[i*2+2] = (value >> 8) & 0xff;
|
packet[i*2+2] = (value >> 8) & 0xff;
|
||||||
packet[i*2+3] = (value >> 0) & 0xff;
|
packet[i*2+3] = (value >> 0) & 0xff;
|
||||||
}
|
}
|
||||||
@ -308,11 +315,11 @@ uint16_t DSM_callback()
|
|||||||
return 10000;
|
return 10000;
|
||||||
#if defined DSM_TELEMETRY
|
#if defined DSM_TELEMETRY
|
||||||
case DSM_BIND_CHECK:
|
case DSM_BIND_CHECK:
|
||||||
#if DEBUG_BIND
|
#if DEBUG_BIND
|
||||||
debugln("Bind Check");
|
debugln("Bind Check");
|
||||||
#endif
|
#endif
|
||||||
//64 SDR Mode is configured so only the 8 first values are needed
|
//64 SDR Mode is configured so only the 8 first values are needed
|
||||||
CYRF_ConfigDataCode((const uint8_t *)"\x98\x88\x1B\xE4\x30\x79\x03\x84");
|
CYRF_ConfigDataCode((const uint8_t *)"\x98\x88\x1B\xE4\x30\x79\x03\x84");
|
||||||
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
||||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //Prepare to receive
|
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //Prepare to receive
|
||||||
bind_counter=DSM_BIND_COUNT_READ; //Timeout of 4.2s if no packet received
|
bind_counter=DSM_BIND_COUNT_READ; //Timeout of 4.2s if no packet received
|
||||||
@ -384,7 +391,7 @@ uint16_t DSM_callback()
|
|||||||
return 10000;
|
return 10000;
|
||||||
case DSM_CH1_WRITE_A:
|
case DSM_CH1_WRITE_A:
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
if(sub_protocol!=DSM2_SFC)
|
if(sub_protocol!=DSM2_SFC || option&0x40) // option&40 in this case is 16.5ms/11ms frame rate for DSM2_SFC
|
||||||
telemetry_set_input_sync(11000); // Always request 11ms spacing even if we don't use half of it in 22ms mode
|
telemetry_set_input_sync(11000); // Always request 11ms spacing even if we don't use half of it in 22ms mode
|
||||||
else
|
else
|
||||||
telemetry_set_input_sync(DSM2_SFC_PERIOD);
|
telemetry_set_input_sync(DSM2_SFC_PERIOD);
|
||||||
@ -401,7 +408,12 @@ uint16_t DSM_callback()
|
|||||||
case DSM_CH2_WRITE_B:
|
case DSM_CH2_WRITE_B:
|
||||||
CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS); // clear IRQ flags
|
CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS); // clear IRQ flags
|
||||||
//debugln_time("");
|
//debugln_time("");
|
||||||
CYRF_WriteDataPacket(packet);
|
#ifndef MULTI_AIR
|
||||||
|
if(sub_protocol==DSM2_SFC)
|
||||||
|
CYRF_WriteDataPacketLen(packet,2*(num_ch+1));
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
CYRF_WriteDataPacket(packet);
|
||||||
#if 0
|
#if 0
|
||||||
for(uint8_t i=0;i<16;i++)
|
for(uint8_t i=0;i<16;i++)
|
||||||
debug(" %02X", packet[i]);
|
debug(" %02X", packet[i]);
|
||||||
@ -443,7 +455,12 @@ uint16_t DSM_callback()
|
|||||||
{
|
{
|
||||||
phase = DSM_CH2_READ_B;
|
phase = DSM_CH2_READ_B;
|
||||||
if(sub_protocol == DSM2_SFC)
|
if(sub_protocol == DSM2_SFC)
|
||||||
return DSM2_SFC_PERIOD - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
{
|
||||||
|
if(option&0x40) // option&40 in this case is 16.5ms/11ms frame rate for DSM2_SFC
|
||||||
|
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
||||||
|
else
|
||||||
|
return DSM2_SFC_PERIOD - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
||||||
|
}
|
||||||
return 11000 - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
return 11000 - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -502,7 +519,12 @@ uint16_t DSM_callback()
|
|||||||
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
||||||
#ifndef MULTI_AIR
|
#ifndef MULTI_AIR
|
||||||
if(sub_protocol==DSM2_SFC)
|
if(sub_protocol==DSM2_SFC)
|
||||||
return DSM2_SFC_PERIOD - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
{
|
||||||
|
if(option&0x40) // option&40 in this case is 16.5ms/11ms frame rate for DSM2_SFC
|
||||||
|
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
|
else
|
||||||
|
return DSM2_SFC_PERIOD - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return 22000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
return 22000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 4
|
#define VERSION_REVISION 4
|
||||||
#define VERSION_PATCH_LEVEL 6
|
#define VERSION_PATCH_LEVEL 7
|
||||||
|
|
||||||
#define MODE_SERIAL 0
|
#define MODE_SERIAL 0
|
||||||
|
|
||||||
|
@ -552,6 +552,8 @@ Surface DSM2 receivers, tested with a SR3100
|
|||||||
|
|
||||||
Extended limits available and no channel mapping. Do not use DSM/AUTO to bind but DSM/2SFC instead.
|
Extended limits available and no channel mapping. Do not use DSM/AUTO to bind but DSM/2SFC instead.
|
||||||
|
|
||||||
|
Servo refresh rate 22/11ms is repurposed to the frame rates 16.5ms(22) and 11ms(11).
|
||||||
|
|
||||||
CH1|CH2|CH3
|
CH1|CH2|CH3
|
||||||
---|---|---
|
---|---|---
|
||||||
STR|THR|AUX1
|
STR|THR|AUX1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user