mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-09 22:38:10 +00:00
Devo protocol: number of channels
This commit is contained in:
parent
840ca74407
commit
4671700b7d
@ -42,7 +42,6 @@ enum {
|
|||||||
|
|
||||||
//
|
//
|
||||||
uint8_t sop_col;
|
uint8_t sop_col;
|
||||||
uint8_t DSM_num_ch=0;
|
|
||||||
uint8_t ch_map[14];
|
uint8_t ch_map[14];
|
||||||
const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
|
const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
|
||||||
//22+11ms for 4..7 channels
|
//22+11ms for 4..7 channels
|
||||||
@ -189,17 +188,17 @@ static void __attribute__((unused)) DSM_build_bind_packet()
|
|||||||
packet[8] = sum >> 8;
|
packet[8] = sum >> 8;
|
||||||
packet[9] = sum & 0xff;
|
packet[9] = sum & 0xff;
|
||||||
packet[10] = 0x01; //???
|
packet[10] = 0x01; //???
|
||||||
packet[11] = DSM_num_ch;
|
packet[11] = num_ch;
|
||||||
|
|
||||||
if (sub_protocol==DSM2_22)
|
if (sub_protocol==DSM2_22)
|
||||||
packet[12]=DSM_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
|
||||||
if(sub_protocol==DSM2_11)
|
if(sub_protocol==DSM2_11)
|
||||||
packet[12]=0x12; // DSM2/2048 2 packets
|
packet[12]=0x12; // DSM2/2048 2 packets
|
||||||
if(sub_protocol==DSMX_22)
|
if(sub_protocol==DSMX_22)
|
||||||
#if defined DSM_TELEMETRY
|
#if defined DSM_TELEMETRY
|
||||||
packet[12] = 0xb2; // DSMX/2048 2 packets
|
packet[12] = 0xb2; // DSMX/2048 2 packets
|
||||||
#else
|
#else
|
||||||
packet[12] = DSM_num_ch<8? 0xa2 : 0xb2; // DSMX/2048 1 or 2 packets depending on the number of channels
|
packet[12] = num_ch<8? 0xa2 : 0xb2; // DSMX/2048 1 or 2 packets depending on the number of channels
|
||||||
#endif
|
#endif
|
||||||
if(sub_protocol==DSMX_11 || sub_protocol==DSM_AUTO) // Force DSMX/1024 in mode Auto
|
if(sub_protocol==DSMX_11 || sub_protocol==DSM_AUTO) // Force DSMX/1024 in mode Auto
|
||||||
packet[12]=0xb2; // DSMX/1024 2 packets
|
packet[12]=0xb2; // DSMX/1024 2 packets
|
||||||
@ -229,15 +228,15 @@ static void __attribute__((unused)) DSM_update_channels()
|
|||||||
{
|
{
|
||||||
prev_option=option;
|
prev_option=option;
|
||||||
if(sub_protocol==DSM_AUTO)
|
if(sub_protocol==DSM_AUTO)
|
||||||
DSM_num_ch=12; // Force 12 channels in mode Auto
|
num_ch=12; // Force 12 channels in mode Auto
|
||||||
else
|
else
|
||||||
DSM_num_ch=option;
|
num_ch=option;
|
||||||
if(DSM_num_ch<4 || DSM_num_ch>12)
|
if(num_ch<4 || num_ch>12)
|
||||||
DSM_num_ch=6; // Default to 6 channels if invalid choice...
|
num_ch=6; // Default to 6 channels if invalid choice...
|
||||||
|
|
||||||
// Create channel map based on number of channels and refresh rate
|
// Create channel map based on number of channels and refresh rate
|
||||||
uint8_t idx=DSM_num_ch-4;
|
uint8_t idx=num_ch-4;
|
||||||
if(DSM_num_ch>7 && DSM_num_ch<11 && (sub_protocol==DSM2_11 || sub_protocol==DSMX_11))
|
if(num_ch>7 && num_ch<11 && (sub_protocol==DSM2_11 || sub_protocol==DSMX_11))
|
||||||
idx+=5; // In 11ms mode change index only for channels 8..10
|
idx+=5; // In 11ms mode change index only for channels 8..10
|
||||||
for(uint8_t i=0;i<14;i++)
|
for(uint8_t i=0;i<14;i++)
|
||||||
ch_map[i]=pgm_read_byte_near(&DSM_ch_map_progmem[idx][i]);
|
ch_map[i]=pgm_read_byte_near(&DSM_ch_map_progmem[idx][i]);
|
||||||
@ -505,7 +504,7 @@ uint16_t ReadDsm()
|
|||||||
telemetry_link=1;
|
telemetry_link=1;
|
||||||
}
|
}
|
||||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation
|
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20); // Abort RX operation
|
||||||
if (phase == DSM_CH2_READ_A && (sub_protocol==DSM2_22 || sub_protocol==DSMX_22) && DSM_num_ch < 8) // 22ms mode
|
if (phase == DSM_CH2_READ_A && (sub_protocol==DSM2_22 || sub_protocol==DSMX_22) && num_ch < 8) // 22ms mode
|
||||||
{
|
{
|
||||||
CYRF_SetTxRxMode(RX_EN); // Force end state read
|
CYRF_SetTxRxMode(RX_EN); // Force end state read
|
||||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX operation
|
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX operation
|
||||||
@ -526,7 +525,7 @@ uint16_t ReadDsm()
|
|||||||
DSM_set_sop_data_crc();
|
DSM_set_sop_data_crc();
|
||||||
if (phase == DSM_CH2_CHECK_A)
|
if (phase == DSM_CH2_CHECK_A)
|
||||||
{
|
{
|
||||||
if(DSM_num_ch > 7 || sub_protocol==DSM2_11 || sub_protocol==DSMX_11)
|
if(num_ch > 7 || sub_protocol==DSM2_11 || sub_protocol==DSMX_11)
|
||||||
phase = DSM_CH1_WRITE_B; //11ms mode or upper to transmit change from CH2_CHECK_A to CH1_WRITE_A
|
phase = DSM_CH1_WRITE_B; //11ms mode or upper to transmit change from CH2_CHECK_A to CH1_WRITE_A
|
||||||
else
|
else
|
||||||
{ //Normal mode 22ms
|
{ //Normal mode 22ms
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "iface_cyrf6936.h"
|
#include "iface_cyrf6936.h"
|
||||||
|
|
||||||
#define DEVO_NUM_CHANNELS 8
|
|
||||||
|
|
||||||
//For Debug
|
//For Debug
|
||||||
//#define NO_SCRAMBLE
|
//#define NO_SCRAMBLE
|
||||||
|
|
||||||
@ -93,7 +91,7 @@ static void __attribute__((unused)) DEVO_add_pkt_suffix()
|
|||||||
|
|
||||||
static void __attribute__((unused)) DEVO_build_beacon_pkt(uint8_t upper)
|
static void __attribute__((unused)) DEVO_build_beacon_pkt(uint8_t upper)
|
||||||
{
|
{
|
||||||
packet[0] = (DEVO_NUM_CHANNELS << 4) | 0x07;
|
packet[0] = (num_ch << 4) | 0x07;
|
||||||
uint8_t max = 8, offset = 0, enable = 0;
|
uint8_t max = 8, offset = 0, enable = 0;
|
||||||
if (upper)
|
if (upper)
|
||||||
{
|
{
|
||||||
@ -105,7 +103,7 @@ static void __attribute__((unused)) DEVO_build_beacon_pkt(uint8_t upper)
|
|||||||
{
|
{
|
||||||
#ifdef FAILSAFE_ENABLE
|
#ifdef FAILSAFE_ENABLE
|
||||||
uint16_t failsafe=Failsafe_data[CH_EATR[i+offset]];
|
uint16_t failsafe=Failsafe_data[CH_EATR[i+offset]];
|
||||||
if(i + offset < DEVO_NUM_CHANNELS && failsafe!=FAILSAFE_CHANNEL_HOLD && IS_FAILSAFE_VALUES_on)
|
if(i + offset < num_ch && failsafe!=FAILSAFE_CHANNEL_HOLD && IS_FAILSAFE_VALUES_on)
|
||||||
{
|
{
|
||||||
enable |= 0x80 >> i;
|
enable |= 0x80 >> i;
|
||||||
packet[i+1] = ((failsafe*25)>>8)-100;
|
packet[i+1] = ((failsafe*25)>>8)-100;
|
||||||
@ -122,7 +120,7 @@ static void __attribute__((unused)) DEVO_build_beacon_pkt(uint8_t upper)
|
|||||||
|
|
||||||
static void __attribute__((unused)) DEVO_build_bind_pkt()
|
static void __attribute__((unused)) DEVO_build_bind_pkt()
|
||||||
{
|
{
|
||||||
packet[0] = (DEVO_NUM_CHANNELS << 4) | 0x0a;
|
packet[0] = (num_ch << 4) | 0x0a;
|
||||||
packet[1] = bind_counter & 0xff;
|
packet[1] = bind_counter & 0xff;
|
||||||
packet[2] = (bind_counter >> 8);
|
packet[2] = (bind_counter >> 8);
|
||||||
packet[3] = *hopping_frequency_ptr;
|
packet[3] = *hopping_frequency_ptr;
|
||||||
@ -144,7 +142,7 @@ static void __attribute__((unused)) DEVO_build_data_pkt()
|
|||||||
{
|
{
|
||||||
static uint8_t ch_idx=0;
|
static uint8_t ch_idx=0;
|
||||||
|
|
||||||
packet[0] = (DEVO_NUM_CHANNELS << 4) | (0x0b + ch_idx);
|
packet[0] = (num_ch << 4) | (0x0b + ch_idx);
|
||||||
uint8_t sign = 0x0b;
|
uint8_t sign = 0x0b;
|
||||||
for (uint8_t i = 0; i < 4; i++)
|
for (uint8_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@ -159,7 +157,7 @@ static void __attribute__((unused)) DEVO_build_data_pkt()
|
|||||||
}
|
}
|
||||||
packet[9] = sign;
|
packet[9] = sign;
|
||||||
ch_idx++;
|
ch_idx++;
|
||||||
if (ch_idx * 4 >= DEVO_NUM_CHANNELS)
|
if (ch_idx * 4 >= num_ch)
|
||||||
ch_idx = 0;
|
ch_idx = 0;
|
||||||
DEVO_add_pkt_suffix();
|
DEVO_add_pkt_suffix();
|
||||||
}
|
}
|
||||||
@ -258,7 +256,7 @@ static void __attribute__((unused)) DEVO_BuildPacket()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEVO_BOUND_10:
|
case DEVO_BOUND_10:
|
||||||
DEVO_build_beacon_pkt(DEVO_NUM_CHANNELS > 8 ? failsafe_pkt : 0);
|
DEVO_build_beacon_pkt(num_ch > 8 ? failsafe_pkt : 0);
|
||||||
failsafe_pkt = failsafe_pkt ? 0 : 1;
|
failsafe_pkt = failsafe_pkt ? 0 : 1;
|
||||||
DEVO_scramble_pkt();
|
DEVO_scramble_pkt();
|
||||||
phase = DEVO_BOUND_1;
|
phase = DEVO_BOUND_1;
|
||||||
@ -301,6 +299,24 @@ uint16_t devo_callback()
|
|||||||
|
|
||||||
uint16_t DevoInit()
|
uint16_t DevoInit()
|
||||||
{
|
{
|
||||||
|
switch(sub_protocol)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
num_ch=10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
num_ch=12;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
num_ch=6;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
num_ch=7;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
num_ch=8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
DEVO_cyrf_init();
|
DEVO_cyrf_init();
|
||||||
CYRF_GetMfgData(cyrfmfg_id);
|
CYRF_GetMfgData(cyrfmfg_id);
|
||||||
CYRF_SetTxRxMode(TX_EN);
|
CYRF_SetTxRxMode(TX_EN);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
4,Hisky,Hisky,HK310
|
4,Hisky,Hisky,HK310
|
||||||
5,V2x2,V2x2,JXD506
|
5,V2x2,V2x2,JXD506
|
||||||
6,DSM,DSM2-22,DSM2-11,DSMX-22,DSMX-11,AUTO
|
6,DSM,DSM2-22,DSM2-11,DSMX-22,DSMX-11,AUTO
|
||||||
7,Devo
|
7,Devo,8CH,10CH,12CH,6CH,7CH
|
||||||
8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI
|
8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI
|
||||||
9,KN,WLTOYS,FEILUN
|
9,KN,WLTOYS,FEILUN
|
||||||
10,SymaX,SYMAX,SYMAX5C
|
10,SymaX,SYMAX,SYMAX5C
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_REVISION 1
|
#define VERSION_REVISION 1
|
||||||
#define VERSION_PATCH_LEVEL 63
|
#define VERSION_PATCH_LEVEL 64
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
|
@ -111,6 +111,7 @@ uint16_t failsafe_count;
|
|||||||
uint16_t state;
|
uint16_t state;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint8_t armed, arm_flags, arm_channel_previous;
|
uint8_t armed, arm_flags, arm_channel_previous;
|
||||||
|
uint8_t num_ch;
|
||||||
|
|
||||||
#ifdef CC2500_INSTALLED
|
#ifdef CC2500_INSTALLED
|
||||||
uint8_t calData[50];
|
uint8_t calData[50];
|
||||||
|
@ -76,7 +76,7 @@ CFlie|38|CFlie||||||||NRF24L01
|
|||||||
[CG023](Protocols_Details.md#CG023---13)|13|CG023|YD829|||||||NRF24L01
|
[CG023](Protocols_Details.md#CG023---13)|13|CG023|YD829|||||||NRF24L01
|
||||||
[Corona](Protocols_Details.md#CORONA---37)|37|COR_V1|COR_V2|FD_V3||||||CC2500
|
[Corona](Protocols_Details.md#CORONA---37)|37|COR_V1|COR_V2|FD_V3||||||CC2500
|
||||||
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01
|
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01
|
||||||
[Devo](Protocols_Details.md#DEVO---7)|7|Devo||||||||CYRF6936
|
[Devo](Protocols_Details.md#DEVO---7)|7|Devo|8CH|10CH|12CH|6CH|7CH|||CYRF6936
|
||||||
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01
|
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01
|
||||||
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936
|
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936
|
||||||
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01
|
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01
|
||||||
@ -402,6 +402,12 @@ Bind procedure using PPM:
|
|||||||
- To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink).
|
- To verify that the TX is in fixed mode: power cycle the TX, the module LED should be solid ON (no blink).
|
||||||
- Note: Autobind/fixed ID mode is linked to the RX_Num number. Which means that you can have multiple dial numbers set to the same protocol DEVO with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match under DEVO.
|
- Note: Autobind/fixed ID mode is linked to the RX_Num number. Which means that you can have multiple dial numbers set to the same protocol DEVO with different RX_Num and have different bind modes at the same time. It enables PPM users to get model match under DEVO.
|
||||||
|
|
||||||
|
### Sub_protocol 8CH - *0*
|
||||||
|
### Sub_protocol 10CH - *1*
|
||||||
|
### Sub_protocol 12CH - *2*
|
||||||
|
### Sub_protocol 6CH - *3*
|
||||||
|
### Sub_protocol 7CH - *4*
|
||||||
|
|
||||||
## WK2X01 - *30*
|
## WK2X01 - *30*
|
||||||
Extended limits supported
|
Extended limits supported
|
||||||
Autobind protocol
|
Autobind protocol
|
||||||
|
Loading…
x
Reference in New Issue
Block a user