fixed memoryread and crash while loading KOs (+debugstuff)

This commit is contained in:
SirSydom 2022-02-09 23:57:53 +01:00
parent d742752e72
commit e1c0629819
6 changed files with 30 additions and 4 deletions

View File

@ -112,9 +112,15 @@ void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType,
uint16_t memoryAddress, uint8_t * data)
{
_memory.writeMemory(memoryAddress, number, data);
Serial.println("memoryWriteIndication");
if (_deviceObj.verifyMode())
memoryReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress);
memoryReadIndicationP(priority, hopType, asap, secCtrl, number, memoryAddress, data);
}
void BauSystemB::memoryReadIndicationP(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,
uint16_t memoryAddress, uint8_t * data)
{
applicationLayer().memoryReadResponse(AckRequested, priority, hopType, asap, secCtrl, number, memoryAddress, data);
}
void BauSystemB::memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,
@ -206,6 +212,12 @@ void BauSystemB::propertyDescriptionReadIndication(Priority priority, HopCountTy
void BauSystemB::propertyValueWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t objectIndex,
uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex, uint8_t* data, uint8_t length)
{
Serial.print("propertyValueWriteIndication: ");
Serial.println(propertyId);
if(propertyId == 5 && objectIndex == 3)
{
Serial.println("gotcha");
}
InterfaceObject* obj = getInterfaceObject(objectIndex);
if(obj)
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);
@ -246,6 +258,11 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop
else
elementCount = 0;
if(objectIndex == 1 && propertyId == 27)
{
Serial.print(" ");
}
uint8_t data[size];
if(obj)
obj->readProperty((PropertyID)propertyId, startIndex, elementCount, data);

View File

@ -48,6 +48,8 @@ class BauSystemB : protected BusAccessUnit
uint16_t memoryAddress, uint8_t* data) override;
void memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,
uint16_t memoryAddress) override;
void memoryReadIndicationP(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,
uint16_t memoryAddress, uint8_t * data);
void memoryExtWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,
uint32_t memoryAddress, uint8_t* data) override;
void memoryExtReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl, uint8_t number,

View File

@ -82,11 +82,11 @@ void GroupObjectTableObject::beforeStateChange(LoadState& newState)
_tableData = (uint16_t*)data();
if (!initGroupObjects())
/*if (!initGroupObjects())
{
newState = LS_ERROR;
TableObject::errorCode(E_SOFTWARE_FAULT);
}
}*/
}
bool GroupObjectTableObject::initGroupObjects()

View File

@ -146,6 +146,11 @@ void Memory::writeMemory()
_platform.commitNonVolatileMemory();
}
void Memory::saveMemory()
{
_platform.commitNonVolatileMemory();
}
void Memory::addSaveRestore(SaveRestore* obj)
{
if (_saveCount >= MAXSAVE - 1)

View File

@ -31,6 +31,7 @@ public:
virtual ~Memory();
void readMemory();
void writeMemory();
void saveMemory();
void addSaveRestore(SaveRestore* obj);
void addSaveRestore(TableObject* obj);

View File

@ -82,6 +82,7 @@ void NetworkLayerDevice::dataIndication(AckType ack, AddressType addrType, uint1
return;
_transportLayer.dataIndividualIndication(destination, hopType, priority, source, npdu.tpdu());
Serial.println("NL:dI");
return;
}