start confirm timout only after last byte was sent (#25)

* bugfix, print not allowed in constructor

* Update tpuart_data_link_layer.cpp

- start confirm timout only after last byte was sent
- increase BYTE_TIMEOUT
This commit is contained in:
Bernator 2019-08-06 21:08:06 +02:00 committed by thelsing
parent de8f4631b6
commit 1c53cf83cd

View File

@ -80,7 +80,7 @@
#define RX_WAIT_DATA_CON 3 #define RX_WAIT_DATA_CON 3
#define TX_FRAME 4 #define TX_FRAME 4
#define BYTE_TIMEOUT 3 //milli seconds #define BYTE_TIMEOUT 10 //milli seconds
#define CONFIRM_TIMEOUT 500 //milli seconds #define CONFIRM_TIMEOUT 500 //milli seconds
#define RESET_TIMEOUT 100 //milli seconds #define RESET_TIMEOUT 100 //milli seconds
@ -107,8 +107,6 @@ void TpUartDataLinkLayer::loop()
if (!_waitConfirm && !isTxQueueEmpty()) if (!_waitConfirm && !isTxQueueEmpty())
{ {
loadNextTxFrame(); loadNextTxFrame();
_waitConfirm = true;
_waitConfirmStartTime = _platform.millis();
_loopState = TX_FRAME; _loopState = TX_FRAME;
} }
} }
@ -116,6 +114,8 @@ void TpUartDataLinkLayer::loop()
case TX_FRAME: case TX_FRAME:
if (sendSingleFrameByte() == false) if (sendSingleFrameByte() == false)
{ {
_waitConfirm = true;
_waitConfirmStartTime = _platform.millis();
_loopState = IDLE; _loopState = IDLE;
} }
break; break;