The WT32-SC01 PLUS firmware targets Espressif's ESP32-S3 touch display module, presenting a desktop companion that displays the current time, weather information, and an online radio stream while persisting user preferences in EEPROM and optionally logging to a microSD card. The application is built with PlatformIO and relies on LVGL and LovyanGFX for the UI. The graphical layout is also available as a SquareLine Studio project so designers can tweak the interface visually.
WT32-SC01-PLUS/src/main.cpp: entry point that configures the display, network stack, FreeRTOS tasks, and high-level features.WT32-SC01-PLUS/src/Managers/…: modular managers for time (TimeManager), Wi-Fi (WiFiManager), EEPROM (EEPROMManager), and SD card access (SDManager).WT32-SC01-PLUS/src/Features/…: feature implementations for the weather client and online radio.WT32-SC01-PLUS/src/ui.*andscreens/: LVGL files generated by SquareLine Studio.
- Display and touch: The LovyanGFX configuration drives the WT32-SC01 PLUS 480×320 IPS panel over an 8-bit parallel bus that maps WR (GPIO 47), RS (GPIO 0), and D0–D7 (GPIO 9, 46, 3, 8, 18, 17, 16, 15). Reset (GPIO 4), backlight PWM (GPIO 45), and the FT5x06 touch controller on I²C (SDA GPIO 6, SCL GPIO 5) are also set up.
- Audio (I2S): The online radio feature streams audio using the ESP32-AudioI2S library over BCLK (GPIO 36), LRC (GPIO 35), and DOUT (GPIO 37) to an external amplifier.
- SD card: A microSD card can be connected in SPI mode using CS GPIO 41, CLK GPIO 39, CMD GPIO 40, and D0 GPIO 38. Toggle the
SDCARD_INSERTEDflag to enable or disable logging. - Additional hardware: A Wake-on-LAN packet is sent to a configured MAC address when the Wi-Fi icon is tapped on the UI.
All configuration lives in platformio.ini, which targets esp32-s3-devkitc-1, lists library dependencies, and enables PSRAM-specific build flags. The default serial monitor speed is 115200 baud.
- Clone the repository and open it in VS Code with the PlatformIO IDE extension installed.
- Confirm that the
monitor_portentry inplatformio.inimatches the serial device assigned to the board. - Run PlatformIO: Upload from the command palette or execute
pio run --target uploadin the terminal. - Use PlatformIO: Monitor to view logs during boot and runtime.
setup() initializes the display, LVGL drivers, Wi-Fi management task, EEPROM-backed settings, and timers that refresh weather information and supervise connectivity. The loop() function keeps LVGL responsive, reacts to touch events (including Wake-on-LAN), and cycles through services such as time updates, on-screen keyboard handling, brightness control, location management, weather refresh, dimming logic, and radio stream stabilization.
WiFiManager handles user-entered credentials, stores them in EEPROM, and reconnects automatically on boot. The InitWifi() routine processes LVGL text area input, persists credentials, and updates UI status indicators, while StartWifiFromEEPROM() retries connections with a configurable counter. A dedicated FreeRTOS task (WiFiErrorHandling) pings an external host every five seconds and reboots the ESP32 after repeated failures to keep the device responsive. The Wake-on-LAN feature sends a magic packet to a predefined MAC address when triggered from the UI.
TimeManager synchronizes with pool.ntp.org, automatically applies daylight-saving time rules, and provides formatted hour, minute, and date strings for the UI. DisplayTime() runs each loop iteration to refresh the LVGL labels with the latest values.
InitWeather() communicates with the OpenWeatherMap API using the selected city ID. It updates temperature, humidity, textual descriptions, and weather icons. Errors trigger short retries and optionally log to the SD card. A SimpleTimer schedules updates every five minutes, and location changes prompt immediate refreshes.
The radio module maintains arrays of stream URLs and display names. It stores the last played station and volume in EEPROM so playback resumes after reboot. A dedicated FreeRTOS task listens for LVGL events and runs audio.loop() to keep streaming stable.
Users control brightness with a slider; the value is applied instantly and persisted in EEPROM. Two time pickers define an automatic dimming window, correctly handling intervals that cross midnight and restoring brightness afterward.
City selection, Wi-Fi credentials, brightness, and radio settings are written to EEPROM. The address layout is documented in EEPROMManager. RestoreFromEEPROM() runs at boot to reapply saved preferences and reinitialize dependent modules.
When SDCARD_INSERTED is true, the system creates log.txt at startup. The helper function SD_LOG duplicates critical messages (Wi-Fi status, weather updates, errors) to both the serial console and the SD card, providing a persistent audit trail.
ui_init() loads the LVGL scene designed in SquareLine Studio. The .spj project inside the repository enables designers to edit widgets visually and regenerate the LVGL source files included under src.
- Wi-Fi dropouts: The background task pings a remote host and restarts the ESP32 if connectivity cannot be restored.
- Weather API failures: Empty or invalid responses trigger immediate retries with short delays.
- Boot loop recovery: If necessary, erase flash contents with
esptool.py --chip esp32-s3 erase_flashbefore reflashing.
- Add new locations: Append OpenWeatherMap city IDs and matching LVGL dropdown options in
weather.cppand the UI project. - Expand radio stations: Extend the
stationsandstations_namearrays, keeping EEPROM indices aligned. - Disable SD logging: Leave
SDCARD_INSERTEDset tofalseto bypass SD operations when no card is present. - Localization: Translate UI labels in SquareLine Studio and adjust the
OPEN_WEATHER_MAP_LANGUAGEvalue inweather.cppto request different API languages.
Potential enhancements include leveraging unused GPIO pins for sensors or actuators, and adding hourly weather forecasts alongside the existing current-conditions view.
This document summarizes the hardware setup, software architecture, customization points, and maintenance procedures for the WT32-SC01 PLUS project.