Skip to content

Commit 33f4e8c

Browse files
committed
pinmanager bugfix for -S2/-S3
pinmanager ran out out array bounds on -S2 and -S3, as these MCUs have more than 40 GPIO. As consequence, memory was overwriten, and pins > 39 were reported as "allocated" but not "owned". Thisfixes the problem, by extending internal arrays so that up to 50 pins can be managed.
1 parent 643f300 commit 33f4e8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wled00/pin_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ class PinManagerClass {
6969
uint8_t pinAlloc[3] = {0x00, 0x00, 0x00}; //24bit, 1 bit per pin, we use first 17bits
7070
PinOwner ownerTag[17] = { PinOwner::None };
7171
#else
72-
uint8_t pinAlloc[5] = {0x00, 0x00, 0x00, 0x00, 0x00}; //40bit, 1 bit per pin, we use all bits
72+
uint8_t pinAlloc[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // 56bit, 1 bit per pin, we use 50 bits on ESP32-S3
7373
uint8_t ledcAlloc[2] = {0x00, 0x00}; //16 LEDC channels
74-
PinOwner ownerTag[40] = { PinOwner::None };
74+
PinOwner ownerTag[50] = { PinOwner::None }; // new MCU's have up to 50 GPIO
7575
#endif
7676
struct {
7777
uint8_t i2cAllocCount : 4; // allow multiple allocation of I2C bus pins but keep track of allocations

0 commit comments

Comments
 (0)