mirror of
https://github.com/thelsing/knx.git
synced 2025-01-21 00:05:43 +01:00
bugfix nextAsap, translateAsap, Tx extended frame format (#26)
* bugfix, print not allowed in constructor * Update tpuart_data_link_layer.cpp - start confirm timout only after last byte was sent - increase BYTE_TIMEOUT * bugfix nextAsap, translateAsap * bugfix Extended Frame Format TX
This commit is contained in:
parent
1c53cf83cd
commit
626d1b73d1
@ -29,7 +29,7 @@ uint16_t AssociationTableObject::entryCount()
|
||||
return ntohs(_tableData[0]);
|
||||
}
|
||||
|
||||
uint16_t AssociationTableObject::operator[](uint16_t idx)
|
||||
uint16_t AssociationTableObject::getTSAP(uint16_t idx)
|
||||
{
|
||||
if (idx < 0 || idx >= entryCount())
|
||||
return 0;
|
||||
@ -37,6 +37,14 @@ uint16_t AssociationTableObject::operator[](uint16_t idx)
|
||||
return ntohs(_tableData[2 * idx + 1]);
|
||||
}
|
||||
|
||||
uint16_t AssociationTableObject::getASAP(uint16_t idx)
|
||||
{
|
||||
if (idx < 0 || idx >= entryCount())
|
||||
return 0;
|
||||
|
||||
return ntohs(_tableData[2 * idx + 2]);
|
||||
}
|
||||
|
||||
uint8_t* AssociationTableObject::save(uint8_t* buffer)
|
||||
{
|
||||
return TableObject::save(buffer);
|
||||
@ -53,10 +61,10 @@ uint8_t* AssociationTableObject::restore(uint8_t* buffer)
|
||||
int32_t AssociationTableObject::translateAsap(uint16_t asap)
|
||||
{
|
||||
uint16_t entries = entryCount();
|
||||
for (uint16_t i = 0; i < entries * 2; i+=2)
|
||||
for (uint16_t i = 0; i < entries; i++)
|
||||
{
|
||||
if (operator[](i + 1) == asap)
|
||||
return operator[](i);
|
||||
if (getASAP(i) == asap)
|
||||
return getTSAP(i);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -97,11 +105,11 @@ int32_t AssociationTableObject::nextAsap(uint16_t tsap, uint16_t& startIdx)
|
||||
uint16_t entries = entryCount();
|
||||
for (uint16_t i = startIdx; i < entries; i++)
|
||||
{
|
||||
startIdx = i;
|
||||
startIdx = i+1;
|
||||
|
||||
if (operator[](i) == tsap)
|
||||
if (getTSAP(i) == tsap)
|
||||
{
|
||||
return operator[](i+1);
|
||||
return getASAP(i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -21,6 +21,7 @@ class AssociationTableObject : public TableObject
|
||||
|
||||
private:
|
||||
uint16_t entryCount();
|
||||
uint16_t operator[](uint16_t idx);
|
||||
uint16_t getTSAP(uint16_t idx);
|
||||
uint16_t getASAP(uint16_t idx);
|
||||
uint16_t* _tableData = 0;
|
||||
};
|
@ -235,7 +235,7 @@ void TpUartDataLinkLayer::loop()
|
||||
//Destination Address + payload available
|
||||
_xorSum ^= rxByte;
|
||||
//check if echo
|
||||
if (!((buffer[0] ^ _sendBuffer[0]) & ~0x20) && !memcmp(buffer + 2, _sendBuffer + 1, 5))
|
||||
if (!((buffer[0] ^ _sendBuffer[0]) & ~0x20) && !memcmp(buffer + _convert + 1, _sendBuffer + 1, 5))
|
||||
{ //ignore repeated bit of control byte
|
||||
_isEcho = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user