two more "shadowed locals"

In these case, there seem to be no bug, but  simply renaming the "inner" variables improves code readability.
This commit is contained in:
Frank 2023-04-14 13:09:25 +02:00
parent 996d041581
commit 4a3bc486d0
2 changed files with 7 additions and 7 deletions

View File

@ -1181,12 +1181,12 @@ void WS2812FX::estimateCurrentAndLimitBri() {
uint32_t powerSum = 0; uint32_t powerSum = 0;
for (uint8_t b = 0; b < busses.getNumBusses(); b++) { for (uint_fast8_t bNum = 0; bNum < busses.getNumBusses(); bNum++) {
Bus *bus = busses.getBus(b); Bus *bus = busses.getBus(bNum);
if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses
uint16_t len = bus->getLength(); uint16_t len = bus->getLength();
uint32_t busPowerSum = 0; uint32_t busPowerSum = 0;
for (uint16_t i = 0; i < len; i++) { //sum up the usage of each LED for (uint_fast16_t i = 0; i < len; i++) { //sum up the usage of each LED
uint32_t c = bus->getPixelColor(i); uint32_t c = bus->getPixelColor(i);
byte r = R(c), g = G(c), b = B(c), w = W(c); byte r = R(c), g = G(c), b = B(c), w = W(c);

View File

@ -300,10 +300,10 @@ byte PinManagerClass::allocateLedc(byte channels)
if (ca >= channels) { //enough free channels if (ca >= channels) { //enough free channels
byte in = (i + 1) - ca; byte in = (i + 1) - ca;
for (byte j = 0; j < ca; j++) { for (byte j = 0; j < ca; j++) {
byte b = in + j; byte bChan = in + j;
byte by = b >> 3; byte byChan = bChan >> 3;
byte bi = b - 8*by; byte biChan = bChan - 8*byChan;
bitWrite(ledcAlloc[by], bi, true); bitWrite(ledcAlloc[byChan], biChan, true);
} }
return in; return in;
} }