-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Claude/i2c-rotary-encoder-ui-AJq6U #5653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "gc9a01_display", | ||
| "build": { "libArchive": false }, | ||
| "dependencies": { | ||
| "bodmer/TFT_eSPI": "~2.5.43", | ||
| "SPI": "" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| ; GC9A01 Round Display usermod — sample build configuration | ||
| ; Copy/rename to platformio_override.ini and adjust pin numbers for your board. | ||
| ; | ||
| ; All SPI pins MUST be set at compile time (TFT_eSPI requirement). | ||
| ; CS / DC / RST / BL can also be changed here freely. | ||
| ; | ||
| ; Default pin assignments below are for a generic ESP32 DevKit: | ||
| ; MOSI = GPIO 23 SCLK = GPIO 18 | ||
| ; CS = GPIO 15 DC = GPIO 2 | ||
| ; RST = GPIO 4 BL = GPIO 32 (set -1 if backlight is always on) | ||
|
|
||
| [env:esp32dev_gc9a01] | ||
| extends = env:esp32dev | ||
| lib_deps = ${esp32dev.lib_deps} | ||
| bodmer/TFT_eSPI @ ~2.5.43 | ||
| build_flags = ${esp32dev.build_flags} | ||
| ; ---- Enable the usermod ---- | ||
| -D USERMOD_GC9A01_DISPLAY | ||
|
|
||
| ; ---- TFT_eSPI configuration ---- | ||
| -D USER_SETUP_LOADED=1 | ||
| -D USER_SETUP_ID=1 | ||
| -D GC9A01_DRIVER=1 | ||
| -D TFT_WIDTH=240 | ||
| -D TFT_HEIGHT=240 | ||
|
|
||
| ; ---- SPI data / clock (shared bus) ---- | ||
| -D TFT_MOSI=23 | ||
| -D TFT_SCLK=18 | ||
| -D TFT_MISO=-1 | ||
|
|
||
| ; ---- Display-specific pins ---- | ||
| -D TFT_CS=15 | ||
| -D TFT_DC=2 | ||
| -D TFT_RST=4 | ||
| -D TFT_BL=32 | ||
| -D TFT_BACKLIGHT_ON=HIGH | ||
|
|
||
| ; ---- Font / feature selection ---- | ||
| -D LOAD_GLCD=1 | ||
| -D LOAD_FONT2=1 | ||
| -D LOAD_FONT4=1 | ||
| -D SMOOTH_FONT=1 | ||
|
|
||
| ; ---- SPI clock speed ---- | ||
| -D SPI_FREQUENCY=40000000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # GC9A01 Round Display Usermod | ||
|
|
||
| Displays WLED state on a **1.28" round IPS LCD** (240×240, GC9A01 driver, 4-wire SPI). | ||
| Tested with the Waveshare 1.28" Round LCD Module. | ||
|
|
||
| ## Watch-face layout | ||
|
|
||
| ``` | ||
| ╭──────────────────╮ | ||
| ╱ │ ░░░░░░░░░░░░░░ │ ╲ ← brightness arc (yellow, 0–360°) | ||
| ╱ │ [Effect Name] │ ╲ | ||
| │ │ ╭────────────╮ │ │ | ||
| │ │ │ │ │ │ ← colour disc (primary segment colour) | ||
| │ │ │ 75 % │ │ │ | ||
| │ │ ╰────────────╯ │ │ | ||
| ╲ │ 192.168.1.10 │ ╱ | ||
| ╲ │ │ ╱ | ||
| ╰──────────────────╯ | ||
| ``` | ||
|
Comment on lines
+8
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a language to the fenced code block. The watch-face diagram block is missing a fence language, which triggers markdownlint MD040. Suggested change-```
+```text
╭──────────────────╮
...
╰──────────────────╯Verify each finding against current code. Fix only still-valid issues, skip the In |
||
|
|
||
| | Element | Content | | ||
| |---|---| | ||
| | Outer arc | Brightness 0-100 % (yellow on dark grey ring) | | ||
| | Centre disc | Primary colour of the main segment | | ||
| | Disc text | Brightness percentage (contrast-adaptive colour) | | ||
| | Upper text | Current effect name | | ||
| | Lower text | IP address / AP mode address / "No WiFi" | | ||
|
|
||
| ## Wiring | ||
|
|
||
| | Display | ESP32 (default) | | ||
| |---|---| | ||
| | VCC | 3.3 V | | ||
| | GND | GND | | ||
| | DIN (MOSI) | GPIO 23 | | ||
| | CLK | GPIO 18 | | ||
| | CS | GPIO 15 | | ||
| | DC | GPIO 2 | | ||
| | RST | GPIO 4 | | ||
| | BL | GPIO 32 | | ||
|
|
||
| ## Building | ||
|
|
||
| Copy `platformio_override.sample.ini` to `platformio_override.ini` and adjust pins for your board. Then build the `esp32dev_gc9a01` environment: | ||
|
|
||
| ```bash | ||
| pio run -e esp32dev_gc9a01 | ||
| ``` | ||
|
|
||
| All eight pin values **must** be set as build flags — TFT_eSPI does not support runtime pin selection. | ||
|
|
||
| ## Configuration (WLED Settings → Usermods) | ||
|
|
||
| | Option | Default | Description | | ||
| |---|---|---| | ||
| | `enabled` | true | Enable/disable the display | | ||
| | `screenTimeoutSec` | 300 | Seconds of inactivity before display blanks (0 = never) | | ||
| | `flip` | false | Rotate display 180° | | ||
|
|
||
| The four pin fields shown in the UI are read-only — they reflect the compile-time values. | ||
|
|
||
| ## Public API (for pairing with other usermods) | ||
|
|
||
| ```cpp | ||
| GC9A01DisplayUsermod *disp = | ||
| (GC9A01DisplayUsermod *)UsermodManager::lookup(USERMOD_ID_GC9A01_DISPLAY); | ||
|
|
||
| if (disp) { | ||
| disp->wakeDisplay(); // wake from sleep; returns true if was off | ||
| disp->showOverlay("Brightness", "75%", 1500); // 2-line overlay for 1.5 s | ||
| disp->forceRedraw(); // immediate full refresh | ||
| } | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: wled/WLED
Length of output: 1114
🌐 Web query:
PlatformIO library.json dependencies Arduino core library SPI💡 Result:
In PlatformIO, you generally do not need to (and should not) explicitly declare core Arduino libraries like SPI, Wire, or SoftwareSerial in your library.json dependencies [1]. These libraries are built-in components of the Arduino core platform [1]. PlatformIO's Library Dependency Finder (LDF) is designed to automatically detect when you include these headers in your code (e.g.,
#include<SPI.h>) and will link the necessary core library automatically during the build process [1]. If you are developing a library and want to ensure it works across different platforms that might handle built-in libraries differently, the recommended approach is: 1. Simply include the required header in your source code [1]. 2. Avoid adding built-in core libraries to the dependencies field in library.json, as this can lead to conflicts or unnecessary installation attempts for packages that are already provided by the core framework [1]. 3. The library.json dependencies field should be reserved for external, third-party libraries that need to be downloaded from the PlatformIO Registry or other repositories [2][3]. If you encounter issues where the compiler cannot find SPI or other core libraries, ensure that your platformio.ini file is correctly configured for the desired board and framework. The LDF is highly capable of resolving these dependencies without manual intervention provided the include statements are present in your source files [1].Citations:
🌐 Web query:
PlatformIO does library.json dependency "SPI" fetch from registry or uses framework💡 Result:
In PlatformIO, "SPI" is typically a built-in library provided by the development framework (such as Arduino or ESP-IDF), not a package fetched from the PlatformIO Registry [1][2]. Because "SPI" is part of the framework, it does not need to be declared in the dependencies section of a library.json file as an external package [3][1]. If you encounter a compilation error stating "SPI.h: No such file or directory," it is often because the PlatformIO Library Dependency Finder (LDF) has not automatically detected the dependency [1][4]. To resolve this without needing to fetch a separate registry library, you can try the following: 1. Use an explicit include: Sometimes adding
#include<SPI.h> directly in your project's main source file helps the LDF discover that the SPI library is required [4][2]. 2. Adjust LDF mode: If the library is nested or hidden, you can change the dependency finder mode in your platformio.ini file to force a deeper search [1][4]. For example: lib_ldf_mode = chain+ Do not attempt to add "SPI" to the library.json dependencies or lib_deps as if it were a third-party library, as this can lead to conflicts or redundant installations [1]. If your project absolutely requires a specific, non-default version of SPI, you must ensure the framework being used provides it [1].Citations:
Remove
SPIfromusermod_v2_gc9a01_displaylibrary.jsondependenciesSPIis a core Arduino framework library; it shouldn’t be declared as a PlatformIO registry dependency inlibrary.json(LDF/framework linkage should handle it based on#include <SPI.h>), and keeping it can add unnecessary dependency-resolution/build variability.Suggested change
"dependencies": { - "bodmer/TFT_eSPI": "~2.5.43", - "SPI": "" + "bodmer/TFT_eSPI": "~2.5.43" }📝 Committable suggestion
🤖 Prompt for AI Agents