cydergoth / tembed-app-shell

Application Shell for the LilyGo ESP32-S3 T-Embed
Apache License 2.0
12 stars 2 forks source link

Simple Application Framework for the Lilygo T-Embed ESP32S3

T-Embed

See product here : https://www.lilygo.cc/products/t-embed

License

Portions of this code are from the Espressif ESP32 IDF (SDK) which is licensed under Apache 2.0

Portions of this code are from the T-Embed examples at https://github.com/Xinyuan-LilyGO/T-Embed

The rest of the code is licensed under Apache 2.0

Features

This is an example Application Framework for the T-Embed. It is intended to showcase the capabilities of the product and provide a "toolkit" of parts to be repurposed into your own application. It is not a production ready application! Parts of this codebase are derived from the ESP32 IDF, LVGL and Lilygo examples.

Main Screen Main Screen Image

WiFi AP selection and password entry showing Return character. Rotate dial to select characters or Backspace or Enter

Wifi Password

  1. Build with ESP-IDF V5 for ESP32S3
  2. Init CPU
  3. Init LCD
    • Integrate LVGL for UI
  4. Init LED strip
  5. Init SDCard
  6. Enable WiFi
    • Support WiFi AP scan and (limited) password entry
    • Support WiFi SMART configuration (use smartphone to configure WiFi)
  7. SNTP to get time
  8. Enable BLE and scan for Bluetooth devices. Note: Classic is NOT supported
  9. Idle timeout for deep sleep, knob button for wakeup
  10. Application Shell and UI
    • LVGL for widgets
    • Support Knob and button for navigation
    • Landscape UI shell with
      • Status icons [ Wifi, Battery (WIP), BT, SDCard ]
      • Title bar
      • Area for screen specific data
    • Included Screens
      • Main menu - Icons, IP Address, Time and Date
      • WiFi menu - Scan or SMART config
      • WiFi scan - Scan for AP, select AP, Enter password (limited)
      • ASCII upper/lower case only - No unicode
      • Space NOT included (Needs a font with an appropriate glyph)
      • Some special characters
      • Backspace only, no cursor
      • Enter password
      • WIFI SMART - Placeholder to display whilst WiFi is configuring
      • SDCard - Browse files on SDCard
      • Color test - Displays RGB on LCD
  11. Support ESP serial Console for debug and screenshot

Out of Scope

The following feature are out of scope for this project

Building and Installing

Prerequisites

  1. A T-Embed (preferably working)
  2. An installation of the ESP-IDF V5.0 including ESP32S3 target
  3. This repository
  4. A working USB data and power cable

Getting Started

  1. Plug in your T-Embed. Make sure it is recognized by the OS (I recommend linux)
  2. Clone the ESP-IDF repository V5.0 branch git clone --depth=1 --recursive -b v5.0 https://github.com/espressif/esp-idf.git
  3. Run the install.sh in the ESP-IDF repo root install.sh all
  4. Export the ESP-IDF config into the shell . ./export.sh
  5. Check the IDF version idf.py --version (should be v5.0)
  6. Clone this repo and change to where you have cloned it (I use ~/workspace/esp32/tembed)
  7. idf.py set-target esp32s3
  8. idf.py menuconfig and set any options you need. The application comes with sensible default options set for the T-Embed and this application shell
  9. idf.py flash && idf.py monitor

Snapshots

Using the Console, you can take a snapshot of the screen and then generate a PNG from it.

  1. Connect using idf.py monitor | tee snap.log
  2. Navigate to the screen you want to capture
  3. Type snap<ENTER> in the window with idf.py monitor
  4. Watch a wall of data appear after a short delay
  5. Use CTRL-] to exit monitor
  6. Trim the file to just the one line containing the snapshot data (lots of 0000 digits)
  7. Use xxd to convert the hex to bytes: xxd -r -ps <snap.log >snap.raw - the result should be 108800 bytes long exactly
  8. Use the python script to convert the raw data to a png (requires python3 pillow library) python3 rgb565_to_png.py
  9. Display the PNG with your favorite viewer or web browser