Initial commit: handshake capture firmware for ESP32-C6 1.47" LCD

Made-with: Cursor
This commit is contained in:
drjones
2026-03-17 20:07:32 -07:00
commit 026f15a4a7
3002 changed files with 821045 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
# ESP32-C6-LCD-1.47 WiFi List Firmware
This workspace contains a custom firmware for the non-touch Waveshare `ESP32-C6-LCD-1.47`.
The firmware does one job:
- boot the board
- turn the LCD backlight on
- scan nearby 2.4 GHz Wi-Fi networks
- display the visible SSIDs as a green list on the screen
- rescan periodically
The active Arduino sketch is:
- [Arduino/examples/LVGL_Arduino/LVGL_Arduino.ino](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/LVGL_Arduino.ino)
## Why This Works On This Device
This firmware is specific to the non-touch `ESP32-C6-LCD-1.47` board because it matches the board's actual LCD wiring and controller assumptions:
- LCD controller: `ST7789`
- LCD size: `172x320`
- SPI LCD pins:
- `MOSI = GPIO6`
- `SCLK = GPIO7`
- `LCD_CS = GPIO14`
- `LCD_DC = GPIO15`
- `LCD_RST = GPIO21`
- `LCD_BL = GPIO22`
Those values match the Waveshare `ESP32-C6-LCD-1.47` documentation and the vendor Arduino template for this exact board.
It is not intended for:
- `ESP32-S3-LCD-1.47`
- `ESP32-S3-Touch-LCD-1.47`
- `ESP32-C6-Touch-LCD-1.47`
- other ST7789 boards with different offsets, reset wiring, or backlight control
## The Important Fixes
The stock demo was close, but not stable enough for this board until a few things were corrected:
- The display flush path was using a large per-refresh stack buffer in `LCD_addWindow()`. That is a bad failure mode on the C6 and can leave the panel black. The firmware now sends pixel data without allocating a useless receive buffer.
- Backlight duty handling was cleaned up so `GPIO22` is driven with the correct full-scale PWM value instead of a fragile hard-coded number.
- The board now boots into a minimal screen path instead of starting the original SD-card and wireless demo logic at the same time.
- The app uses the official C6 template's panel init and geometry, including the `172x320` layout and the vendor offsets already present in `Display_ST7789.h`.
Those fixes are why this firmware works on this unit when the earlier mixed S3/C6 attempts did not.
## Caveats
- This is for the non-touch C6 board only.
- It scans `2.4 GHz` Wi-Fi networks. That is normal for ESP32 Wi-Fi scanning.
- The screen can only show a limited number of SSIDs cleanly at once, so the firmware renders the first visible chunk and rescans periodically.
- Hidden SSIDs are shown as `<hidden>`.
- Network order is whatever the Wi-Fi stack returns for that scan, so entries can move between rescans.
- Long SSIDs wrap on screen.
- The sketch uses Arduino and the bundled offline `lvgl` library from this project.
- The build uses the `huge_app` partition scheme. That is the known-good setup for this workspace.
## Files That Matter
- [Arduino/examples/LVGL_Arduino/LVGL_Arduino.ino](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/LVGL_Arduino.ino)
Boot flow for the scanner firmware.
- [Arduino/examples/LVGL_Arduino/WiFi_Scanner.cpp](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/WiFi_Scanner.cpp)
Wi-Fi scan logic and SSID formatting.
- [Arduino/examples/LVGL_Arduino/LVGL_Driver.cpp](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/LVGL_Driver.cpp)
Green-on-black screen layout and text updates.
- [Arduino/examples/LVGL_Arduino/Display_ST7789.cpp](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/Display_ST7789.cpp)
Board-specific LCD write path and backlight control.
- [Arduino/examples/LVGL_Arduino/Display_ST7789.h](/Users/drjones/Library/Mobile%20Documents/com~apple~CloudDocs/dev%20shit%20life/4%20way%20handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino/Display_ST7789.h)
The exact pin map and screen dimensions.
## Known-Good Build And Flash
Compile:
```bash
arduino-cli compile \
-b 'esp32:esp32:esp32c6:PartitionScheme=huge_app' \
--build-path /tmp/arduino-build-c6-wifi-list \
--libraries '/Users/drjones/Library/Mobile Documents/com~apple~CloudDocs/dev shit life/4 way handshake/ESP32-C6-LCD-1.47-Demo/Arduino/libraries' \
'/Users/drjones/Library/Mobile Documents/com~apple~CloudDocs/dev shit life/4 way handshake/ESP32-C6-LCD-1.47-Demo/Arduino/examples/LVGL_Arduino'
```
Flash:
```bash
arduino-cli upload \
-p /dev/cu.usbmodem1101 \
-b 'esp32:esp32:esp32c6:PartitionScheme=huge_app' \
--input-dir /tmp/arduino-build-c6-wifi-list
```
If your serial port changes, replace `/dev/cu.usbmodem1101` with the current device from `arduino-cli board list`.
## References
- Waveshare product page: https://www.waveshare.com/esp32-c6-lcd-1.47.htm
- Waveshare wiki: https://www.waveshare.com/wiki/ESP32-C6-LCD-1.47