Skip to content

ESP32-S3: adjust board pin mappings and make encoder optional in UI#49

Open
ovelhaaa wants to merge 2 commits into
mainfrom
codex/check-display-implementation-based-on-pinout
Open

ESP32-S3: adjust board pin mappings and make encoder optional in UI#49
ovelhaaa wants to merge 2 commits into
mainfrom
codex/check-display-implementation-based-on-pinout

Conversation

@ovelhaaa

Copy link
Copy Markdown
Owner

Motivation

  • Correct physical GPIO assignments to match the current hardware wiring (PCM1808 I2S, TFT Feather) and move the bypass button to a free pin to avoid conflicts.
  • Allow the UI to run on board revisions that do not provide an encoder or that repurpose default JTAG pins by making encoder usage optional at runtime.

Description

  • Updated targets/embedded_esp32s3/main/board_config.h pin constants: changed TFT SPI CS from GPIO 37 to 7, shifted TFT kDcGpio/kResetGpio/kBacklightGpio to new GPIOs, and moved controls::kBypassButton from GPIO 5 to 9 to avoid signal overlap.
  • Preserved audio I2S pin mapping comments and explicit PCM1808 pin choices to reflect validated wiring for RX/MCLK.
  • Modified targets/embedded_esp32s3/main/ui_app.h to add an encoder_available_ flag, conditionalize encoder initialization and button updates, and guard encoder_.getDelta() and enc_btn_ usage so the UI operates correctly when no mechanical encoder is present.

Testing

  • Compiled the firmware for the embedded_esp32s3 target to validate the changes to headers and UI source, and the build succeeded.
  • No automated unit tests were added or modified as part of this change.

Codex Task

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@ovelhaaa has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 19 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1411cb4-f0b2-466b-9109-0e0a1590d066

📥 Commits

Reviewing files that changed from the base of the PR and between 9bd445a and 87ff76e.

📒 Files selected for processing (2)
  • targets/embedded_esp32s3/main/board_config.h
  • targets/embedded_esp32s3/main/ui_app.h
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/check-display-implementation-based-on-pinout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 37 minutes and 19 seconds.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3362870e1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread targets/embedded_esp32s3/main/ui_app.h Outdated

if (!encoder_.init()) return false;
enc_btn_.init();
encoder_available_ = encoder_.init();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Don’t infer encoder presence from PCNT init success

Using encoder_.init() as the runtime availability check conflates driver setup with physical hardware presence: Encoder::init() only allocates/configures PCNT resources and does not verify that an encoder is actually populated, so on encoder-less board revisions encoder_available_ can still become true and tick() will process getDelta() from un-driven A/B inputs, causing unintended menu navigation/parameter edits. This breaks the stated “optional encoder” behavior specifically on boards without the encoder installed.

Useful? React with 👍 / 👎.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates GPIO pin assignments for the ESP32-S3 target and introduces logic to conditionally handle encoder-based UI interactions based on initialization success. Feedback points out that GPIO 45 is a strapping pin that could cause boot failures if used for the backlight, and suggests that the encoder initialization check may not accurately detect physical hardware presence.

constexpr int kBacklightGpio = 40;
constexpr int kDcGpio = 39;
constexpr int kResetGpio = 40;
constexpr int kBacklightGpio = 45;

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.

high

GPIO 45 is a strapping pin on the ESP32-S3 (MTMS) that determines the VDD_SPI voltage (1.8V vs 3.3V) at boot. If the backlight circuitry (or the display's internal pull-ups) holds this pin high during reset, the chip will attempt to drive the flash at 1.8V. This will cause a boot failure on most standard ESP32-S3 modules which use 3.3V flash. Consider using a different, non-strapping GPIO to ensure reliable booting across different hardware revisions.

Comment thread targets/embedded_esp32s3/main/ui_app.h Outdated

if (!encoder_.init()) return false;
enc_btn_.init();
encoder_available_ = encoder_.init();

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.

medium

The encoder_.init() call typically only fails if the ESP32's internal PCNT resources are exhausted; it does not detect the physical presence of an encoder. If the goal is to support board revisions without an encoder at runtime, this check might always return true even if no encoder is connected. This would lead to the UI displaying non-functional navigation instructions (e.g., 'ENC: NAVIGATE'). Consider implementing a hardware-based detection or using a configuration flag if physical detection is not feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant