ESP32-S3: adjust board pin mappings and make encoder optional in UI#49
ESP32-S3: adjust board pin mappings and make encoder optional in UI#49ovelhaaa wants to merge 2 commits into
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 37 minutes and 19 seconds.Comment |
There was a problem hiding this comment.
💡 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".
|
|
||
| if (!encoder_.init()) return false; | ||
| enc_btn_.init(); | ||
| encoder_available_ = encoder_.init(); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
|
|
||
| if (!encoder_.init()) return false; | ||
| enc_btn_.init(); | ||
| encoder_available_ = encoder_.init(); |
There was a problem hiding this comment.
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.
Motivation
Description
targets/embedded_esp32s3/main/board_config.hpin constants: changed TFT SPI CS from GPIO 37 to 7, shifted TFTkDcGpio/kResetGpio/kBacklightGpioto new GPIOs, and movedcontrols::kBypassButtonfrom GPIO 5 to 9 to avoid signal overlap.targets/embedded_esp32s3/main/ui_app.hto add anencoder_available_flag, conditionalize encoder initialization and button updates, and guardencoder_.getDelta()andenc_btn_usage so the UI operates correctly when no mechanical encoder is present.Testing
embedded_esp32s3target to validate the changes to headers and UI source, and the build succeeded.Codex Task