diff --git a/src/knx/group_object.cpp b/src/knx/group_object.cpp index db92058..6f19247 100644 --- a/src/knx/group_object.cpp +++ b/src/knx/group_object.cpp @@ -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); } diff --git a/src/knx/group_object.h b/src/knx/group_object.h index 91c8b56..88ce274 100644 --- a/src/knx/group_object.h +++ b/src/knx/group_object.h @@ -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