Skip to content

WLED allows more buttons than physical pins #5387

@softhack007

Description

@softhack007

#define WLED_MAX_BUTTONS 32

C3 has at most 22 possible pins, similar for the upcoming -C5 (max 29 gpio) and -C6 (max 29 gpio).
Some of these are not available because they are reserved for RAM, PSRAM, or Not connected (NC).
Classic esp32 has 39 possible gpio, but 11 of them are not usable => max 28 buttons if you don't connect any LEDs.

Is it intended to allow more buttons than physically possible on the board?


MAX_NUM_PINS is passed to the UI directly, meaning that more buttons can be defined than physicially availeable?

WLED/wled00/xml.cpp

Lines 326 to 338 in 439d4a0

settingsScript.printf_P(PSTR("bLimits(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d);"),
WLED_PLATFORM_ID, // TODO: replace with a info json lookup
MAX_LEDS_PER_BUS,
MAX_LED_MEMORY,
MAX_LEDS,
WLED_MAX_COLOR_ORDER_MAPPINGS,
WLED_MAX_DIGITAL_CHANNELS,
WLED_MAX_RMT_CHANNELS,
WLED_MAX_I2S_CHANNELS,
WLED_MAX_ANALOG_CHANNELS,
WLED_MAX_BUTTONS
);

Edit: Normally i would expect that the max number of buttons is limited by the number of pins allowed as input, or maybe i'm missing something?

   int max_buttons=0;
   for (int bb=0; bb < WLED_NUM_PINS; bb++) 
       if (PinManager::isPinOk(bb, false)) max_buttons++;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions