This commit is contained in:
leoujz 2020-06-24 21:00:56 +08:00
parent 5ceb018b12
commit 9803de2166
2 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,11 @@ void BauSystemB::sendNextGroupTelegram()
}
else if (flag == ReadRequest)
{
_appLayer.groupValueReadRequest(AckRequested, asap, go.priority(), NetworkLayerParameter);
// do not send read_on_init request when configuring, or else would crash. this is judged by last PropertyValueWrite telegram received time
// it works under my test, although it might not be the best way
if(_lastPropertyValueWriteTime == 0 || millis() - _lastPropertyValueWriteTime > 10000) {
_appLayer.groupValueReadRequest(AckRequested, asap, go.priority(), NetworkLayerParameter);
}
}
go.commFlag(Transmitting);
@ -209,6 +213,7 @@ void BauSystemB::propertyDescriptionReadIndication(Priority priority, HopCountTy
void BauSystemB::propertyValueWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex, uint8_t* data, uint8_t length)
{
_lastPropertyValueWriteTime = millis();
InterfaceObject* obj = getInterfaceObject(objectIndex);
if(obj)
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);

View File

@ -38,6 +38,8 @@ class BauSystemB : protected BusAccessUnit
uint8_t& numberOfElements, uint16_t startIndex,
uint8_t* data, uint32_t length) override;
uint32_t _lastPropertyValueWriteTime = 0;
protected:
virtual DataLinkLayer& dataLinkLayer() = 0;
void memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number,