mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 18:38:13 +00:00
DSM2: Option enables the selection of the number of channels
- 0 : 4 channels @22ms - 1 : 5 channels @22ms - 2 : 6 channels @22ms - 3 : 7 channels @22ms - 4 : 4 channels @11ms - 5 : 5 channels @11ms - 6 : 6 channels @11ms - 7 : 7 channels @11ms - 8 : 8 channels @22ms - 9 : 9 channels @22ms - 10 : 10 channels @22ms - 11 : 11 channels @22ms - 12 : 12 channels @22ms
This commit is contained in:
parent
a025d028d4
commit
799dce4b13
@ -17,7 +17,6 @@
|
||||
|
||||
#include "iface_cyrf6936.h"
|
||||
|
||||
#define DSM2_NUM_CHANNELS 7
|
||||
#define RANDOM_CHANNELS 0 // disabled
|
||||
//#define RANDOM_CHANNELS 1 // enabled
|
||||
#define BIND_CHANNEL 0x0d //13 This can be any odd channel
|
||||
@ -132,15 +131,11 @@ static void __attribute__((unused)) build_bind_packet()
|
||||
packet[8] = sum >> 8;
|
||||
packet[9] = sum & 0xff;
|
||||
packet[10] = 0x01; //???
|
||||
packet[11] = DSM2_NUM_CHANNELS;
|
||||
packet[11] = option>3?option:option+4;
|
||||
if(sub_protocol==DSMX) //DSMX type
|
||||
packet[12] = 0xb2; // Telemetry off: packet[12] = num_channels < 8 && Model.proto_opts[PROTOOPTS_TELEMETRY] == TELEM_OFF ? 0xa2 : 0xb2;
|
||||
else
|
||||
#if DSM2_NUM_CHANNELS < 8
|
||||
packet[12] = 0x01;
|
||||
#else
|
||||
packet[12] = 0x02;
|
||||
#endif
|
||||
packet[12] = option<8?0x01:0x02;
|
||||
packet[13] = 0x00; //???
|
||||
for(i = 8; i < 14; i++)
|
||||
sum += packet[i];
|
||||
@ -166,34 +161,38 @@ static uint8_t __attribute__((unused)) PROTOCOL_SticksMoved(uint8_t init)
|
||||
|
||||
static void __attribute__((unused)) build_data_packet(uint8_t upper)//
|
||||
{
|
||||
#if DSM2_NUM_CHANNELS==4
|
||||
const uint8_t ch_map[] = {0, 1, 2, 3, 0xff, 0xff, 0xff}; //Guess
|
||||
#elif DSM2_NUM_CHANNELS==5
|
||||
const uint8_t ch_map[] = {0, 1, 2, 3, 4, 0xff, 0xff}; //Guess
|
||||
#elif DSM2_NUM_CHANNELS==6
|
||||
const uint8_t ch_map[] = {1, 5, 2, 3, 0, 4, 0xff}; //HP6DSM
|
||||
#elif DSM2_NUM_CHANNELS==7
|
||||
const uint8_t ch_map[] = {1, 5, 2, 4, 3, 6, 0}; //DX6i
|
||||
#elif DSM2_NUM_CHANNELS==8
|
||||
const uint8_t ch_map[] = {1, 5, 2, 3, 6, 0xff, 0xff, 4, 0, 7, 0xff, 0xff, 0xff, 0xff}; //DX8
|
||||
#elif DSM2_NUM_CHANNELS==9
|
||||
const uint8_t ch_map[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 0xff, 0xff, 0xff, 0xff, 0xff}; //DM9
|
||||
#elif DSM2_NUM_CHANNELS==10
|
||||
const uint8_t ch_map[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 9, 0xff, 0xff, 0xff, 0xff};
|
||||
#elif DSM2_NUM_CHANNELS==11
|
||||
const uint8_t ch_map[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 9, 10, 0xff, 0xff, 0xff};
|
||||
#elif DSM2_NUM_CHANNELS==12
|
||||
const uint8_t ch_map[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 9, 10, 11, 0xff, 0xff};
|
||||
#endif
|
||||
|
||||
uint8_t i;
|
||||
uint8_t bits;
|
||||
|
||||
uint8_t ch_map[] = {3, 2, 1, 5, 0, 4, 6, 7, 8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; //9 Channels - DM9 TX
|
||||
switch(option>3?option:option+4) // Create channel map based on number of channels
|
||||
{
|
||||
case 12:
|
||||
ch_map[11]=11; // 12 channels
|
||||
case 11:
|
||||
ch_map[10]=10; // 11 channels
|
||||
case 10:
|
||||
ch_map[9]=9; // 10 channels
|
||||
break;
|
||||
case 8:
|
||||
memcpy(ch_map,"\x01\x05\x02\x03\x06\xFF\xFF\x04\x00\x07",10); // 8 channels - DX8 TX
|
||||
break;
|
||||
case 7:
|
||||
memcpy(ch_map,"\x01\x05\x02\x04\x03\x06\x00",7); // 7 channels - DX6i TX
|
||||
break;
|
||||
case 6:
|
||||
memcpy(ch_map,"\x01\x05\x02\x03\x00\x04\xFF",7); // 6 channels - HP6DSM TX
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
memcpy(ch_map,"\x00\x01\x02\x03\xFF\xFF\xFF",7); // 4 channels - Guess
|
||||
if(option&0x01)
|
||||
ch_map[4]=4; // 5 channels - Guess
|
||||
break;
|
||||
}
|
||||
//
|
||||
if( binding && PROTOCOL_SticksMoved(0) )
|
||||
{
|
||||
//BIND_DONE;
|
||||
binding = 0;
|
||||
}
|
||||
if (sub_protocol==DSMX)
|
||||
{
|
||||
packet[0] = cyrfmfg_id[2];
|
||||
@ -463,12 +462,16 @@ uint16_t ReadDsm2()
|
||||
set_sop_data_crc();
|
||||
if (cyrf_state == DSM2_CH2_CHECK_A)
|
||||
{
|
||||
#if DSM2_NUM_CHANNELS < 8
|
||||
cyrf_state = DSM2_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
||||
return 11000 - CH1_CH2_DELAY - WRITE_DELAY ; // Original is 22000 from deviation but it works better this way
|
||||
#else
|
||||
cyrf_state = DSM2_CH1_WRITE_B; // change from CH2_CHECK_A to CH1_WRITE_A (to transmit upper)
|
||||
#endif
|
||||
if(option < 8)
|
||||
{
|
||||
cyrf_state = DSM2_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
||||
if(option>3)
|
||||
return 11000 - CH1_CH2_DELAY - WRITE_DELAY ; // force 11ms if option>3 ie 4,5,6,7 channels @11ms
|
||||
else
|
||||
return 22000 - CH1_CH2_DELAY - WRITE_DELAY ; // normal 22ms mode if option<=3 ie 4,5,6,7 channels @22ms
|
||||
}
|
||||
else
|
||||
cyrf_state = DSM2_CH1_WRITE_B; // change from CH2_CHECK_A to CH1_WRITE_A (to transmit upper)
|
||||
}
|
||||
else
|
||||
cyrf_state = DSM2_CH1_WRITE_A; // change from CH2_CHECK_B to CH1_WRITE_A (upper already transmitted so transmit lower)
|
||||
|
@ -64,10 +64,10 @@ const PPM_Parameters PPM_prot[15]= {
|
||||
// Dial Protocol Sub protocol RX_Num Power Auto Bind Option
|
||||
/* 1 */ {MODE_FLYSKY, Flysky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 2 */ {MODE_HUBSAN, 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 3 */ {MODE_FRSKY , 0 , 0 , P_HIGH , NO_AUTOBIND , 0xD7 },
|
||||
/* 3 */ {MODE_FRSKY , 0 , 0 , P_HIGH , NO_AUTOBIND , 0xD7 }, // D7 fine tuning
|
||||
/* 4 */ {MODE_HISKY , Hisky , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 5 */ {MODE_V2X2 , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 6 */ {MODE_DSM2 , DSM2 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 6 */ {MODE_DSM2 , DSM2 , 0 , P_HIGH , NO_AUTOBIND , 6 }, // 6 channels @ 11ms
|
||||
/* 7 */ {MODE_DEVO , 0 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 8 */ {MODE_YD717 , YD717 , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
/* 9 */ {MODE_KN , WLTOYS , 0 , P_HIGH , NO_AUTOBIND , 0 },
|
||||
|
@ -83,11 +83,27 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||
##DSM2
|
||||
Extended limits supported
|
||||
|
||||
7 channels @11ms
|
||||
option=number of channels and frame rate:
|
||||
- 0 : 4 channels @22ms
|
||||
- 1 : 5 channels @22ms
|
||||
- 2 : 6 channels @22ms
|
||||
- 3 : 7 channels @22ms
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7
|
||||
---|---|---|---|---|---|---
|
||||
A|E|T|R|CH5|CH6|CH7
|
||||
- 4 : 4 channels @11ms
|
||||
- 5 : 5 channels @11ms
|
||||
- 6 : 6 channels @11ms
|
||||
- 7 : 7 channels @11ms
|
||||
|
||||
- 8 : 8 channels @22ms
|
||||
- 9 : 9 channels @22ms
|
||||
- 10 : 10 channels @22ms
|
||||
- 11 : 11 channels @22ms
|
||||
- 12 : 12 channels @22ms
|
||||
6 is usually giving the best results with most of the RX.
|
||||
|
||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
---|---|---|---|---|---|---|---|---|----|----|----
|
||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
|
||||
|
||||
###Sub_protocol DSMX
|
||||
Same as above
|
||||
|
@ -124,7 +124,7 @@ Dial|Protocol|Sub_protocol|RX Num|Power|Auto Bind|Option|RF Module
|
||||
3|FRSKY|-|0|High|No|-41|CC2500
|
||||
4|HISKY|Hisky|0|High|No|0|NRF24L01
|
||||
5|V2X2|-|0|High|No|0|NRF24L01
|
||||
6|DSM2|DSM2|0|High|No|0|CYRF6936
|
||||
6|DSM2|DSM2|0|High|No|6|CYRF6936
|
||||
7|DEVO|-|0|High|No|0|CYRF6936
|
||||
8|YD717|YD717|0|High|No|0|NRF24L01
|
||||
9|KN|WLTOYS|0|High|No|0|NRF24L01
|
||||
|
Loading…
x
Reference in New Issue
Block a user