Skip to content
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 #30

Merged
merged 9 commits into from
Nov 18, 2024

Conversation

cornelius-koepp
Copy link
Member

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 value
  • value wrote to GA without setting the KO value

Reproduce

For all cases use a value/type combination which results in KNX_Encode_Value return false.

Example: value 500 with type DPT_Value_1_Ucount, or any other

Note: 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 to bool to indicate success, without breaking.

@cornelius-koepp cornelius-koepp added the bug Something isn't working label Nov 2, 2024
@cornelius-koepp cornelius-koepp requested a review from mumpf November 2, 2024 20:34
@cornelius-koepp cornelius-koepp changed the title Fix Sending Wrong Values on Failed Convertion to DPT Fix Sending Wrong Values on Failed Conversion to DPT Nov 6, 2024
src/knx/group_object.h Outdated Show resolved Hide resolved
…ersion to DPT

Remove _valueNoSend(..) as valueNoSend(..) is now the same
@cornelius-koepp cornelius-koepp changed the base branch from v1 to v1dev November 17, 2024 22:54
@Ing-Dom
Copy link
Member

Ing-Dom commented Nov 18, 2024

please add a short description in the Changelog about this
then I will merge it
https://github.com/OpenKNX/knx/blob/v1dev/README.md#v1dev-replace-this-with-version-and-date-when-releasing-to-v1

@Ing-Dom Ing-Dom merged commit 2cd5a28 into v1dev Nov 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants