Merge pull request #1841 from blckmn/crsf-non-bidir
Allow for non-bidir serial for CRSF
This commit is contained in:
commit
f2ea479324
|
@ -205,14 +205,17 @@ void crsfRxSendTelemetryData(void)
|
|||
{
|
||||
// if there is telemetry data to write
|
||||
if (telemetryBufLen > 0) {
|
||||
// check that we are not currently receiving data (ie in the middle of an RX frame)
|
||||
// check that we are not in bi dir mode or that we are not currently receiving data (ie in the middle of an RX frame)
|
||||
// and that there is time to send the telemetry frame before the next RX frame arrives
|
||||
const uint32_t timeSinceStartOfFrame = micros() - crsfFrameStartAt;
|
||||
if ((timeSinceStartOfFrame > CRSF_TIME_NEEDED_PER_FRAME_US)
|
||||
&& (timeSinceStartOfFrame < CRSF_TIME_BETWEEN_FRAMES_US - CRSF_TIME_NEEDED_PER_FRAME_US)) {
|
||||
serialWriteBuf(serialPort, telemetryBuf, telemetryBufLen);
|
||||
telemetryBufLen = 0; // reset telemetry buffer
|
||||
if (CRSF_PORT_OPTIONS & SERIAL_BIDIR) {
|
||||
const uint32_t timeSinceStartOfFrame = micros() - crsfFrameStartAt;
|
||||
if ((timeSinceStartOfFrame < CRSF_TIME_NEEDED_PER_FRAME_US) ||
|
||||
(timeSinceStartOfFrame > CRSF_TIME_BETWEEN_FRAMES_US - CRSF_TIME_NEEDED_PER_FRAME_US)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
serialWriteBuf(serialPort, telemetryBuf, telemetryBufLen);
|
||||
telemetryBufLen = 0; // reset telemetry buffer
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#pragma once
|
||||
|
||||
#define CRSF_BAUDRATE 420000
|
||||
#define CRSF_PORT_OPTIONS (SERIAL_STOPBITS_1 | SERIAL_PARITY_NO | SERIAL_BIDIR)
|
||||
#define CRSF_PORT_OPTIONS (SERIAL_STOPBITS_1 | SERIAL_PARITY_NO)
|
||||
#define CRSF_PORT_MODE MODE_RXTX
|
||||
|
||||
#define CRSF_MAX_CHANNEL 16
|
||||
|
|
Loading…
Reference in New Issue