mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Fix softserial loopback support compilation errors.
This commit is contained in:
parent
49d411dcc7
commit
eb0beb70a9
1 changed files with 5 additions and 4 deletions
|
@ -49,7 +49,7 @@ extern rcReadRawDataPtr rcReadRawFunc;
|
||||||
extern uint32_t previousTime;
|
extern uint32_t previousTime;
|
||||||
|
|
||||||
#ifdef SOFTSERIAL_LOOPBACK
|
#ifdef SOFTSERIAL_LOOPBACK
|
||||||
serialPort_t *loopbackPort
|
serialPort_t *loopbackPort;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
failsafe_t *failsafe;
|
failsafe_t *failsafe;
|
||||||
|
@ -231,9 +231,9 @@ void init(void)
|
||||||
|
|
||||||
#ifdef SOFTSERIAL_LOOPBACK
|
#ifdef SOFTSERIAL_LOOPBACK
|
||||||
// FIXME this is a hack, perhaps add a FUNCTION_LOOPBACK to support it properly
|
// FIXME this is a hack, perhaps add a FUNCTION_LOOPBACK to support it properly
|
||||||
serialPort_t *loopbackPort = (serialPort_t*)&(softSerialPorts[0]);
|
loopbackPort = (serialPort_t*)&(softSerialPorts[0]);
|
||||||
if (!loopbackPort->vTable) {
|
if (!loopbackPort->vTable) {
|
||||||
openSoftSerial1(19200, false);
|
loopbackPort = openSoftSerial(0, NULL, 19200, SERIAL_NOT_INVERTED);
|
||||||
}
|
}
|
||||||
serialPrint(loopbackPort, "LOOPBACK\r\n");
|
serialPrint(loopbackPort, "LOOPBACK\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -242,7 +242,8 @@ void init(void)
|
||||||
#ifdef SOFTSERIAL_LOOPBACK
|
#ifdef SOFTSERIAL_LOOPBACK
|
||||||
void processLoopback(void) {
|
void processLoopback(void) {
|
||||||
if (loopbackPort) {
|
if (loopbackPort) {
|
||||||
while (serialTotalBytesWaiting(loopbackPort)) {
|
uint8_t bytesWaiting;
|
||||||
|
while ((bytesWaiting = serialTotalBytesWaiting(loopbackPort))) {
|
||||||
uint8_t b = serialRead(loopbackPort);
|
uint8_t b = serialRead(loopbackPort);
|
||||||
serialWrite(loopbackPort, b);
|
serialWrite(loopbackPort, b);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue