mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
tx throttle.
This commit is contained in:
parent
6720f86e5c
commit
1ee4377e61
@ -96,6 +96,7 @@ enum {
|
||||
#define EOP_TIMEOUT 2 //milli seconds; end of layer-2 packet gap
|
||||
#define CONFIRM_TIMEOUT 500 //milli seconds
|
||||
#define RESET_TIMEOUT 100 //milli seconds
|
||||
#define TX_THROTTLE_TIME 1 //milli seconds
|
||||
|
||||
void TpUartDataLinkLayer::loop()
|
||||
{
|
||||
@ -295,6 +296,7 @@ void TpUartDataLinkLayer::loop()
|
||||
}
|
||||
|
||||
// Hint: We can send directly here, this doesn't disturb other transmissions
|
||||
// We don't have to update _lastByteTxTime because after ACK the timing is not so tight
|
||||
_platform.writeUart(c);
|
||||
}
|
||||
}
|
||||
@ -377,6 +379,8 @@ void TpUartDataLinkLayer::loop()
|
||||
}
|
||||
break;
|
||||
case TX_FRAME:
|
||||
if (millis() - _lastByteTxTime >= TX_THROTTLE_TIME)
|
||||
{
|
||||
if (sendSingleFrameByte() == false)
|
||||
{
|
||||
_waitConfirmStartTime = millis();
|
||||
@ -385,6 +389,11 @@ void TpUartDataLinkLayer::loop()
|
||||
println("TX_WAIT_ECHO");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastByteTxTime = millis();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TX_WAIT_ECHO:
|
||||
case TX_WAIT_CONN:
|
||||
|
@ -43,6 +43,7 @@ class TpUartDataLinkLayer : public DataLinkLayer
|
||||
bool _convert = false;
|
||||
uint8_t _xorSum = 0;
|
||||
uint32_t _lastByteRxTime;
|
||||
uint32_t _lastByteTxTime;
|
||||
uint32_t _waitConfirmStartTime;
|
||||
uint32_t _lastResetChipTime = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user