Skip to content

Commit

Permalink
fix pin conflict check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
PaoloTK authored and blazoncek committed Sep 15, 2024
1 parent 6a90b9a commit e34f179
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,12 +1266,23 @@ void WS2812FX::finalizeInit() {
bool clash;
do {
clash = false;
for (const auto &pin : defDataPins) {
if (pin == defPin[j]) {
defPin[j]++;
if (defPin[j] < WLED_NUM_PINS) clash = true;
// check for conflicts on current bus
for (const auto &pin : defPin) {
if (&pin != &defPin[j] && pin == defPin[j]) {
clash = true;
break;
}
}
// We already have a clash on current bus, no point checking next buses
if (!clash) {
// check for conflicts on next buses
for (unsigned k = pinsIndex + busPins; k < defNumPins; k++) {
if (defDataPins[k] == defPin[j]) {
clash = true;
break;
}
}
if (clash) defPin[j]++;
} while (clash);
}
}
Expand Down

0 comments on commit e34f179

Please sign in to comment.