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

Allow all 5 PWM channels individually adressable with LEDs. #5748

Merged
merged 5 commits into from
May 5, 2019

Conversation

s-hadinger
Copy link
Collaborator

Description:

This is the last stage of lights managemenent refactoring of #5667, #5702, #5742. This change allows for individual setting of each of the 5 PMW channels, whatever color or CT mode. The behavior corrects a regression from #5702.

Exemple:

You can now issue the command (with 5 PMW devices)

Color #1020304050

Result:

17:25:01 CMD: Color #1020304050
17:25:01 RSL: stat/sonoff/RESULT = {"POWER":"ON","Dimmer":31,"Color":"1020304050","HSBColor":"210,67,19","Channel":[6,13,19,25,31],"CT":307}

**Related issue (if applicable): #5741

Implementation:

Internally, the Light state moved from implicit color-mode (based on CT, brightness and Option37) to a simpler and more convenient explicit color-mode through flags.

Checklist:

  • The pull request is done against the latest dev branch
  • Only relevant files were touched (Also remember to update changelog.ino file)
  • Only one feature/fix was added per PR.
  • The code change is tested and works.
  • The code change pass travis tests. Your PR cannot be merged unless tests pass
  • I accept the CLA.

@arendst arendst merged commit fa64a0b into arendst:development May 5, 2019
@s-hadinger
Copy link
Collaborator Author

@blakadder I'm not sure we need to update the wiki, as we are simply back to previous behavior.

The PR #5702 prevented from chosing levels of PMW4 and PMW5 separately, because they were always linked by CT (white color temp). With this PR, you can now specifiy each PMW value separately.

Normal operation is the following:

  • HSBColor1 xx to HSBColor3 xx will automatically reset channels 4 and 5 - we switch to RGB mode.
  • CT xx will automatically reset channels 1 to 3 - we switch to White mode.
  • Color #112233 will automatically reset channels 4 and 5 - they are implicitly set to zero like if you had typed Color #1122330000

But the following commands will allow to have both RGB and White at the same time:

  • Color #1122334455 to will set all five LEDS at once
  • Channel1 to Channel5 will also set the corresponding value for one LED without changing the others.

Now if you SetOption 37 to something greater than 128, then HSBColor will keep channels 4-5 unchanged, and CT will not change channels 1-3.

@blakadder
Copy link
Collaborator

Ah great! Thanks a lot! Great work on the color management

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.

3 participants