Skip to content

clean up double i2c init/scan code#7359

Merged
caveman99 merged 1 commit into
masterfrom
i2c-cleanup
Jul 16, 2025
Merged

clean up double i2c init/scan code#7359
caveman99 merged 1 commit into
masterfrom
i2c-cleanup

Conversation

@caveman99

Copy link
Copy Markdown
Member

No description provided.

@caveman99 caveman99 requested review from Copilot and thebentern July 16, 2025 13:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies the conditional compilation around I2C device scanning by merging multiple #if/#elif branches and removing explicit Wire/Wire1 initialization calls.

  • Consolidate WIRE1 scan conditions into a single #if with an OR.
  • Remove platform-specific Wire/Wire1 begin(), setSDA(), and setSCL() calls.
  • Retain the WIRE scan under a distinct #if defined(I2C_SDA) block.
Comments suppressed due to low confidence (1)

src/main.cpp:519

  • The code now scans WIRE1 without any prior Wire1.begin() or SDA/SCL configuration. Ensure that Wire1 is initialized (e.g., setSDA(), setSCL(), and begin()) before calling scanPort.
    i2cScanner->scanPort(ScanI2C::I2CPort::WIRE1);

Comment thread src/main.cpp

@fifieldt fifieldt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice find, I can't see any reason this should be duplicated.

@caveman99 caveman99 merged commit 55fc4fc into master Jul 16, 2025
52 checks passed
caveman99 added a commit that referenced this pull request Jul 16, 2025
@caveman99 caveman99 deleted the i2c-cleanup branch July 16, 2025 22:41
oscgonfer pushed a commit to fablabbcn/smartcitizen-meshtastic that referenced this pull request Jul 22, 2025
oscgonfer pushed a commit to fablabbcn/smartcitizen-meshtastic that referenced this pull request Jul 23, 2025
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
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.

3 participants