Skip to content

Conversation

@IwanIDev
Copy link
Owner

See issue #49

Prevents GPIO configuration and reading when button pins are set to invalid values (negative numbers).

Allows InputController to gracefully handle cases where one or both buttons are not physically connected by treating unconfigured pins as permanently unpressed.

Prevents GPIO configuration and reading when button pins are set to invalid values (negative numbers).

Allows InputController to gracefully handle cases where one or both buttons are not physically connected by treating unconfigured pins as permanently unpressed.
@IwanIDev IwanIDev requested a review from Copilot September 18, 2025 14:09
@IwanIDev IwanIDev linked an issue Sep 18, 2025 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds safety checks to prevent GPIO configuration and reading when button pins are set to invalid values, addressing issue #49. The changes allow the InputController to gracefully handle cases where one or both buttons are not physically connected.

  • Adds pin validation checks before configuring GPIO pins with pinMode()
  • Adds pin validation checks before reading button states with digitalRead()
  • Treats unconfigured pins (negative values) as permanently unpressed buttons

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Added an extra condition to the input controller button input method, preventing a digitalRead call on invalid pin numbers.
@IwanIDev IwanIDev merged commit ce60cbb into main Sep 18, 2025
1 of 2 checks passed
@IwanIDev IwanIDev deleted the bugfix/49-random-button-presses-detected branch September 18, 2025 14:13
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.

Bugfix - Random Button Presses Detected

2 participants