Feature: Uninitialized GO handling (#187)

- don't send senseless values on GroupValueRead

Co-authored-by: Waldemar Porscha <waldemar.porscha@sap.com>
This commit is contained in:
mumpf 2022-03-01 17:28:11 +01:00 committed by GitHub
parent f4d7f604be
commit 4f17ed4b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -74,6 +74,10 @@ bool GroupObject::readEnable()
if (!_table)
return false;
// we forbid reading of new (uninitialized) go
if (_commFlag == Uninitialized)
return false;
return bitRead(ntohs(_table->_tableData[_asap]), 11) > 0;
}
@ -270,5 +274,8 @@ void GroupObject::valueNoSend(const KNXValue& value)
void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
{
if (_commFlag == Uninitialized)
_commFlag = Ok;
KNX_Encode_Value(value, _data, _dataLength, type);
}

View File

@ -14,7 +14,8 @@ enum ComFlag
WriteRequest = 2, //!< Write was requested but was not processed
Transmitting = 3, //!< Group Object is processed a the moment (read or write)
Ok = 4, //!< read or write request were send successfully
Error = 5 //!< there was an error on processing a request
Error = 5, //!< there was an error on processing a request
Uninitialized = 6 //!< uninitialized Group Object, its value is not valid
};
class GroupObject;
@ -235,7 +236,7 @@ class GroupObject
size_t asapValueSize(uint8_t code);
size_t goSize();
uint16_t _asap = 0;
ComFlag _commFlag = Ok;
ComFlag _commFlag = Uninitialized;
uint8_t* _data = 0;
uint8_t _dataLength = 0;
#ifndef SMALL_GROUPOBJECT