mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
fix more memory bugs
This commit is contained in:
parent
77a0d6fc2e
commit
3ed796ef93
@ -36,6 +36,7 @@
|
||||
</FileMasks>
|
||||
<TransferNewFilesOnly>false</TransferNewFilesOnly>
|
||||
<IncludeSubdirectories>true</IncludeSubdirectories>
|
||||
<SelectedDirectories />
|
||||
<DeleteDisappearedFiles>true</DeleteDisappearedFiles>
|
||||
<ApplyGlobalExclusionList>true</ApplyGlobalExclusionList>
|
||||
<Extension>
|
||||
@ -110,6 +111,7 @@
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>True</Enabled>
|
||||
<CXXFLAGS>-DMEDIUM_TYPE=5</CXXFLAGS>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
|
@ -92,6 +92,8 @@ void setup()
|
||||
printf("Aenderung senden: %d\n", knx.paramByte(4));
|
||||
printf("Abgleich %d\n", knx.paramByte(5));
|
||||
}
|
||||
else
|
||||
println("not configured");
|
||||
knx.start();
|
||||
}
|
||||
|
||||
|
@ -389,3 +389,9 @@ void BauSystemB::systemNetworkParameterReadIndication(Priority priority, HopCoun
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Memory& BauSystemB::memory()
|
||||
{
|
||||
return _memory;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ class BauSystemB : protected BusAccessUnit
|
||||
DeviceObject& deviceObject();
|
||||
GroupObjectTableObject& groupObjectTable();
|
||||
ApplicationProgramObject& parameters();
|
||||
Memory& memory();
|
||||
bool configured();
|
||||
bool enabled();
|
||||
void enabled(bool value);
|
||||
|
@ -162,7 +162,7 @@ void Memory::freeMemory(uint8_t* ptr)
|
||||
{
|
||||
MemoryBlock* block = _usedList;
|
||||
MemoryBlock* found = nullptr;
|
||||
while (_usedList)
|
||||
while (block)
|
||||
{
|
||||
if (block->address == ptr)
|
||||
{
|
||||
@ -213,15 +213,16 @@ MemoryBlock* Memory::removeFromList(MemoryBlock* head, MemoryBlock* item)
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
while (head)
|
||||
MemoryBlock* block = head;
|
||||
while (block)
|
||||
{
|
||||
if (head->next == item)
|
||||
if (block->next == item)
|
||||
{
|
||||
found = true;
|
||||
head->next = item->next;
|
||||
block->next = item->next;
|
||||
break;
|
||||
}
|
||||
head = head->next;
|
||||
block = block->next;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
@ -374,7 +375,7 @@ void Memory::addNewUsedBlock(uint8_t* address, size_t size)
|
||||
{
|
||||
// we take a middle or end part of the block
|
||||
uint8_t* oldEndAddr = smallerFreeBlock->address + smallerFreeBlock->size;
|
||||
smallerFreeBlock->size -= (address - smallerFreeBlock->address);
|
||||
smallerFreeBlock->size = (address - smallerFreeBlock->address);
|
||||
|
||||
if (address + size < oldEndAddr)
|
||||
{
|
||||
|
@ -220,6 +220,12 @@ void TableObject::loadEventLoaded(uint8_t* data)
|
||||
break;
|
||||
case LE_UNLOAD:
|
||||
loadState(LS_UNLOADED);
|
||||
//free nv memory
|
||||
if (_data)
|
||||
{
|
||||
_memory.freeMemory(_data);
|
||||
_data = 0;
|
||||
}
|
||||
break;
|
||||
case LE_ADDITIONAL_LOAD_CONTROLS:
|
||||
loadState(LS_ERROR);
|
||||
|
Loading…
Reference in New Issue
Block a user