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

DPT 251.600 RGBW added #41

Merged
merged 4 commits into from
Nov 28, 2021
Merged

DPT 251.600 RGBW added #41

merged 4 commits into from
Nov 28, 2021

Conversation

korpa
Copy link

@korpa korpa commented Nov 28, 2021

This pull request adds DPT 251.600. As it is a combined data type I thought the best solution is to create a struct for the 4 color unit8 and 4 color valid bits.

What do you think?

	orange := dpt.DPT_251600{Red: 255, Green: 96, Blue: 0, White: 18, RedValid: true, GreenValid: true, BlueValid: true, WhiteValid: true}

	err = client.Send(knx.GroupEvent{
		Command:     knx.GroupWrite,
		Destination: cemi.NewGroupAddr3(3, 0, 0),
		Data:        orange.Pack(),
	})
	if err != nil {
		log.Fatal(err)
	}

Copy link
Owner

@vapourismo vapourismo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the contribution!

There are just a few things to be addressed, then it can be merged :)

knx/dpt/formats.go Outdated Show resolved Hide resolved
knx/dpt/types_251_test.go Outdated Show resolved Hide resolved
@@ -30,6 +30,40 @@ func unpackB1(data []byte, b *bool) error {
return nil
}

func packB4(b0 bool, b1 bool, b2 bool, b3 bool) byte {
var b int
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be of type byte (or uint8).

knx/dpt/formats.go Outdated Show resolved Hide resolved
knx/dpt/formats.go Outdated Show resolved Hide resolved
knx/dpt/formats.go Outdated Show resolved Hide resolved
@vapourismo vapourismo merged commit 8198fa1 into vapourismo:master Nov 28, 2021
@korpa
Copy link
Author

korpa commented Nov 28, 2021

Thank you very much. Then I can remove following line of my go.mod :)

replace github.com/vapourismo/knx-go => ../../knx-go

@korpa korpa mentioned this pull request Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants