Rename function for better understanding, fix inverse logic

This commit is contained in:
Ing-Dom 2023-05-27 13:55:11 +02:00
parent 49ae48eacb
commit b088ffe10d
2 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ bool IpDataLinkLayer::sendFrame(CemiFrame& frame)
{ {
KnxIpRoutingIndication packet(frame); KnxIpRoutingIndication packet(frame);
// only send 50 packet per second: see KNX 3.2.6 p.6 // only send 50 packet per second: see KNX 3.2.6 p.6
if(CheckSendLimit()) if(isSendLimitReached())
return false; return false;
bool success = sendBytes(packet.data(), packet.totalLength()); bool success = sendBytes(packet.data(), packet.totalLength());
dataConReceived(frame, success); dataConReceived(frame, success);
@ -113,7 +113,7 @@ bool IpDataLinkLayer::sendBytes(uint8_t* bytes, uint16_t length)
return _platform.sendBytesMultiCast(bytes, length); return _platform.sendBytesMultiCast(bytes, length);
} }
bool IpDataLinkLayer::CheckSendLimit() bool IpDataLinkLayer::isSendLimitReached()
{ {
uint32_t curTime = millis() / 100; uint32_t curTime = millis() / 100;
@ -146,7 +146,7 @@ bool IpDataLinkLayer::CheckSendLimit()
if(sum > 50) if(sum > 50)
{ {
println("Dropping packet due to 50p/s limit"); println("Dropping packet due to 50p/s limit");
return false; // drop packet return true; // drop packet
} }
else else
{ {
@ -155,7 +155,7 @@ bool IpDataLinkLayer::CheckSendLimit()
//print(sum); //print(sum);
//print(" curTime: "); //print(" curTime: ");
//println(curTime); //println(curTime);
return true; return false;
} }
} }
#endif #endif

View File

@ -27,7 +27,7 @@ class IpDataLinkLayer : public DataLinkLayer
uint32_t _frameCountTimeBase = 0; uint32_t _frameCountTimeBase = 0;
bool sendFrame(CemiFrame& frame); bool sendFrame(CemiFrame& frame);
bool sendBytes(uint8_t* buffer, uint16_t length); bool sendBytes(uint8_t* buffer, uint16_t length);
bool CheckSendLimit(); bool isSendLimitReached();
IpParameterObject& _ipParameters; IpParameterObject& _ipParameters;
}; };