mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	move uninitialzed out of ComFlagEx enum
This commit is contained in:
		
							parent
							
								
									1ba39e207f
								
							
						
					
					
						commit
						e988c431fd
					
				| @ -12,8 +12,8 @@ GroupObjectTableObject* GroupObject::_table = 0; | ||||
| GroupObject::GroupObject() | ||||
| { | ||||
|     _data = 0; | ||||
|     _commFlagEx.uninitialized = true; | ||||
|     _commFlagEx.commFlag = Uninitialized; | ||||
|     _uninitialized = true; | ||||
|     _commFlag = Uninitialized; | ||||
|     _dataLength = 0; | ||||
| #ifndef SMALL_GROUPOBJECT | ||||
|     _updateHandler = 0; | ||||
| @ -64,7 +64,7 @@ bool GroupObject::readEnable() | ||||
|         return false; | ||||
| 
 | ||||
|     // we forbid reading of new (uninitialized) go
 | ||||
|     if (_commFlagEx.uninitialized) | ||||
|     if (_uninitialized) | ||||
|         return false; | ||||
| 
 | ||||
|     return bitRead(ntohs(_table->_tableData[_asap]), 11) > 0; | ||||
| @ -161,20 +161,20 @@ size_t GroupObject::asapValueSize(uint8_t code) const | ||||
| 
 | ||||
| ComFlag GroupObject::commFlag() | ||||
| { | ||||
|     return _commFlagEx.commFlag; | ||||
|     return _commFlag; | ||||
| } | ||||
| 
 | ||||
| void GroupObject::commFlag(ComFlag value) | ||||
| { | ||||
|     _commFlagEx.commFlag = value; | ||||
|     _commFlag = value; | ||||
| 
 | ||||
|     if (value == WriteRequest || value == Updated || value == Ok) | ||||
|         _commFlagEx.uninitialized = false; | ||||
|         _uninitialized = false; | ||||
| } | ||||
| 
 | ||||
| bool GroupObject::initialized() | ||||
| { | ||||
|     return !_commFlagEx.uninitialized; | ||||
|     return !_uninitialized; | ||||
| } | ||||
| 
 | ||||
| void GroupObject::requestObjectRead() | ||||
| @ -300,7 +300,7 @@ void GroupObject::valueNoSend(const KNXValue& value) | ||||
| 
 | ||||
| void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type) | ||||
| { | ||||
|     if (_commFlagEx.uninitialized) | ||||
|     if (_uninitialized) | ||||
|         commFlag(Ok); | ||||
| 
 | ||||
|     KNX_Encode_Value(value, _data, _dataLength, type); | ||||
| @ -308,7 +308,7 @@ void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type) | ||||
| 
 | ||||
| bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type) | ||||
| { | ||||
|     if (_commFlagEx.uninitialized) | ||||
|     if (_uninitialized) | ||||
|     { | ||||
|         // always set first value
 | ||||
|         this->valueNoSend(value, type); | ||||
|  | ||||
| @ -18,16 +18,6 @@ enum ComFlag : uint8_t | ||||
|     Uninitialized = 6 //!< uninitialized Group Object, its value is not valid
 | ||||
| }; | ||||
| 
 | ||||
| // extended ComFlag: Uninitialized it not handled correctly as ComFlag
 | ||||
| // it might be in state Transmitting during a ReadRequest on startup while value is still not valid
 | ||||
| // we use MSB to store Uninitialized and keep the size of GroupObject the same saving memory ressources
 | ||||
| // the old Uninitialized handling is still there for compatibility reasons.
 | ||||
| struct ComFlagEx | ||||
| { | ||||
|     bool uninitialized : 1; | ||||
|     ComFlag commFlag : 7; | ||||
| }; | ||||
| 
 | ||||
| class GroupObject; | ||||
| 
 | ||||
| #ifndef HAS_FUNCTIONAL | ||||
| @ -278,7 +268,8 @@ class GroupObject | ||||
|         size_t asapValueSize(uint8_t code) const; | ||||
|         size_t goSize(); | ||||
|         uint16_t _asap = 0; | ||||
|         ComFlagEx _commFlagEx; | ||||
|         bool _uninitialized : 1; | ||||
|         ComFlag _commFlag : 7; | ||||
|         uint8_t* _data = 0; | ||||
|         uint8_t _dataLength = 0; | ||||
| #ifndef SMALL_GROUPOBJECT | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user