mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	(Prepare for devel) Fix: Do NOT Send when Updating KO Failed on Value Conversion
This commit is contained in:
		
							parent
							
								
									a7d344fae9
								
							
						
					
					
						commit
						9ee6e11ca5
					
				| @ -478,14 +478,29 @@ namespace Knx | |||||||
|             ComFlag _commFlag : 7; |             ComFlag _commFlag : 7; | ||||||
|             uint8_t* _data = 0; |             uint8_t* _data = 0; | ||||||
|             uint8_t _dataLength = 0; |             uint8_t _dataLength = 0; | ||||||
|  | 
 | ||||||
|  |             /**
 | ||||||
|  |              * set the current value of the group object and show success. | ||||||
|  |              * @param value the value the group object is set to | ||||||
|  |              * @param type the datapoint type used for the conversion. | ||||||
|  |              * | ||||||
|  |              * The parameters must fit the group object. Otherwise it will stay unchanged. | ||||||
|  |              * | ||||||
|  |              * @returns true if the value of the group object was updated after successful conversion. | ||||||
|  |              */ | ||||||
|  |             template<class DPT> bool _valueNoSend(const DPT& value); | ||||||
|  | 
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     bool operator==(const GroupObject& lhs, const GroupObject& rhs); |     bool operator==(const GroupObject& lhs, const GroupObject& rhs); | ||||||
| 
 | 
 | ||||||
|     template<class DPT> void GroupObject::value(const DPT& value) |     template<class DPT> void GroupObject::value(const DPT& value) | ||||||
|     { |     { | ||||||
|         valueNoSend(value); |         if (_valueNoSend(value)) | ||||||
|         objectWritten(); |         { | ||||||
|  |             // write on successful conversion/setting value only
 | ||||||
|  |             objectWritten(); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<class DPT> DPT GroupObject::value() |     template<class DPT> DPT GroupObject::value() | ||||||
| @ -508,6 +523,12 @@ namespace Knx | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<class DPT> void GroupObject::valueNoSend(const DPT& value) |     template<class DPT> void GroupObject::valueNoSend(const DPT& value) | ||||||
|  |     { | ||||||
|  |         // ignore actual updating TODO check replacing valueNoSend with _valueNoSend
 | ||||||
|  |         _valueNoSend(value); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     template<class DPT> bool GroupObject::_valueNoSend(const KNXValue& value) | ||||||
|     { |     { | ||||||
|         if (value.size() != sizeCode()) |         if (value.size() != sizeCode()) | ||||||
|             return; |             return; | ||||||
| @ -518,6 +539,8 @@ namespace Knx | |||||||
|         // initialize on succesful conversion only
 |         // initialize on succesful conversion only
 | ||||||
|         if (encodingDone && _uninitialized) |         if (encodingDone && _uninitialized) | ||||||
|             commFlag(Ok); |             commFlag(Ok); | ||||||
|  | 
 | ||||||
|  |         return encodingDone; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     template<class DPT> bool GroupObject::valueNoSendCompare(const DPT& value) |     template<class DPT> bool GroupObject::valueNoSendCompare(const DPT& value) | ||||||
| @ -528,8 +551,7 @@ namespace Knx | |||||||
|         if (_uninitialized) |         if (_uninitialized) | ||||||
|         { |         { | ||||||
|             // always set first value
 |             // always set first value
 | ||||||
|             this->valueNoSend(value); |             return _valueNoSend(value); | ||||||
|             return true; |  | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user