Added collectivepitch throttle channel swap option needed for JR Graupner PPM Transmitters

This commit is contained in:
Open UAS 2019-07-31 14:20:58 +02:00 committed by none
parent d3c82c4da4
commit faaae0865c
6 changed files with 63 additions and 22 deletions

View File

@ -70,7 +70,7 @@ uint8_t convert_channel_8b_limit_deadband(uint8_t num,uint8_t min,uint8_t mid, u
return val; return val;
} }
// Revert a channel and store it // Reverse a channel and store it
void reverse_channel(uint8_t num) void reverse_channel(uint8_t num)
{ {
uint16_t val=2048-Channel_data[num]; uint16_t val=2048-Channel_data[num];

View File

@ -102,7 +102,15 @@ static void __attribute__((unused)) DEVO_build_beacon_pkt(uint8_t upper)
for(uint8_t i = 0; i < max; i++) for(uint8_t i = 0; i < max; i++)
{ {
#ifdef FAILSAFE_ENABLE #ifdef FAILSAFE_ENABLE
uint16_t failsafe=Failsafe_data[CH_EATR[i+offset]]; uint16_t failsafe;
#ifdef ENABLE_PPM
if (sub_protocol==DEVO_JR_HELI) failsafe=Failsafe_data[CH_EATR_JR_HELI[i+offset]];
else failsafe=Failsafe_data[CH_EATR[i+offset]];
#else
failsafe=Failsafe_data[CH_EATR[i+offset]];
#endif //ENABLE_PPM
if(i + offset < num_ch && 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;
@ -146,7 +154,13 @@ static void __attribute__((unused)) DEVO_build_data_pkt()
uint8_t sign = 0x0b; uint8_t sign = 0x0b;
for (uint8_t i = 0; i < 4; i++) for (uint8_t i = 0; i < 4; i++)
{ {
int16_t value=convert_channel_16b_nolimit(CH_EATR[ch_idx * 4 + i],-1600,1600);//range -1600..+1600 int16_t value;
#ifdef ENABLE_PPM
if (sub_protocol==DEVO_JR_HELI) value=convert_channel_16b_nolimit(CH_EATR_JR_HELI[ch_idx * 4 + i],-1600,1600);//range -1600..+1600
else value=convert_channel_16b_nolimit(CH_EATR[ch_idx * 4 + i],-1600,1600);//range -1600..+1600
#else
value=convert_channel_16b_nolimit(CH_EATR[ch_idx * 4 + i],-1600,1600);//range -1600..+1600
#endif //ENABLE_PPM
if(value < 0) if(value < 0)
{ {
value = -value; value = -value;
@ -299,6 +313,10 @@ uint16_t devo_callback()
uint16_t DevoInit() uint16_t DevoInit()
{ {
//FIXME: this should be the default one IMHO, no sub_protocols misuse for NR of channels, but the option flag like in DSM protocol
#ifdef NEW_DEVO_NR_OF_CHANNELS_BEHAVIOUR
if (option == 10 || option == 12 || option == 6 || option == 7) num_ch=option else num_ch=8;//Throw away erronous config values
#else
switch(sub_protocol) switch(sub_protocol)
{ {
case 1: case 1:
@ -313,10 +331,14 @@ uint16_t DevoInit()
case 4: case 4:
num_ch=7; num_ch=7;
break; break;
case 5:
num_ch=7;//Specific JR HELI mode has input collective on 0 Throttle on 5, the CAERxT
default: default:
num_ch=8; num_ch=8;
break; break;
} }
#endif //NEW_DEVO_NR_OF_CHANNELS_BEHAVIOUR
DEVO_cyrf_init(); DEVO_cyrf_init();
CYRF_GetMfgData(cyrfmfg_id); CYRF_GetMfgData(cyrfmfg_id);
CYRF_SetTxRxMode(TX_EN); CYRF_SetTxRxMode(TX_EN);

View File

@ -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 67 #define VERSION_PATCH_LEVEL 68
//****************** //******************
// Protocols // Protocols
@ -115,6 +115,15 @@ enum DSM
DSMX_11 = 3, DSMX_11 = 3,
DSM_AUTO = 4, DSM_AUTO = 4,
}; };
enum DEVO
{
DEVO_CH6 = 3,
DEVO_CH7 = 4,
DEVO_CH8 = 0,
DEVO_CH10 = 1,
DEVO_CH12 = 2,
DEVO_JR_HELI= 5,
};
enum YD717 enum YD717
{ {
YD717 = 0, YD717 = 0,
@ -647,6 +656,13 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
DSMX_22 2 DSMX_22 2
DSMX_11 3 DSMX_11 3
DSM_AUTO 4 DSM_AUTO 4
sub_protocol==DEVO
DEVO_CH6 3
DEVO_CH7 4
DEVO_CH8 0
DEVO_CH10 1
DEVO_CH12 2
DEVO_JR_HELI 5 // Specific JR HELI mode PPM output has collective on CH0 Throttle on CH5, the CAERxT
sub_protocol==YD717 sub_protocol==YD717
YD717 0 YD717 0
SKYWLKR 1 SKYWLKR 1

View File

@ -135,6 +135,8 @@ const uint8_t CH_TAER[]={THROTTLE, AILERON, ELEVATOR, RUDDER, CH5, CH6, CH7, CH8
const uint8_t CH_RETA[]={RUDDER, ELEVATOR, THROTTLE, AILERON, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16}; const uint8_t CH_RETA[]={RUDDER, ELEVATOR, THROTTLE, AILERON, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16};
const uint8_t CH_EATR[]={ELEVATOR, AILERON, THROTTLE, RUDDER, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16}; const uint8_t CH_EATR[]={ELEVATOR, AILERON, THROTTLE, RUDDER, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16};
const uint8_t CH_EATR_JR_HELI[]={2, 1, 5, 3, 4, 0, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16};
// Mode_select variables // Mode_select variables
uint8_t mode_select; uint8_t mode_select;
uint8_t protocol_flags=0,protocol_flags2=0; uint8_t protocol_flags=0,protocol_flags2=0;

View File

@ -46,6 +46,24 @@
#define CHANNEL_SWITCH 1104 // 1550us #define CHANNEL_SWITCH 1104 // 1550us
#define CHANNEL_MAX_COMMAND 1424 // 1750us #define CHANNEL_MAX_COMMAND 1424 // 1750us
//Fixed output definitions
#define CH1 0
#define CH2 1
#define CH3 2
#define CH4 3
#define CH5 4
#define CH6 5
#define CH7 6
#define CH8 7
#define CH9 8
#define CH10 9
#define CH11 10
#define CH12 11
#define CH13 12
#define CH14 13
#define CH15 14
#define CH16 15
//Channel definitions //Channel definitions
#ifdef AETR #ifdef AETR
#define AILERON 0 #define AILERON 0
@ -194,20 +212,3 @@
#define THROTTLE 1 #define THROTTLE 1
#define RUDDER 0 #define RUDDER 0
#endif #endif
#define CH1 0
#define CH2 1
#define CH3 2
#define CH4 3
#define CH5 4
#define CH6 5
#define CH7 6
#define CH8 7
#define CH9 8
#define CH10 9
#define CH11 10
#define CH12 11
#define CH13 12
#define CH14 13
#define CH15 14
#define CH16 15

View File

@ -18,7 +18,7 @@
#endif #endif
#endif #endif
// Check for minimum version of multi-module boards // Check for minimum board file definition version for DIY multi-module boards
#define MIN_AVR_BOARD 107 #define MIN_AVR_BOARD 107
#define MIN_ORX_BOARD 107 #define MIN_ORX_BOARD 107
#define MIN_STM32_BOARD 114 #define MIN_STM32_BOARD 114