[Horus/Taranis] Pulses cosmetics
This commit is contained in:
@@ -48,23 +48,23 @@ void _send_1(uint8_t v)
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.rest -= v;
|
||||
}
|
||||
|
||||
void sendByteDsm2(uint8_t b) //max 10 changes 0 10 10 10 10 1
|
||||
void sendByteDsm2(uint8_t b) // max 10 changes 0 10 10 10 10 1
|
||||
{
|
||||
bool lev = 0;
|
||||
uint8_t len = BITLEN_DSM2; //max val: 9*16 < 256
|
||||
for (uint8_t i=0; i<=8; i++) { //8Bits + Stop=1
|
||||
bool nlev = b & 1; //lsb first
|
||||
uint8_t len = BITLEN_DSM2; // max val: 9*16 < 256
|
||||
for (uint8_t i=0; i<=8; i++) { // 8Bits + Stop=1
|
||||
bool nlev = b & 1; // lsb first
|
||||
if (lev == nlev) {
|
||||
len += BITLEN_DSM2;
|
||||
}
|
||||
else {
|
||||
_send_1(len); // _send_1(nlev ? len-5 : len+3);
|
||||
_send_1(len);
|
||||
len = BITLEN_DSM2;
|
||||
lev = nlev;
|
||||
}
|
||||
b = (b>>1) | 0x80; //shift in stop bit
|
||||
b = (b>>1) | 0x80; // shift in stop bit
|
||||
}
|
||||
_send_1(len+BITLEN_DSM2); // _send_1(len+BITLEN_DSM2+3); // 2 stop bits
|
||||
_send_1(len+BITLEN_DSM2); // stop bit
|
||||
}
|
||||
|
||||
void putDsm2Flush()
|
||||
|
||||
@@ -50,8 +50,7 @@ void setupPulsesPPM(uint8_t port, PpmPulsesData<T> * ppmPulsesData)
|
||||
*ptr++ = v; /* as Pat MacKenzie suggests */
|
||||
#endif
|
||||
}
|
||||
if (rest > 65535) rest = 65535; /* prevents overflows */
|
||||
if (rest < 9000) rest = 9000; /* avoids that CCR2 is bigger than ARR which would cause reboot */
|
||||
rest = limit<int32_t>(9000, rest, 65535); /* avoids that CCR2 is bigger than ARR which would cause reboot */
|
||||
#if defined(CPUSTM32)
|
||||
*ppmPulsesData->ptr++ = rest;
|
||||
#else
|
||||
|
||||
@@ -141,6 +141,7 @@ void pxxPutPcmPart(uint8_t port, uint8_t value)
|
||||
|
||||
void pxxPutPcmTail(uint8_t port)
|
||||
{
|
||||
// rest min value is 18000 - 200 * 48 = 8400 (4.2ms)
|
||||
*(modulePulsesData[port].pxx.ptr-1) += modulePulsesData[port].pxx.rest;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user