busmanger cannot handle more than 5 pins (hardcoded)
sizeof(pins)/sizeof(pins[0]) is the number of array elements in pins[].
This commit is contained in:
@@ -54,7 +54,7 @@ struct BusConfig {
|
||||
uint8_t skipAmount;
|
||||
bool refreshReq;
|
||||
uint8_t autoWhite;
|
||||
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255};
|
||||
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255}; // WLEDMM warning: this means that BusConfig cannot handle nore than 5 pins per bus!
|
||||
uint16_t frequency;
|
||||
BusConfig(uint8_t busType, uint8_t* ppins, uint16_t pstart, uint16_t len = 1, uint8_t pcolorOrder = COL_ORDER_GRB, bool rev = false, uint8_t skip = 0, byte aw=RGBW_MODE_MANUAL_ONLY, uint16_t clock_kHz=0U) {
|
||||
refreshReq = (bool) GET_BIT(busType,7);
|
||||
@@ -65,7 +65,7 @@ struct BusConfig {
|
||||
else if (type > 47) nPins = 2;
|
||||
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
||||
else if (type >= TYPE_HUB75MATRIX && type <= (TYPE_HUB75MATRIX + 10)) nPins = 0;
|
||||
for (uint8_t i = 0; i < min(unsigned(nPins),5U); i++) pins[i] = ppins[i]; //softhack007 fix for potential array out-of-bounds access
|
||||
for (uint8_t i = 0; i < min(unsigned(nPins), sizeof(pins)/sizeof(pins[0])); i++) pins[i] = ppins[i]; //softhack007 fix for potential array out-of-bounds access
|
||||
}
|
||||
|
||||
//validates start and length and extends total if needed
|
||||
|
||||
Reference in New Issue
Block a user