Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions usermods/usermod_v2_gc9a01_display/library.json
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": ""
}
Comment on lines +4 to +7
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# List all usermod library.json files
fd -a "library.json" usermods -t f > /tmp/usermod_library_jsons.txt

echo "Found $(wc -l < /tmp/usermod_library_jsons.txt) usermod library.json files."

# Count occurrences of "SPI" in dependency blocks
echo "=== Occurrences of \"SPI\" in usermods/library.json ==="
rg -n '"SPI"\s*:' usermods --glob '**/library.json' || true

# Show a few representative manifests that mention SPI (limit output)
echo
echo "=== Sample manifests containing \"SPI\" ==="
rg -n '"SPI"\s*:' usermods --glob '**/library.json' | head -n 20 | cut -d: -f1 | sort -u | head -n 20 > /tmp/spi_manifest_paths.txt || true
if [ -s /tmp/spi_manifest_paths.txt ]; then
  while read -r p; do
    echo "--- $p ---"
    cat -n "$p" | sed -n '1,120p'
  done < /tmp/spi_manifest_paths.txt
else
  echo "No usermod manifests with \"SPI\" dependency found."
fi

# Also check non-usermod library.json in repo (if any)
echo
echo "=== Occurrences of \"SPI\" in all library.json files ==="
fd -a "library.json" -t f > /tmp/all_library_jsons.txt
rg -n '"SPI"\s*:' $(cat /tmp/all_library_jsons.txt) || true

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 SPI from usermod_v2_gc9a01_display library.json dependencies

SPI is a core Arduino framework library; it shouldn’t be declared as a PlatformIO registry dependency in library.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

‼️ 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.

Suggested change
"dependencies": {
"bodmer/TFT_eSPI": "~2.5.43",
"SPI": ""
}
"dependencies": {
"bodmer/TFT_eSPI": "~2.5.43"
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@usermods/usermod_v2_gc9a01_display/library.json` around lines 4 - 7, The
library.json currently lists "SPI": "" under "dependencies" which is incorrect
because SPI is a core framework library; remove the "SPI" entry from the
"dependencies" object in usermod_v2_gc9a01_display's library.json so dependency
resolution relies on framework includes (e.g., `#include` <SPI.h>) and only keep
external entries like "bodmer/TFT_eSPI": "~2.5.43".

}
46 changes: 46 additions & 0 deletions usermods/usermod_v2_gc9a01_display/platformio_override.sample.ini
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
73 changes: 73 additions & 0 deletions usermods/usermod_v2_gc9a01_display/readme.md
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
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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
         ╭──────────────────╮
...
         ╰──────────────────╯
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 8-8: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @usermods/usermod_v2_gc9a01_display/readme.md around lines 8 - 19, The fenced
ASCII-art code block in readme.md is missing a language tag which triggers
markdownlint MD040; update the triple-backtick fence that surrounds the
watch-face diagram to include a language (e.g., "text") so it becomes ```text,
ensuring the diagram is treated as plain text and the linter warning is
resolved; locate the diagram block in usermod_v2_gc9a01_display/readme.md and
add the language to that opening fence.


</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->


| 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
}
```
Loading