Bugfix: GPIO0 always gets assigned to a button (#5259)
if button pin arg is missing, it defaults to 0 assigning a button to that pin. This change fixes that. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
This commit is contained in:
@@ -279,7 +279,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
int offset = i < 10 ? '0' : 'A' - 10;
|
int offset = i < 10 ? '0' : 'A' - 10;
|
||||||
char bt[4] = "BT"; bt[2] = offset+i; bt[3] = 0; // button pin (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
char bt[4] = "BT"; bt[2] = offset+i; bt[3] = 0; // button pin (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||||
char be[4] = "BE"; be[2] = offset+i; be[3] = 0; // button type (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
char be[4] = "BE"; be[2] = offset+i; be[3] = 0; // button type (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||||
int hw_btn_pin = request->arg(bt).toInt();
|
int hw_btn_pin = request->hasArg(bt) ? request->arg(bt).toInt() : -1;
|
||||||
if (i >= buttons.size()) buttons.emplace_back(hw_btn_pin, request->arg(be).toInt()); // add button to vector
|
if (i >= buttons.size()) buttons.emplace_back(hw_btn_pin, request->arg(be).toInt()); // add button to vector
|
||||||
else {
|
else {
|
||||||
buttons[i].pin = hw_btn_pin;
|
buttons[i].pin = hw_btn_pin;
|
||||||
|
|||||||
Reference in New Issue
Block a user