Merge pull request #1841 from blckmn/crsf-non-bidir
Allow for non-bidir serial for CRSF
This commit is contained in:
commit
f2ea479324
|
@ -205,15 +205,18 @@ void crsfRxSendTelemetryData(void)
|
||||||
{
|
{
|
||||||
// if there is telemetry data to write
|
// if there is telemetry data to write
|
||||||
if (telemetryBufLen > 0) {
|
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
|
// and that there is time to send the telemetry frame before the next RX frame arrives
|
||||||
|
if (CRSF_PORT_OPTIONS & SERIAL_BIDIR) {
|
||||||
const uint32_t timeSinceStartOfFrame = micros() - crsfFrameStartAt;
|
const uint32_t timeSinceStartOfFrame = micros() - crsfFrameStartAt;
|
||||||
if ((timeSinceStartOfFrame > CRSF_TIME_NEEDED_PER_FRAME_US)
|
if ((timeSinceStartOfFrame < CRSF_TIME_NEEDED_PER_FRAME_US) ||
|
||||||
&& (timeSinceStartOfFrame < CRSF_TIME_BETWEEN_FRAMES_US - CRSF_TIME_NEEDED_PER_FRAME_US)) {
|
(timeSinceStartOfFrame > CRSF_TIME_BETWEEN_FRAMES_US - CRSF_TIME_NEEDED_PER_FRAME_US)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
serialWriteBuf(serialPort, telemetryBuf, telemetryBufLen);
|
serialWriteBuf(serialPort, telemetryBuf, telemetryBufLen);
|
||||||
telemetryBufLen = 0; // reset telemetry buffer
|
telemetryBufLen = 0; // reset telemetry buffer
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool crsfRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
bool crsfRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define CRSF_BAUDRATE 420000
|
#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_PORT_MODE MODE_RXTX
|
||||||
|
|
||||||
#define CRSF_MAX_CHANNEL 16
|
#define CRSF_MAX_CHANNEL 16
|
||||||
|
|
Loading…
Reference in New Issue