feat: GC9A01 round TFT display support#113
Conversation
📝 WalkthroughWalkthroughThe PR adds runtime-selectable TFT driver configuration, replacing compile-time panel selection. A UI control for driver choice (ST7789/GC9A01) is added, the selection is persisted via NVS, and TFTManager is initialized with the configured driver at application startup. Changes
Sequence DiagramsequenceDiagram
actor User
User->>WebServerManager: POST /api/config with tft_driver
WebServerManager->>ConfigurationManager: saveToNVS(update)
ConfigurationManager->>NVS: write tft_driver key
User->>Device: Power cycle / Reset
Device->>main.cpp: setup()
main.cpp->>ConfigurationManager: loadFromNVS()
ConfigurationManager->>NVS: read tft_driver
ConfigurationManager->>main.cpp: return config
main.cpp->>ConfigurationManager: getTftDriver()
ConfigurationManager->>main.cpp: return "st7789" or "gc9a01"
main.cpp->>main.cpp: determine TFTDriver enum value
main.cpp->>TFTManager: new TFTManager(selected_driver)
TFTManager->>TFTConfig: LGFX(driver)
TFTConfig->>TFTConfig: select panel_st7789 or panel_gc9a01
TFTConfig->>LGFXLibrary: setPanel(selected_panel)
TFTManager->>main.cpp: initialization complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main.cpp`:
- Line 351: The single-line guarded call "if (tftManagerPtr)
tftManagerPtr->showReady();" should be changed to use braces for consistency and
safety; locate the conditional that calls tftManagerPtr->showReady() and replace
it with a braced block (if (tftManagerPtr) { tftManagerPtr->showReady(); }) so
future additions won't introduce bugs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c14e02c7-4598-4512-9888-8f0ce6f9934f
📒 Files selected for processing (8)
src/ConfigHTML.hsrc/ConfigurationManager.cppsrc/ConfigurationManager.hsrc/TFTConfig.hsrc/TFTManager.cppsrc/TFTManager.hsrc/WebServerManager.cppsrc/main.cpp
|
|
||
| if (config.isTftEnabled()) { | ||
| tftManager.showReady(); | ||
| if (tftManagerPtr) tftManagerPtr->showReady(); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Add braces around single-line statement for consistency.
The guarded showReady() call should use braces for consistency with the rest of the codebase and to prevent future maintenance errors.
🔧 Suggested fix
if (config.isTftEnabled()) {
- if (tftManagerPtr) tftManagerPtr->showReady();
+ if (tftManagerPtr) {
+ tftManagerPtr->showReady();
+ }
} else if (config.isLcdEnabled()) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (tftManagerPtr) tftManagerPtr->showReady(); | |
| if (tftManagerPtr) { | |
| tftManagerPtr->showReady(); | |
| } |
🧰 Tools
🪛 Clang (14.0.6)
[note] 351-351: +2, including nesting penalty of 1, nesting level increased to 2
(clang)
[warning] 351-351: implicit conversion 'TFTManager *' -> bool
(readability-implicit-bool-conversion)
[warning] 351-351: statement should be inside braces
(readability-braces-around-statements)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main.cpp` at line 351, The single-line guarded call "if (tftManagerPtr)
tftManagerPtr->showReady();" should be changed to use braces for consistency and
safety; locate the conditional that calls tftManagerPtr->showReady() and replace
it with a braced block (if (tftManagerPtr) { tftManagerPtr->showReady(); }) so
future additions won't introduce bugs.
Summary
Test plan
Summary by CodeRabbit