mirror of
				https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
				synced 2025-11-04 06:51:03 +00:00 
			
		
		
		
	DSM: adjust end points, solve SAFE?
This commit is contained in:
		
							parent
							
								
									f52f96d44e
								
							
						
					
					
						commit
						d1feef97be
					
				@ -18,6 +18,7 @@ Multiprotocol is distributed in the hope that it will be useful,
 | 
				
			|||||||
#include "iface_cyrf6936.h"
 | 
					#include "iface_cyrf6936.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//#define DSM_DEBUG_RF
 | 
					//#define DSM_DEBUG_RF
 | 
				
			||||||
 | 
					//#define DSM_DEBUG_CH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t DSM_rx_type;
 | 
					uint8_t DSM_rx_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -85,6 +86,11 @@ static uint8_t __attribute__((unused)) DSM_Rx_check_packet()
 | 
				
			|||||||
				packet[0] ^= 0xff;
 | 
									packet[0] ^= 0xff;
 | 
				
			||||||
				packet[1] ^= 0xff;
 | 
									packet[1] ^= 0xff;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								#ifdef DSM_DEBUG_CH
 | 
				
			||||||
 | 
									for(uint8_t i=0;i<len;i++)
 | 
				
			||||||
 | 
										debug("%02X ",packet[i]);
 | 
				
			||||||
 | 
									debugln("");
 | 
				
			||||||
 | 
								#endif
 | 
				
			||||||
			if(packet[0] == cyrfmfg_id[2] && packet[1] == cyrfmfg_id[3])
 | 
								if(packet[0] == cyrfmfg_id[2] && packet[1] == cyrfmfg_id[3])
 | 
				
			||||||
				return 0x02;										// Packet ok
 | 
									return 0x02;										// Packet ok
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -111,7 +117,10 @@ static void __attribute__((unused)) DSM_Rx_build_telemetry_packet()
 | 
				
			|||||||
		uint16_t value=(packet[i*2+2]<<8) | packet[i*2+3];
 | 
							uint16_t value=(packet[i*2+2]<<8) | packet[i*2+3];
 | 
				
			||||||
		if(value!=0xFFFF)
 | 
							if(value!=0xFFFF)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			idx=(value&0x7FFF)>>nbr_bits;							// retrieve channel index 0..12
 | 
								idx=(value&0x7FFF)>>nbr_bits;							// retrieve channel index
 | 
				
			||||||
 | 
								#ifdef DSM_DEBUG_CH
 | 
				
			||||||
 | 
									debugln("i=%d,v=%d,u=%X",idx,value&0x7FF,value&0x8000);
 | 
				
			||||||
 | 
								#endif
 | 
				
			||||||
			if(idx<13)
 | 
								if(idx<13)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if(nbr_bits==10) value <<= 1;						// switch to 11 bits
 | 
									if(nbr_bits==10) value <<= 1;						// switch to 11 bits
 | 
				
			||||||
 | 
				
			|||||||
@ -54,7 +54,7 @@ const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
 | 
				
			|||||||
	{1, 5, 2, 3, 6,    0xff, 0xff, 4,    0,    7,    8,    0xff, 0xff, 0xff}, //9ch  - Guess
 | 
						{1, 5, 2, 3, 6,    0xff, 0xff, 4,    0,    7,    8,    0xff, 0xff, 0xff}, //9ch  - Guess
 | 
				
			||||||
	{1, 5, 2, 3, 6,    0xff, 0xff, 4,    0,    7,    8,    9,    0xff, 0xff}, //10ch - Guess
 | 
						{1, 5, 2, 3, 6,    0xff, 0xff, 4,    0,    7,    8,    9,    0xff, 0xff}, //10ch - Guess
 | 
				
			||||||
	{1, 5, 2, 3, 6,    10,   0xff, 4,    0,    7,    8,    9,    0xff, 0xff}, //11ch - Guess
 | 
						{1, 5, 2, 3, 6,    10,   0xff, 4,    0,    7,    8,    9,    0xff, 0xff}, //11ch - Guess
 | 
				
			||||||
	{1, 5, 2, 4, 6,    10,   0xff, 0,    7,    3,    8,    9   , 11  , 0xff}, //12ch - DX18
 | 
						{1, 5, 2, 4, 6,    10,   0xff, 0,    7,    3,    8,    9   , 11  , 0xff}, //12ch - DX18/DX8G2
 | 
				
			||||||
//11ms for 8..11 channels
 | 
					//11ms for 8..11 channels
 | 
				
			||||||
	{1, 5, 2, 3, 6,    7,    0xff, 1,    5,    2,    4,    0,    0xff, 0xff}, //8ch  - DX7
 | 
						{1, 5, 2, 3, 6,    7,    0xff, 1,    5,    2,    4,    0,    0xff, 0xff}, //8ch  - DX7
 | 
				
			||||||
	{1, 5, 2, 3, 6,    7,    0xff, 1,    5,    2,    4,    0,    8,    0xff}, //9ch  - Guess
 | 
						{1, 5, 2, 3, 6,    7,    0xff, 1,    5,    2,    4,    0,    8,    0xff}, //9ch  - Guess
 | 
				
			||||||
@ -179,7 +179,7 @@ static void __attribute__((unused)) DSM_build_data_packet(uint8_t upper)
 | 
				
			|||||||
					if(option & 0x80)
 | 
										if(option & 0x80)
 | 
				
			||||||
						value=Channel_data[CH_TAER[idx]];								// -100%..+100% => 1024..1976us and -125%..+125% => 904..2096us based on Redcon 6 channel DSM2 RX
 | 
											value=Channel_data[CH_TAER[idx]];								// -100%..+100% => 1024..1976us and -125%..+125% => 904..2096us based on Redcon 6 channel DSM2 RX
 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
						value=convert_channel_16b_nolimit(CH_TAER[idx],0x150,0x6B0);	// -100%..+100% => 1100..1900us and -125%..+125% => 1000..2000us based on Redcon 6 channel DSM2 RX
 | 
											value=convert_channel_16b_nolimit(CH_TAER[idx],0x156,0x6AA);	// -100%..+100% => 1100..1900us and -125%..+125% => 1000..2000us based on a DX8 G2 dump
 | 
				
			||||||
				#endif
 | 
									#endif
 | 
				
			||||||
			if(bits==10) value>>=1;
 | 
								if(bits==10) value>>=1;
 | 
				
			||||||
			value |= (upper && i==0 ? 0x8000 : 0) | (idx << bits);
 | 
								value |= (upper && i==0 ? 0x8000 : 0) | (idx << bits);
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@
 | 
				
			|||||||
#define VERSION_MAJOR		1
 | 
					#define VERSION_MAJOR		1
 | 
				
			||||||
#define VERSION_MINOR		3
 | 
					#define VERSION_MINOR		3
 | 
				
			||||||
#define VERSION_REVISION	1
 | 
					#define VERSION_REVISION	1
 | 
				
			||||||
#define VERSION_PATCH_LEVEL	17
 | 
					#define VERSION_PATCH_LEVEL	18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//******************
 | 
					//******************
 | 
				
			||||||
// Protocols
 | 
					// Protocols
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user