mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									f4d7f604be
								
							
						
					
					
						commit
						4f17ed4b5d
					
				@ -74,6 +74,10 @@ bool GroupObject::readEnable()
 | 
				
			|||||||
    if (!_table)
 | 
					    if (!_table)
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // we forbid reading of new (uninitialized) go
 | 
				
			||||||
 | 
					    if (_commFlag == Uninitialized)
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return bitRead(ntohs(_table->_tableData[_asap]), 11) > 0;
 | 
					    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)
 | 
					void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if (_commFlag == Uninitialized)
 | 
				
			||||||
 | 
					        _commFlag = Ok;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    KNX_Encode_Value(value, _data, _dataLength, type);
 | 
					    KNX_Encode_Value(value, _data, _dataLength, type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,8 @@ enum ComFlag
 | 
				
			|||||||
    WriteRequest = 2, //!< Write was requested but was not processed
 | 
					    WriteRequest = 2, //!< Write was requested but was not processed
 | 
				
			||||||
    Transmitting = 3, //!< Group Object is processed a the moment (read or write)
 | 
					    Transmitting = 3, //!< Group Object is processed a the moment (read or write)
 | 
				
			||||||
    Ok = 4,           //!< read or write request were send successfully
 | 
					    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;
 | 
					class GroupObject;
 | 
				
			||||||
@ -235,7 +236,7 @@ class GroupObject
 | 
				
			|||||||
    size_t asapValueSize(uint8_t code);
 | 
					    size_t asapValueSize(uint8_t code);
 | 
				
			||||||
    size_t goSize();
 | 
					    size_t goSize();
 | 
				
			||||||
    uint16_t _asap = 0;
 | 
					    uint16_t _asap = 0;
 | 
				
			||||||
    ComFlag _commFlag = Ok;
 | 
					    ComFlag _commFlag = Uninitialized;
 | 
				
			||||||
    uint8_t* _data = 0;
 | 
					    uint8_t* _data = 0;
 | 
				
			||||||
    uint8_t _dataLength = 0;
 | 
					    uint8_t _dataLength = 0;
 | 
				
			||||||
#ifndef SMALL_GROUPOBJECT
 | 
					#ifndef SMALL_GROUPOBJECT
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user