mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 21:48:12 +00:00
MULTI_TELEMETRY: couple of additions
This commit is contained in:
parent
c6221fc60f
commit
f56c9deb00
@ -13,6 +13,13 @@
|
|||||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//******************
|
||||||
|
// Version
|
||||||
|
//******************
|
||||||
|
#define VERSION_MAJOR 1
|
||||||
|
#define VERSION_MINOR 16
|
||||||
|
#define VERSION_PATCH_LEVEL 1
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
//******************
|
//******************
|
||||||
@ -565,7 +572,7 @@ Type = 0x01 Multimodule Status:
|
|||||||
0x04 = protocol is valid
|
0x04 = protocol is valid
|
||||||
0x08 = module is in binding mode
|
0x08 = module is in binding mode
|
||||||
[5] major
|
[5] major
|
||||||
[6] mior
|
[6] minor
|
||||||
[7-8] patchlevel
|
[7-8] patchlevel
|
||||||
version of multi code, should be displayed as major.minor.patchlevel
|
version of multi code, should be displayed as major.minor.patchlevel
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ void Update_All()
|
|||||||
update_channels_aux();
|
update_channels_aux();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
#if !defined(MULTI_TELEMETRY)
|
#if !defined(MULTI_TELEMETRY)
|
||||||
if((protocol==MODE_FRSKYD) || (protocol==MODE_BAYANG) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) )
|
if((protocol==MODE_FRSKYD) || (protocol==MODE_BAYANG) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_FRSKYX) || (protocol==MODE_DSM) )
|
||||||
#endif
|
#endif
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
#endif
|
#endif
|
||||||
@ -1004,12 +1004,21 @@ void Mprotocol_serial_init()
|
|||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
void PPM_Telemetry_serial_init()
|
void PPM_Telemetry_serial_init()
|
||||||
{
|
{
|
||||||
if( (protocol==MODE_FRSKYD) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_BAYANG) )
|
#ifdef MULTI_TELEMETRY
|
||||||
initTXSerial( SPEED_9600 ) ;
|
Mprotocol_serial_init();
|
||||||
if(protocol==MODE_FRSKYX)
|
#ifndef ORANGE_TX
|
||||||
initTXSerial( SPEED_57600 ) ;
|
#ifndef STM32_BOARD
|
||||||
if(protocol==MODE_DSM)
|
UCSR0B &= ~(_BV(RXEN0)|_BV(RXCIE0));//rx disable and interrupt
|
||||||
initTXSerial( SPEED_125K ) ;
|
#endif
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
if( (protocol==MODE_FRSKYD) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_BAYANG) )
|
||||||
|
initTXSerial( SPEED_9600 ) ;
|
||||||
|
if(protocol==MODE_FRSKYX)
|
||||||
|
initTXSerial( SPEED_57600 ) ;
|
||||||
|
if(protocol==MODE_DSM)
|
||||||
|
initTXSerial( SPEED_125K ) ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ static void multi_send_status()
|
|||||||
multi_send_header(MULTI_TELEMETRY_STATUS, 5);
|
multi_send_header(MULTI_TELEMETRY_STATUS, 5);
|
||||||
|
|
||||||
// Build flags
|
// Build flags
|
||||||
uint8_t flags;
|
uint8_t flags=0;
|
||||||
if (millis()-last_signal<70)
|
if (IS_INPUT_SIGNAL_on)
|
||||||
flags |= 0x01;
|
flags |= 0x01;
|
||||||
if (mode_select==MODE_SERIAL)
|
if (mode_select==MODE_SERIAL)
|
||||||
flags |= 0x02;
|
flags |= 0x02;
|
||||||
@ -89,50 +89,50 @@ static void multi_send_status()
|
|||||||
flags |= 0x08;
|
flags |= 0x08;
|
||||||
Serial_write(flags);
|
Serial_write(flags);
|
||||||
|
|
||||||
// Version number: 1.15.0
|
// Version number example: 1.16.1
|
||||||
Serial_write(1);
|
Serial_write(VERSION_MAJOR);
|
||||||
Serial_write(15);
|
Serial_write(VERSION_MINOR);
|
||||||
Serial_write(0);
|
Serial_write(VERSION_PATCH_LEVEL);
|
||||||
Serial_write(0);
|
Serial_write(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DSM_TELEMETRY
|
#ifdef DSM_TELEMETRY
|
||||||
#if defined MULTI_TELEMETRY
|
#ifdef MULTI_TELEMETRY
|
||||||
void DSM_frame()
|
void DSM_frame()
|
||||||
{
|
{
|
||||||
if (pkt[0] == 0x80) {
|
if (pkt[0] == 0x80) {
|
||||||
multi_send_header(MULTI_TELEMETRY_DSMBIND, 10);
|
multi_send_header(MULTI_TELEMETRY_DSMBIND, 10);
|
||||||
for (uint8_t i = 1; i < 11; i++) // 10 byte of DSM bind response
|
for (uint8_t i = 1; i < 11; i++) // 10 byte of DSM bind response
|
||||||
Serial_write(pkt[i]);
|
Serial_write(pkt[i]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
multi_send_header(MULTI_TELEMETRY_DSM, 17);
|
multi_send_header(MULTI_TELEMETRY_DSM, 17);
|
||||||
for (uint8_t i = 0; i < 29; i++) // RSSI value followed by 4*7 bytes of telemetry data
|
for (uint8_t i = 0; i < 29; i++) // RSSI value followed by 4*7 bytes of telemetry data
|
||||||
Serial_write(pkt[i]);
|
Serial_write(pkt[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void DSM_frame()
|
void DSM_frame()
|
||||||
{
|
{
|
||||||
Serial_write(0xAA); // Telemetry packet
|
Serial_write(0xAA); // Telemetry packet
|
||||||
for (uint8_t i = 0; i < 17; i++) // RSSI value followed by 16 bytes of telemetry data
|
for (uint8_t i = 0; i < 17; i++) // RSSI value followed by 16 bytes of telemetry data
|
||||||
Serial_write(pkt[i]);
|
Serial_write(pkt[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AFHDS2A_FW_TELEMETRY
|
#ifdef AFHDS2A_FW_TELEMETRY
|
||||||
void AFHDSA_short_frame()
|
void AFHDSA_short_frame()
|
||||||
{
|
{
|
||||||
#if defined MULTI_TELEMETRY
|
#if defined MULTI_TELEMETRY
|
||||||
multi_send_header(MULTI_TELEMETRY_AFHDS2A, 29);
|
multi_send_header(MULTI_TELEMETRY_AFHDS2A, 29);
|
||||||
#else
|
#else
|
||||||
Serial_write(0xAA); // Telemetry packet
|
Serial_write(0xAA); // Telemetry packet
|
||||||
#endif
|
#endif
|
||||||
for (uint8_t i = 0; i < 29; i++) // RSSI value followed by 4*7 bytes of telemetry data
|
for (uint8_t i = 0; i < 29; i++) // RSSI value followed by 4*7 bytes of telemetry data
|
||||||
Serial_write(pkt[i]);
|
Serial_write(pkt[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void frskySendStuffed()
|
void frskySendStuffed()
|
||||||
@ -222,11 +222,11 @@ void frsky_link_frame()
|
|||||||
frame[4] = TX_RSSI;
|
frame[4] = TX_RSSI;
|
||||||
}
|
}
|
||||||
frame[5] = frame[6] = frame[7] = frame[8] = 0;
|
frame[5] = frame[6] = frame[7] = frame[8] = 0;
|
||||||
#if defined MULTI_TELEMETRY
|
#if defined MULTI_TELEMETRY
|
||||||
multi_send_frskyhub();
|
multi_send_frskyhub();
|
||||||
#else
|
#else
|
||||||
frskySendStuffed();
|
frskySendStuffed();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined HUB_TELEMETRY
|
#if defined HUB_TELEMETRY
|
||||||
@ -292,11 +292,11 @@ void frsky_user_frame()
|
|||||||
if(!indx)
|
if(!indx)
|
||||||
return;
|
return;
|
||||||
frame[1] = indx;
|
frame[1] = indx;
|
||||||
#if defined MULTI_TELEMETRY
|
#if defined MULTI_TELEMETRY
|
||||||
multi_send_frskyhub();
|
multi_send_frskyhub();
|
||||||
#else
|
#else
|
||||||
frskySendStuffed();
|
frskySendStuffed();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pass=0;
|
pass=0;
|
||||||
@ -368,60 +368,59 @@ pkt[6]|(counter++)|00 01 02 03 04 05 06 07 08 09
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
#ifdef MULTI_TELEMETRY
|
#ifdef MULTI_TELEMETRY
|
||||||
void sportSend(uint8_t *p)
|
void sportSend(uint8_t *p)
|
||||||
{
|
|
||||||
multi_send_header(MULTI_TELEMETRY_SPORT, 9);
|
|
||||||
uint16_t crc_s = 0;
|
|
||||||
Serial_write(p[0]) ;
|
|
||||||
for (uint8_t i = 1; i < 9; i++)
|
|
||||||
{
|
{
|
||||||
if (i == 8)
|
multi_send_header(MULTI_TELEMETRY_SPORT, 9);
|
||||||
p[i] = 0xff - crc_s;
|
uint16_t crc_s = 0;
|
||||||
Serial_write(p[i]);
|
Serial_write(p[0]) ;
|
||||||
|
for (uint8_t i = 1; i < 9; i++)
|
||||||
if (i>0)
|
|
||||||
{
|
{
|
||||||
crc_s += p[i]; //0-1FF
|
if (i == 8)
|
||||||
crc_s += crc_s >> 8; //0-100
|
p[i] = 0xff - crc_s;
|
||||||
crc_s &= 0x00ff;
|
Serial_write(p[i]);
|
||||||
|
|
||||||
|
if (i>0)
|
||||||
|
{
|
||||||
|
crc_s += p[i]; //0-1FF
|
||||||
|
crc_s += crc_s >> 8; //0-100
|
||||||
|
crc_s &= 0x00ff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void sportSend(uint8_t *p)
|
void sportSend(uint8_t *p)
|
||||||
{
|
|
||||||
uint16_t crc_s = 0;
|
|
||||||
Serial_write(START_STOP);//+9
|
|
||||||
Serial_write(p[0]) ;
|
|
||||||
for (uint8_t i = 1; i < 9; i++)
|
|
||||||
{
|
{
|
||||||
if (i == 8)
|
uint16_t crc_s = 0;
|
||||||
p[i] = 0xff - crc_s;
|
Serial_write(START_STOP);//+9
|
||||||
|
Serial_write(p[0]) ;
|
||||||
if ((p[i] == START_STOP) || (p[i] == BYTESTUFF))
|
for (uint8_t i = 1; i < 9; i++)
|
||||||
{
|
{
|
||||||
Serial_write(BYTESTUFF);//stuff again
|
if (i == 8)
|
||||||
Serial_write(STUFF_MASK ^ p[i]);
|
p[i] = 0xff - crc_s;
|
||||||
}
|
|
||||||
else
|
|
||||||
Serial_write(p[i]);
|
|
||||||
|
|
||||||
if (i>0)
|
if ((p[i] == START_STOP) || (p[i] == BYTESTUFF))
|
||||||
{
|
{
|
||||||
crc_s += p[i]; //0-1FF
|
Serial_write(BYTESTUFF);//stuff again
|
||||||
crc_s += crc_s >> 8; //0-100
|
Serial_write(STUFF_MASK ^ p[i]);
|
||||||
crc_s &= 0x00ff;
|
}
|
||||||
|
else
|
||||||
|
Serial_write(p[i]);
|
||||||
|
|
||||||
|
if (i>0)
|
||||||
|
{
|
||||||
|
crc_s += p[i]; //0-1FF
|
||||||
|
crc_s += crc_s >> 8; //0-100
|
||||||
|
crc_s &= 0x00ff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void sportIdle()
|
void sportIdle()
|
||||||
{
|
{
|
||||||
#if !defined MULTI_TELEMETRY
|
#if !defined MULTI_TELEMETRY
|
||||||
Serial_write(START_STOP);
|
Serial_write(START_STOP);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void sportSendFrame()
|
void sportSendFrame()
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
#undef HUB_TELEMETRY
|
#undef HUB_TELEMETRY
|
||||||
#undef SPORT_TELEMETRY
|
#undef SPORT_TELEMETRY
|
||||||
#undef DSM_TELEMETRY
|
#undef DSM_TELEMETRY
|
||||||
|
#undef MULTI_TELEMETRY
|
||||||
#else
|
#else
|
||||||
#if not defined(BAYANG_NRF24L01_INO)
|
#if not defined(BAYANG_NRF24L01_INO)
|
||||||
#undef BAYANG_HUB_TELEMETRY
|
#undef BAYANG_HUB_TELEMETRY
|
||||||
|
@ -89,7 +89,6 @@
|
|||||||
#define SYMAX_NRF24L01_INO
|
#define SYMAX_NRF24L01_INO
|
||||||
#define V2X2_NRF24L01_INO
|
#define V2X2_NRF24L01_INO
|
||||||
#define YD717_NRF24L01_INO
|
#define YD717_NRF24L01_INO
|
||||||
|
|
||||||
#define MT99XX_NRF24L01_INO
|
#define MT99XX_NRF24L01_INO
|
||||||
#define MJXQ_NRF24L01_INO
|
#define MJXQ_NRF24L01_INO
|
||||||
#define SHENQI_NRF24L01_INO
|
#define SHENQI_NRF24L01_INO
|
||||||
@ -111,6 +110,10 @@
|
|||||||
//For ER9X and ERSKY9X it must be commented. For OpenTX it must be uncommented.
|
//For ER9X and ERSKY9X it must be commented. For OpenTX it must be uncommented.
|
||||||
//#define INVERT_TELEMETRY
|
//#define INVERT_TELEMETRY
|
||||||
|
|
||||||
|
//Uncomment to send also Multi status and wrap other telemetry to allow TX to autodetect the format
|
||||||
|
//Only for newest OpenTX version
|
||||||
|
//#define MULTI_TELEMETRY
|
||||||
|
|
||||||
//Comment a line to disable a protocol telemetry
|
//Comment a line to disable a protocol telemetry
|
||||||
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded
|
#define DSM_TELEMETRY // Forward received telemetry packet directly to TX to be decoded
|
||||||
#define SPORT_TELEMETRY // Use FrSkyX SPORT format to send telemetry to TX
|
#define SPORT_TELEMETRY // Use FrSkyX SPORT format to send telemetry to TX
|
||||||
@ -119,7 +122,6 @@
|
|||||||
#define AFHDS2A_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define AFHDS2A_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define BAYANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define BAYANG_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define MULTI_TELEMETRY // Send also Multi status and wrap other telemetry to allow TX to autodetect the format
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/*** SERIAL MODE SETTINGS ***/
|
/*** SERIAL MODE SETTINGS ***/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user