handle all available bytes

This commit is contained in:
Mike Pieper 2022-01-25 06:08:58 +01:00
parent 7d7e6eb3b4
commit c908d5dc0a

View File

@ -119,6 +119,8 @@ void TpUartDataLinkLayer::loop()
if (!_enabled)
return;
// Loop once and repeat as long we have rx data available
do {
// Signals to communicate from rx part with the tx part
bool isEchoComplete = false; // Flag that a complete echo is received
uint8_t dataConnMsg = 0; // The DATA_CONN message just seen or 0
@ -139,10 +141,8 @@ void TpUartDataLinkLayer::loop()
bool stayInRx = false;
#endif
// Loop as long we are in the receive phase for the L2 address
// Loop once and repeat as long we are in the receive phase for the L2 address
do {
_receiveBuffer[0] = 0x29;
_receiveBuffer[1] = 0;
uint8_t* buffer = _receiveBuffer + 2;
uint8_t rxByte;
switch (_rxState)
@ -354,6 +354,8 @@ void TpUartDataLinkLayer::loop()
}
else
{
_receiveBuffer[0] = 0x29;
_receiveBuffer[1] = 0;
frameBytesReceived(_receiveBuffer, _RxByteCnt + 2);
}
_rxState = RX_WAIT_START;
@ -468,6 +470,7 @@ void TpUartDataLinkLayer::loop()
}
break;
}
} while (_platform.uartAvailable());
}
bool TpUartDataLinkLayer::sendFrame(CemiFrame& frame)