mirror of
				https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
				synced 2025-10-31 11:21:06 +00:00 
			
		
		
		
	Multiprotocol status
Along with the latest ersky9x version, display the module version and if a specific protocol is available or not.
This commit is contained in:
		
							parent
							
								
									e30ebd39fd
								
							
						
					
					
						commit
						7ee918ad49
					
				| @ -499,10 +499,10 @@ void Update_All() | |||||||
| 	} | 	} | ||||||
| 	update_channels_aux(); | 	update_channels_aux(); | ||||||
| 	#if defined(TELEMETRY) | 	#if defined(TELEMETRY) | ||||||
| 		#if !defined(MULTI_TELEMETRY) | 		#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) ) | ||||||
| 			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 | ||||||
| 	update_led_status(); | 	update_led_status(); | ||||||
| } | } | ||||||
| @ -1042,21 +1042,12 @@ void Mprotocol_serial_init() | |||||||
| #if defined(TELEMETRY) | #if defined(TELEMETRY) | ||||||
| void PPM_Telemetry_serial_init() | void PPM_Telemetry_serial_init() | ||||||
| { | { | ||||||
| 	#ifdef MULTI_TELEMETRY | 	if( (protocol==MODE_FRSKYD) || (protocol==MODE_HUBSAN) || (protocol==MODE_AFHDS2A) || (protocol==MODE_BAYANG) ) | ||||||
| 		Mprotocol_serial_init(); | 		initTXSerial( SPEED_9600 ) ; | ||||||
| 		#ifndef ORANGE_TX | 	if(protocol==MODE_FRSKYX) | ||||||
| 			#ifndef STM32_BOARD | 		initTXSerial( SPEED_57600 ) ; | ||||||
| 				UCSR0B &= ~(_BV(RXEN0)|_BV(RXCIE0));//rx disable and interrupt
 | 	if(protocol==MODE_DSM) | ||||||
| 			#endif | 		initTXSerial( SPEED_125K ) ; | ||||||
| 		#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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -17,8 +17,8 @@ | |||||||
| //**************************
 | //**************************
 | ||||||
| #if defined TELEMETRY | #if defined TELEMETRY | ||||||
| 
 | 
 | ||||||
| #if defined MULTI_TELEMETRY | #if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) | ||||||
| 	#define MULTI_TIME 250 //in ms
 | 	#define MULTI_TIME 500 //in ms
 | ||||||
| 	uint32_t lastMulti = 0; | 	uint32_t lastMulti = 0; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| @ -57,20 +57,17 @@ uint8_t frame[18]; | |||||||
| 	} SerialControl ; | 	} SerialControl ; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef MULTI_TELEMETRY | #if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) | ||||||
| static void multi_send_header(uint8_t type, uint8_t len) | static void multi_send_header(uint8_t type, uint8_t len) | ||||||
| { | { | ||||||
|     Serial_write('M'); | 	Serial_write('M'); | ||||||
|     Serial_write('P'); | 	#ifdef MULTI_TELEMETRY | ||||||
|     Serial_write(type); | 		Serial_write('P'); | ||||||
|     Serial_write(len); | 		Serial_write(type); | ||||||
| } | 	#else | ||||||
| 
 | 		(void)type; | ||||||
| static void multi_send_frskyhub() | 	#endif | ||||||
| { | 	Serial_write(len); | ||||||
|     multi_send_header(MULTI_TELEMETRY_HUB, 9); |  | ||||||
|     for (uint8_t i = 0; i < 9; i++) |  | ||||||
|         Serial_write(frame[i]); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void multi_send_status() | static void multi_send_status() | ||||||
| @ -138,6 +135,15 @@ static void multi_send_status() | |||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef MULTI_TELEMETRY | ||||||
|  | static void multi_send_frskyhub() | ||||||
|  | { | ||||||
|  |     multi_send_header(MULTI_TELEMETRY_HUB, 9); | ||||||
|  |     for (uint8_t i = 0; i < 9; i++) | ||||||
|  |         Serial_write(frame[i]); | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| void frskySendStuffed() | void frskySendStuffed() | ||||||
| { | { | ||||||
| 	Serial_write(START_STOP); | 	Serial_write(START_STOP); | ||||||
| @ -538,45 +544,33 @@ void TelemetryUpdate() | |||||||
| 		h = SerialControl.head ; | 		h = SerialControl.head ; | ||||||
| 		t = SerialControl.tail ; | 		t = SerialControl.tail ; | ||||||
| 		if ( h >= t ) | 		if ( h >= t ) | ||||||
| 		{ |  | ||||||
| 			t += 64 - h ; | 			t += 64 - h ; | ||||||
| 		} |  | ||||||
| 		else | 		else | ||||||
| 		{ |  | ||||||
| 			t -= h ; | 			t -= h ; | ||||||
| 		} |  | ||||||
| 		if ( t < 32 ) | 		if ( t < 32 ) | ||||||
| 		{ |  | ||||||
| 			return ; | 			return ; | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 	#else | 	#else | ||||||
| 		uint8_t h ; | 		uint8_t h ; | ||||||
| 		uint8_t t ; | 		uint8_t t ; | ||||||
| 		h = tx_head ; | 		h = tx_head ; | ||||||
| 		t = tx_tail ; | 		t = tx_tail ; | ||||||
| 		if ( h >= t ) | 		if ( h >= t ) | ||||||
| 		{ |  | ||||||
| 			t += TXBUFFER_SIZE - h ; | 			t += TXBUFFER_SIZE - h ; | ||||||
| 		} |  | ||||||
| 		else | 		else | ||||||
| 		{ |  | ||||||
| 			t -= h ; | 			t -= h ; | ||||||
| 		} |  | ||||||
| 		if ( t < 16 ) | 		if ( t < 16 ) | ||||||
| 		{ |  | ||||||
| 			return ; | 			return ; | ||||||
| 		} |  | ||||||
| 	#endif | 	#endif | ||||||
|     #if defined MULTI_TELEMETRY | 	#if ( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) | ||||||
|         { | 		{ | ||||||
|             uint32_t now = millis(); | 			uint32_t now = millis(); | ||||||
|             if ((now - lastMulti) > MULTI_TIME) { | 			if ((now - lastMulti) > MULTI_TIME) | ||||||
|                 multi_send_status(); | 			{ | ||||||
|                 lastMulti = now; | 				multi_send_status(); | ||||||
|                 return; | 				lastMulti = now; | ||||||
|             } | 				return; | ||||||
|         } | 			} | ||||||
|  | 		} | ||||||
| 	#endif | 	#endif | ||||||
| 	  | 	  | ||||||
| 	#if defined SPORT_TELEMETRY | 	#if defined SPORT_TELEMETRY | ||||||
|  | |||||||
| @ -120,8 +120,11 @@ | |||||||
| //For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line.
 | //For er9x it depends if you have an inveter mod or not on the telemetry pin. If you don't have an inverter comment this line.
 | ||||||
| #define INVERT_TELEMETRY | #define INVERT_TELEMETRY | ||||||
| 
 | 
 | ||||||
| //Uncomment to send also Multi status and wrap other telemetry to allow TX to autodetect the format
 | //Comment if you don't want to send Multi status telemetry frames (Protocol available, Bind in progress, version...)
 | ||||||
| //Only for newest OpenTX version
 | #define MULTI_STATUS | ||||||
|  | 
 | ||||||
|  | //Uncomment to send Multi status and wrap other telemetry to allow TX to autodetect the format
 | ||||||
|  | //Only for newest OpenTX version, not supported by er9x/ersky9x
 | ||||||
| //#define MULTI_TELEMETRY
 | //#define MULTI_TELEMETRY
 | ||||||
| 
 | 
 | ||||||
| //Comment a line to disable a protocol telemetry
 | //Comment a line to disable a protocol telemetry
 | ||||||
| @ -133,6 +136,7 @@ | |||||||
| #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
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| /****************************/ | /****************************/ | ||||||
| /*** SERIAL MODE SETTINGS ***/ | /*** SERIAL MODE SETTINGS ***/ | ||||||
| /****************************/ | /****************************/ | ||||||
| @ -258,6 +262,8 @@ const PPM_Parameters PPM_prot[15]=	{ | |||||||
| 	MODE_FRSKYX | 	MODE_FRSKYX | ||||||
| 		CH_16 | 		CH_16 | ||||||
| 		CH_8 | 		CH_8 | ||||||
|  | 		EU_16 | ||||||
|  | 		EU_8 | ||||||
| 	MODE_ESKY | 	MODE_ESKY | ||||||
| 		NONE | 		NONE | ||||||
| 	MODE_MT99XX | 	MODE_MT99XX | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user