mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Merge pull request #4675 from jflyper/bfdev-fix-softserial-disappearing-start-bit
[SOFTSERIAL] Fix disappearing start bit in SERIAL_BIDIR case.
This commit is contained in:
commit
f0cf65467b
1 changed files with 7 additions and 6 deletions
|
@ -161,11 +161,7 @@ static void serialInputPortDeActivate(softSerial_t *softSerial)
|
||||||
TIM_CCxCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_Disable);
|
TIM_CCxCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_Disable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STM32F1
|
|
||||||
IOConfigGPIO(softSerial->rxIO, IOCFG_IN_FLOATING);
|
IOConfigGPIO(softSerial->rxIO, IOCFG_IN_FLOATING);
|
||||||
#else
|
|
||||||
IOConfigGPIOAF(softSerial->rxIO, IOCFG_IN_FLOATING, softSerial->timerHardware->alternateFunction);
|
|
||||||
#endif
|
|
||||||
softSerial->rxActive = false;
|
softSerial->rxActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,9 +377,14 @@ void processTxState(softSerial_t *softSerial)
|
||||||
// Half-duplex: Deactivate receiver, activate transmitter
|
// Half-duplex: Deactivate receiver, activate transmitter
|
||||||
serialInputPortDeActivate(softSerial);
|
serialInputPortDeActivate(softSerial);
|
||||||
serialOutputPortActivate(softSerial);
|
serialOutputPortActivate(softSerial);
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
// Start sending on next bit timing, as port manipulation takes time,
|
||||||
|
// and continuing here may cause bit period to decrease causing sampling errors
|
||||||
|
// at the receiver under high rates.
|
||||||
|
// Note that there will be (little less than) 1-bit delay; take it as "turn around time".
|
||||||
|
// XXX We may be able to reload counter and continue. (Future work.)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (softSerial->bitsLeftToTransmit) {
|
if (softSerial->bitsLeftToTransmit) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue