Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 1, 2026

On ESP8266, GPIO0 defaults to button input but cannot be reassigned to LED output even when the button is disabled. The pin conflict checker unconditionally flags all button GPIO pins as in-use regardless of button state.

Changes

  • Modified pin conflict detection in settings_leds.htm to check button type before marking pin as used
  • Button pins only conflict when button type is not "Disabled" (value != 0)
  • IR and Relay pins remain unconditionally reserved

Implementation

Two instances of the conflict check were updated (in pinsOK() and UI() functions):

// Before: all button pins always conflict
d.Sf.querySelectorAll("select.pin").forEach((e)=>{
  if(e.value>-1) p.push(parseInt(e.value));
})

// After: only enabled buttons conflict
d.Sf.querySelectorAll("select.pin").forEach((e)=>{
  if(e.value>-1) {
    if (e.name.startsWith("BT")) {
      let btnTypeField = d.Sf["BE" + e.name.substring(2)];
      if (btnTypeField && btnTypeField.value != "0") {
        p.push(parseInt(e.value));
      }
    } else {
      p.push(parseInt(e.value));
    }
  }
})

Users can now set button type to "Disabled" or GPIO to "-1" to free the pin for LED use.

Original prompt

This section details on the original issue you should resolve

<issue_title>ESP8266: GPIO0 can't be used as an output</issue_title>
<issue_description>### What happened?

GPIO0 always gets assigned to a button

To Reproduce Bug

Set GPIO0 as LED output

Expected Behavior

Save correctly

Install Method

Self-Compiled

What version of WLED?

0.16

Which microcontroller/board are you seeing the problem on?

ESP8266

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

<agent_instructions>please find the reason GPIO0 always gets assigned to button. I susect an issue in settings_leds.htm </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 1, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Modified pin conflict detection to check if buttons are enabled before considering their GPIO pins as "in use". Disabled buttons (type = 0) no longer block GPIO reassignment to LED outputs.

Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GPIO0 assignment issue for LED output Fix GPIO0 pin conflict detection when button is disabled Jan 1, 2026
Copilot AI requested a review from DedeHai January 1, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESP8266: GPIO0 can't be used as an output

2 participants