mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 12:38:11 +00:00
Multi Status: send frame as soon as a new protocol is selected
This commit is contained in:
parent
d6ecac1302
commit
016b282246
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_REVISION 2
|
||||
#define VERSION_PATCH_LEVEL 96
|
||||
#define VERSION_PATCH_LEVEL 97
|
||||
|
||||
#define MODE_SERIAL 0
|
||||
|
||||
|
@ -765,6 +765,17 @@ void End_Bind()
|
||||
bind_counter=2;
|
||||
}
|
||||
|
||||
void Update_Telem()
|
||||
{
|
||||
#if defined(TELEMETRY)
|
||||
#ifndef MULTI_TELEMETRY
|
||||
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_PROPEL) || (protocol==PROTO_OMP) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX) || (protocol==PROTO_FRSKY_R9) || (protocol==PROTO_RLINK) || (protocol==PROTO_WFLY2) || (protocol==PROTO_LOLI) || (protocol==PROTO_MLINK) || (protocol==PROTO_MT99XX))
|
||||
#endif
|
||||
if(IS_DISABLE_TELEM_off)
|
||||
TelemetryUpdate();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Update_All()
|
||||
{
|
||||
#ifdef ENABLE_SERIAL
|
||||
@ -855,13 +866,9 @@ bool Update_All()
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(TELEMETRY)
|
||||
#ifndef MULTI_TELEMETRY
|
||||
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_PROPEL) || (protocol==PROTO_OMP) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX) || (protocol==PROTO_FRSKY_R9) || (protocol==PROTO_RLINK) || (protocol==PROTO_WFLY2) || (protocol==PROTO_LOLI) || (protocol==PROTO_MLINK) || (protocol==PROTO_MT99XX))
|
||||
#endif
|
||||
if(IS_DISABLE_TELEM_off)
|
||||
TelemetryUpdate();
|
||||
#endif
|
||||
|
||||
Update_Telem();
|
||||
|
||||
#ifdef ENABLE_BIND_CH
|
||||
if(IS_AUTOBIND_FLAG_on && IS_BIND_CH_PREV_off && Channel_data[BIND_CH-1]>CHANNEL_MAX_COMMAND)
|
||||
{ // Autobind is on and BIND_CH went up
|
||||
@ -1204,7 +1211,6 @@ static void protocol_init()
|
||||
//Save call back function address
|
||||
remote_callback = multi_protocols[multi_protocols_index].CallBack;
|
||||
//Send a telemetry status right now
|
||||
SEND_MULTI_STATUS_on;
|
||||
#ifdef DEBUG_SERIAL
|
||||
debug("Proto=%s",multi_protocols[multi_protocols_index].ProtoString);
|
||||
uint8_t nbr=multi_protocols[multi_protocols_index].nbrSubProto;
|
||||
@ -1225,6 +1231,9 @@ static void protocol_init()
|
||||
}
|
||||
index++;
|
||||
}
|
||||
//Send an update right away
|
||||
SEND_MULTI_STATUS_on;
|
||||
Update_Telem();
|
||||
}
|
||||
|
||||
#if defined(WAIT_FOR_BIND) && defined(ENABLE_BIND_CH)
|
||||
@ -1520,7 +1529,9 @@ void update_serial_data()
|
||||
if ( used >= MAX_SPORT_BUFFER-(MAX_SPORT_BUFFER>>2) )
|
||||
{
|
||||
DATA_BUFFER_LOW_on;
|
||||
SEND_MULTI_STATUS_on; //Send Multi Status ASAP to inform the TX
|
||||
//Send Multi Status ASAP to inform the TX
|
||||
SEND_MULTI_STATUS_on;
|
||||
Update_Telem();
|
||||
debugln("Low buf=%d,h=%d,t=%d",used,SportHead,SportTail);
|
||||
}
|
||||
}
|
||||
|
@ -56,20 +56,20 @@ static void __attribute__((unused)) XERALL_send_packet()
|
||||
if(IS_BIND_IN_PROGRESS)
|
||||
{
|
||||
if(packet_sent > 24)
|
||||
packet_sent=0; // Hopp after 25 packets
|
||||
packet_sent=0; // Hopp after 25 packets
|
||||
}
|
||||
else
|
||||
{
|
||||
if(packet_sent > 18)
|
||||
packet_sent = 0; // Hopp after 19 packets
|
||||
packet_sent = 0; // Hopp after 19 packets
|
||||
}
|
||||
|
||||
// Packet
|
||||
if(IS_BIND_IN_PROGRESS && (bind_counter&0x10)) // Alternate bind and normal packets
|
||||
if(IS_BIND_IN_PROGRESS && (bind_counter&0x10)) // Alternate bind and normal packets
|
||||
{ // Bind packet: 01 56 06 23 00 13 20 40 02 00 and 01 F9 58 31 00 13 20 40 05 00
|
||||
if(packet[0] != 0x01)
|
||||
{
|
||||
XN297_SetTXAddr((uint8_t *)"\x01\x01\x01\x01\x09", 5); // Bind address
|
||||
XN297_SetTXAddr((uint8_t *)"\x01\x01\x01\x01\x09", 5); // Bind address
|
||||
XN297_SetRXAddr((uint8_t *)"\x01\x01\x01\x01\x09", XERALL_PACKET_SIZE);
|
||||
}
|
||||
packet[0] = 0x01;
|
||||
|
Loading…
x
Reference in New Issue
Block a user