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