-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Sending Wrong Values on Failed Conversion to DPT #300
Fix Sending Wrong Values on Failed Conversion to DPT #300
Conversation
…setting-invalid-value--thelsing/master # Conflicts: # src/knx/group_object.cpp
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
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
Do you still want to change something or can I merge this? (PR is still draft) |
No need of changes anymore. Note: Testing was only conducted in Upstream/OpenKNX-Environment. |
Merged. Thanks for your contribution. |
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
/valueCompare
resulted in value 0 (and returned change based on this value)valueNoSend
updated state from unitialized to OK, without updating the valuevalue
wrote to GA without setting the KO valueReproduce
For all cases use a value/type combination which results in
KNX_Encode_Value
returnfalse
.Example: value
500
with 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)value
use 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
void
could be changed tobool
to indicate success, without breaking.