Skip to content

Commit

Permalink
Unsigned fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Sep 4, 2024
1 parent d3c31c5 commit 092a5a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/bus_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,13 @@ void BusPwm::show() {
if (_reversed) duty = maxBri - duty;
analogWrite(_pins[i], duty);
#else
unsigned deadTime = 0;
int deadTime = 0;
if (_type == TYPE_ANALOG_2CH && Bus::getCCTBlend() == 0) {
// add dead time between signals (when using dithering, two full 8bit pulses are required)
deadTime = (1+dithering) << bitShift;
// we only need to take care of shortening the signal at (almost) full brightness otherwise pulses may overlap
if (_bri >= 254 && duty >= maxBri / 2 && duty < maxBri) duty -= deadTime << 1; // shorten duty of larger signal except if full on
if(_reversed) deadTime = -deadTime; // need to invert dead time to make phaseshift go the opposite way so low signals dont overlap
if (_reversed) deadTime = -deadTime; // need to invert dead time to make phaseshift go the opposite way so low signals dont overlap
}
if (_reversed) duty = maxBri - duty;
unsigned channel = _ledcStart + i;
Expand Down

1 comment on commit 092a5a1

@DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented on 092a5a1 Sep 4, 2024

Choose a reason for hiding this comment

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

good catch

Please sign in to comment.