mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Get rid of occsional fails during ETS programming (#200)
- happens just with large applications - occured mainly on SAMD platform - new crc16ccitt algorithm without additional buffer - reorder groupObjTable in memory for less fragmentation Co-authored-by: Waldemar Porscha <waldemar.porscha@sap.com>
This commit is contained in:
parent
e12a074e07
commit
d43703f7bd
@ -23,9 +23,9 @@ BauSystemBDevice::BauSystemBDevice(Platform& platform) :
|
|||||||
_transLayer.groupAddressTable(_addrTable);
|
_transLayer.groupAddressTable(_addrTable);
|
||||||
|
|
||||||
_memory.addSaveRestore(&_deviceObj);
|
_memory.addSaveRestore(&_deviceObj);
|
||||||
|
_memory.addSaveRestore(&_groupObjTable); // changed order for better memory management
|
||||||
_memory.addSaveRestore(&_addrTable);
|
_memory.addSaveRestore(&_addrTable);
|
||||||
_memory.addSaveRestore(&_assocTable);
|
_memory.addSaveRestore(&_assocTable);
|
||||||
_memory.addSaveRestore(&_groupObjTable);
|
|
||||||
#ifdef USE_DATASECURE
|
#ifdef USE_DATASECURE
|
||||||
_memory.addSaveRestore(&_secIfObj);
|
_memory.addSaveRestore(&_secIfObj);
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,15 +125,13 @@ uint64_t sixBytesToUInt64(uint8_t* data)
|
|||||||
uint16_t crc16Ccitt(uint8_t* input, uint16_t length)
|
uint16_t crc16Ccitt(uint8_t* input, uint16_t length)
|
||||||
{
|
{
|
||||||
uint32_t polynom = 0x1021;
|
uint32_t polynom = 0x1021;
|
||||||
uint8_t padded[length+2];
|
|
||||||
|
|
||||||
memcpy(padded, input, length);
|
|
||||||
memset(padded+length, 0x00, 2);
|
|
||||||
|
|
||||||
uint32_t result = 0xffff;
|
uint32_t result = 0xffff;
|
||||||
for (uint32_t i = 0; i < 8 * (uint32_t)sizeof(padded); i++) {
|
for (uint32_t i = 0; i < 8 * ((uint32_t)length + 2); i++)
|
||||||
|
{
|
||||||
result <<= 1;
|
result <<= 1;
|
||||||
uint32_t nextBit = (padded[i / 8] >> (7 - (i % 8))) & 0x1;
|
uint32_t nextBit;
|
||||||
|
nextBit = ((i / 8) < length) ? ((input[i / 8] >> (7 - (i % 8))) & 0x1) : 0;
|
||||||
result |= nextBit;
|
result |= nextBit;
|
||||||
if ((result & 0x10000) != 0)
|
if ((result & 0x10000) != 0)
|
||||||
result ^= polynom;
|
result ^= polynom;
|
||||||
|
Loading…
Reference in New Issue
Block a user