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

fixed offsets and inverted signal plus dead time #4126

Merged
merged 6 commits into from
Sep 5, 2024

Conversation

DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Sep 2, 2024

No description provided.

DedeHai and others added 4 commits September 2, 2024 17:53
- fixed maxBri value
- fixed overflow in dead time subtraction
- deadtime and offset now also work if signals are inverted (_reversed)
- renamed variables
- some tuning
@blazoncek
Copy link
Collaborator

I think this does it. I tried to optimise a bit (inverted signal is inverted on all channels so needs no special treatment).
Also named variables to be more logical.
When you have time please verify if it still works as intended. 😇

@DedeHai
Copy link
Collaborator Author

DedeHai commented Sep 4, 2024

it does not ;)

  • dead time must be added regardless of hpoint
  • dead time must be added BEFORE inverting
  • hpoint shift must be reversed if inverted (inverted means on if signal is low, so low pulses must not overlap. when using an H-bridge inverting is only required if not using any driver i.e. built with transistors. there the signals can be inverted (low is on).

I will fix these points, test and commit.
edit: I just had an idea how to better handle pulse shortening in a better way, will try it later

@blazoncek
Copy link
Collaborator

Turns out this is a nice brain gym! 😄

I think there is no distinction between normal and inverted signal. It is just the logical interpretation of the brightness slider orientation. If it is set to 32 or 224, dead time follows the pulse regardless of its width.

And hPoint is just the amount of time (in single bit pulses) that need to pass before the output goes high.

So if our duty is 32 with a dead time of 2 our hPoint will be 34. Similar when 224, it will be 226. So the second output will be delayed appropriately. Remember that the second output is also inverted and the sum _data[0]+_data[1] is always less or equal to 255.

@DedeHai
Copy link
Collaborator Author

DedeHai commented Sep 4, 2024

you forgot two things:
a) if you invert before adding dead time, negative pulses are enlarged not shortened
b) on inverted signals, the low pulse must be shifted 'to the left'
this is all very easy to see on a scope ;)

@blazoncek
Copy link
Collaborator

I will trust you on this. 😄

There is a small error though. deadTime is unsigned.

@blazoncek
Copy link
Collaborator

@DedeHai are you comfortable if I merge this? I will then PR bus config branch.

@DedeHai
Copy link
Collaborator Author

DedeHai commented Sep 5, 2024

sure go ahead, I tested the CCT signals and they were looking good, also RGBW was ok. I did not test multiple RGB outputs (I did test the timer assignment earlier and that code did not change).
bugfixes are always possible later

@blazoncek blazoncek merged commit 55d98ff into Aircoookie:bus-config Sep 5, 2024
18 checks passed
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