Changes to DSM2=PPM code to hopefully fix bind and rangecheck lock-on bugs.
This commit is contained in:
+15
-18
@@ -430,7 +430,7 @@ FORCEINLINE void setupPulsesDsm2()
|
|||||||
*ptr = 0x10;
|
*ptr = 0x10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*ptr = 0x18; // DSMX bind mode
|
*ptr = 0x18; // DSMX
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (s_bind_allowed) s_bind_allowed--;
|
if (s_bind_allowed) s_bind_allowed--;
|
||||||
@@ -451,8 +451,8 @@ FORCEINLINE void setupPulsesDsm2()
|
|||||||
for (uint8_t i=0; i<DSM2_CHANS; i++)
|
for (uint8_t i=0; i<DSM2_CHANS; i++)
|
||||||
{
|
{
|
||||||
uint16_t pulse = limit(0, ((g_chans512[i]*13)>>5)+512,1023);
|
uint16_t pulse = limit(0, ((g_chans512[i]*13)>>5)+512,1023);
|
||||||
*ptr++ = (i<<2) | ((pulse>>8)&0x03);
|
*ptr++ = (i<<2) | ((pulse>>8)&0x03); // high nyble (4-bits) channel encoded
|
||||||
*ptr++ = pulse & 0xff;
|
*ptr++ = pulse & 0xff; // low byte
|
||||||
}
|
}
|
||||||
|
|
||||||
pulses2MHzWPtr = (uint8_t *)ptr;
|
pulses2MHzWPtr = (uint8_t *)ptr;
|
||||||
@@ -526,20 +526,17 @@ void setupPulsesDsm2()
|
|||||||
pulses2MHzWPtr = pulses2MHz;
|
pulses2MHzWPtr = pulses2MHz;
|
||||||
|
|
||||||
// If more channels needed make sure the pulses union/array is large enough
|
// If more channels needed make sure the pulses union/array is large enough
|
||||||
if (dsmDat[0] & BAD_DATA) // first time through, setup header
|
switch(g_model.ppmNCH)
|
||||||
{
|
{
|
||||||
switch(g_model.ppmNCH)
|
case LPXDSM2:
|
||||||
{
|
dsmDat[0] = 0x00;
|
||||||
case LPXDSM2:
|
break;
|
||||||
dsmDat[0] = 0x00;
|
case DSM2only:
|
||||||
break;
|
dsmDat[0] = 0x10;
|
||||||
case DSM2only:
|
break;
|
||||||
dsmDat[0] = 0x10;
|
default:
|
||||||
break;
|
dsmDat[0] = 0x18; // DSMX bind mode
|
||||||
default:
|
break;
|
||||||
dsmDat[0] = 0x18; // DSMX bind mode
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_bind_allowed) s_bind_allowed--;
|
if (s_bind_allowed) s_bind_allowed--;
|
||||||
@@ -559,8 +556,8 @@ void setupPulsesDsm2()
|
|||||||
for (uint8_t i=0; i<DSM2_CHANS; i++)
|
for (uint8_t i=0; i<DSM2_CHANS; i++)
|
||||||
{
|
{
|
||||||
uint16_t pulse = limit(0, ((g_chans512[i]*13)>>5)+512,1023);
|
uint16_t pulse = limit(0, ((g_chans512[i]*13)>>5)+512,1023);
|
||||||
dsmDat[2+2*i] = (i<<2) | ((pulse>>8)&0x03);
|
dsmDat[2+2*i] = (i<<2) | ((pulse>>8)&0x03); // high nyble (4-bits) channel encoded
|
||||||
dsmDat[3+2*i] = pulse & 0xff;
|
dsmDat[3+2*i] = pulse & 0xff; // low byte
|
||||||
}
|
}
|
||||||
|
|
||||||
for (counter=0; counter<14; counter++)
|
for (counter=0; counter<14; counter++)
|
||||||
|
|||||||
Reference in New Issue
Block a user