Fix a bug introduced with Alpha protocols ordering

This commit is contained in:
Pascal Langer 2020-04-21 11:43:48 +02:00
parent 4ae30dc3b0
commit 53c0637a85
5 changed files with 43 additions and 36 deletions

View File

@ -44,7 +44,7 @@
44,NCC1701 44,NCC1701
45,E01X,E012,E015,E016H 45,E01X,E012,E015,E016H
46,V911S,V911S,E119 46,V911S,V911S,E119
47,GD00X,GD_V1,GD_V2 47,GD00x,GD_V1,GD_V2
48,V761 48,V761
49,KF606 49,KF606
50,Redpine,Fast,Slow 50,Redpine,Fast,Slow

View File

@ -62,7 +62,7 @@ const char STR_TRAXXAS[] ="Traxxas";
const char STR_NCC1701[] ="NCC1701"; const char STR_NCC1701[] ="NCC1701";
const char STR_E01X[] ="E01X"; const char STR_E01X[] ="E01X";
const char STR_V911S[] ="V911S"; const char STR_V911S[] ="V911S";
const char STR_GD00X[] ="GD00X"; const char STR_GD00X[] ="GD00x";
const char STR_V761[] ="V761"; const char STR_V761[] ="V761";
const char STR_KF606[] ="KF606"; const char STR_KF606[] ="KF606";
const char STR_REDPINE[] ="Redpine"; const char STR_REDPINE[] ="Redpine";
@ -128,6 +128,7 @@ const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z"; const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z";
const char STR_SUBTYPE_FRSKY_RX[] = "\x07""RX\0 ""CloneTX"; const char STR_SUBTYPE_FRSKY_RX[] = "\x07""RX\0 ""CloneTX";
const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch"; const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch";
const char STR_SUBTYPE_WFLY[] = "\x06""WFR0xS";
enum enum
{ {
@ -330,7 +331,7 @@ const mm_protocol_definition multi_protocols[] = {
{PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE }, {PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE },
#endif #endif
#if defined(WFLY_CYRF6936_INO) #if defined(WFLY_CYRF6936_INO)
{PROTO_WFLY, STR_WFLY, 0, NO_SUBTYPE, OPTION_NONE }, {PROTO_WFLY, STR_WFLY, 1, STR_SUBTYPE_WFLY, OPTION_NONE },
#endif #endif
#if defined(WK2x01_CYRF6936_INO) #if defined(WK2x01_CYRF6936_INO)
{PROTO_WK2x01, STR_WK2x01, 6, STR_SUBTYPE_WK2x01, OPTION_NONE }, {PROTO_WK2x01, STR_WK2x01, 6, STR_SUBTYPE_WK2x01, OPTION_NONE },
@ -350,7 +351,4 @@ const mm_protocol_definition multi_protocols[] = {
{0x00, nullptr, 0, nullptr, 0 } {0x00, nullptr, 0, nullptr, 0 }
}; };
#endif #endif

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_REVISION 0 #define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 89 #define VERSION_PATCH_LEVEL 90
//****************** //******************
// Protocols // Protocols
@ -1036,7 +1036,8 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
OPTION_RFCHAN 8 OPTION_RFCHAN 8
[19&0x0F] Number of sub protocols [19&0x0F] Number of sub protocols
[20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8 [20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8
If the current protocol is invalid [12..27] are all 0x00.
more information can be added by specifing a longer length of the type, the TX will just ignore these bytes more information can be added by specifing a longer length of the type, the TX will just ignore these bytes
Type 0x02 Frksy S.port telemetry Type 0x02 Frksy S.port telemetry

View File

@ -140,7 +140,7 @@ static void multi_send_status()
{ {
flags |= 0x04; flags |= 0x04;
#ifdef MULTI_NAMES #ifdef MULTI_NAMES
if(multi_protocols_index == 0xFF||remote_callback==0) if(multi_protocols_index == 0xFF)
flags &= ~0x04; //Invalid protocol flags &= ~0x04; //Invalid protocol
else if(sub_protocol&0x07) else if(sub_protocol&0x07)
{ {
@ -181,33 +181,41 @@ static void multi_send_status()
#endif #endif
#ifdef MULTI_NAMES #ifdef MULTI_NAMES
if(multi_protocols_index == 0xFF) // selection out of list... send first available protocol if(multi_protocols_index == 0xFF) // selection out of list... send first available protocol
multi_protocols_index=0;
// Protocol next/prev
if(multi_protocols[multi_protocols_index+1].protocol != 0)
Serial_write(multi_protocols[multi_protocols_index+1].protocol); // next protocol number
else
Serial_write(multi_protocols[multi_protocols_index].protocol); // end of list
if(multi_protocols_index>0)
Serial_write(multi_protocols[multi_protocols_index-1].protocol); // prev protocol number
else
Serial_write(multi_protocols[multi_protocols_index].protocol); // begining of list
// Protocol
for(uint8_t i=0;i<7;i++)
Serial_write(multi_protocols[multi_protocols_index].ProtoString[i]); // protocol name
// Sub-protocol
uint8_t nbr=multi_protocols[multi_protocols_index].nbrSubProto;
Serial_write(nbr | (multi_protocols[multi_protocols_index].optionType<<4)); // number of sub protocols && option type
uint8_t j=0;
if(nbr && (sub_protocol&0x07)<nbr)
{ {
uint8_t len=multi_protocols[multi_protocols_index].SubProtoString[0]; Serial_write(multi_protocols[0].protocol); // begining of list
uint8_t offset=len*(sub_protocol&0x07)+1; Serial_write(multi_protocols[0].protocol); // begining of list
for(;j<len;j++) for(uint8_t i=0;i<16;i++)
Serial_write(multi_protocols[multi_protocols_index].SubProtoString[j+offset]); // current sub protocol name Serial_write(0x00); // everything else is invalid
}
else
{
// Protocol next/prev
if(multi_protocols[multi_protocols_index+1].protocol != 0)
Serial_write(multi_protocols[multi_protocols_index+1].protocol); // next protocol number
else
Serial_write(multi_protocols[multi_protocols_index].protocol); // end of list
if(multi_protocols_index>0)
Serial_write(multi_protocols[multi_protocols_index-1].protocol); // prev protocol number
else
Serial_write(multi_protocols[multi_protocols_index].protocol); // begining of list
// Protocol
for(uint8_t i=0;i<7;i++)
Serial_write(multi_protocols[multi_protocols_index].ProtoString[i]); // protocol name
// Sub-protocol
uint8_t nbr=multi_protocols[multi_protocols_index].nbrSubProto;
Serial_write(nbr | (multi_protocols[multi_protocols_index].optionType<<4)); // number of sub protocols && option type
uint8_t j=0;
if(nbr && (sub_protocol&0x07)<nbr)
{
uint8_t len=multi_protocols[multi_protocols_index].SubProtoString[0];
uint8_t offset=len*(sub_protocol&0x07)+1;
for(;j<len;j++)
Serial_write(multi_protocols[multi_protocols_index].SubProtoString[j+offset]); // current sub protocol name
}
for(;j<8;j++)
Serial_write(0x00);
} }
for(;j<8;j++)
Serial_write(0x00);
// Channels function // Channels function
//TODO //TODO
#endif #endif

View File

@ -1254,7 +1254,7 @@ Model: Shenqiwei 1/20 Mini Motorcycle
CH1|CH2|CH3|CH4 CH1|CH2|CH3|CH4
---|---|---|--- ---|---|---|---
| |T|R -|-|T|R
Throttle +100%=full forward,0%=stop,-100%=full backward. Throttle +100%=full forward,0%=stop,-100%=full backward.
@ -1438,7 +1438,7 @@ Autobind protocol
CH1|CH2|CH3|CH4|CH5 CH1|CH2|CH3|CH4|CH5
---|---|---|---|--- ---|---|---|---|---
||T|R|LIGHT -|-|T|R|LIGHT
# SX1276 RF Module # SX1276 RF Module