Fix Sending Wrong Values on Failed Conversion to DPT#300
Merged
thelsing merged 11 commits intothelsing:masterfrom Nov 19, 2024
Merged
Conversation
…setting-invalid-value--thelsing/master # Conflicts: # src/knx/group_object.cpp
Owner
|
Changing the void methods to bool to signal success seems like a good idea for me. A stable API is not that important. Constant improvement of the code is :-) |
…object-setting-invalid-value--thelsing/master
Contributor
Author
I'll prepare a draft. See #301 for modified PR for devel. |
…ersion to DPT Remove _valueNoSend(..) as valueNoSend(..) is now the same
…object-setting-invalid-value--thelsing/master # Conflicts: # src/knx/group_object.h
Owner
|
Do you still want to change something or can I merge this? (PR is still draft) |
Contributor
Author
No need of changes anymore. Note: Testing was only conducted in Upstream/OpenKNX-Environment. |
Owner
|
Merged. Thanks for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Limitation (for redesign on devel): This fix will not work with current implementation. See separate PR #301
Issue
Setting a value which cannot be converted to the given DPT did result in unexpected behaviour.
valueNoSendCompare/valueCompareresulted in value 0 (and returned change based on this value)valueNoSendupdated state from unitialized to OK, without updating the valuevaluewrote to GA without setting the KO valueReproduce
For all cases use a value/type combination which results in
KNX_Encode_Valuereturnfalse.Example: value
500with typeDPT_Value_1_Ucount, or any otherNote: DPT1 will not fail; ignoring all other bits.
valueNoSendCompare/valueCompare: did always set value to 0 (no special preconditions needed beside conversion fail)valueNoSend: use before any other change of KO. No change in value expected, but read requests will answered (with undefined value)valueuse before any other change of KO. Will result in write telegram (with other value included)Fix
Suppress updating, status-update and sending for invalid values.
To Discuss
The fix does not change the public interface for changing/writing KO values, so there will be no feedback if conversion fails. Current methods return type
voidcould be changed toboolto indicate success, without breaking.