The esp-brookesia-simulator_vscode is a VSCode project that can run LVGL and ESP-Brookesia on a PC, simulating the system UI of ESP-Brookesia, which facilitates users in debugging styles and apps.
The esp-brookesia-simulator_vscode is a port and modification based on lv_port_pc_vscode to support compiling C++ files.
Note
It has been tested that esp-brookesia-simulator_vscode can run on Linux, MacOS, Windows, and Windows WSL platforms.
It is recommended that users install gcc, gdb, cmake, make, and sdl2 through MSYS2. Below are the installation steps for a 64-bit Windows system:
-
Download (Official Link / Mirror Link) and install MSYS2.
-
Open the
MSYS2 MINGW64terminal and execute the following commands:
pacman -Syu
pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-SDL2 mingw-w64-x86_64-cmake- Add the path C:\<install_path>\msys64\mingw64\bin to the system environment variable
PATH(where<install_path>is the installation path of the software).
Users can directly install gcc, gdb, cmake, make, and sdl2 through the terminal:
sudo apt-get update && sudo apt-get install -y gcc gdb cmake make build-essential libsdl2-dev- Clone the project and related submodules:
git clone --recursive https://github.com/esp-arduino-libs/esp-brookesia-simulator_vscode- Double-click to open the VSCode workspace file simulator.code-workspace to open the project.
Warning
Please use the workspace file to open the project, as it contains all the configurations for compiling and debugging. Otherwise, you will not be able to compile and debug directly using the F5 key.
-
Press F5 to build and debug, at which point the system UI of ESP-Brookesia should appear in a new window. Meanwhile, users can access all debugging features of VSCode through GDB.
-
Adjust project configuration
- Modify the definition in the CMakeLists.txt file to adjust the display window resolution:
set(DISP_DEF "-DDISP_HOR_RES=1024 -DDISP_VER_RES=600") # Resolution of the display
- Adjust the LVGL configuration by modifying definitions in the components/lv_conf.h file.
- Adjust the ESP-Brookesia configuration by modifying definitions in the components/esp_brookesia_conf.h file.
Note
A global definition SIMULATOR=1 has been added to CMakeLists.txt for temporary modifications between the simulator and device code.
-
Add custom stylesheets and apps
- By default, the project will compile
.cand.cppfiles under the components/esp-brookesia-app directory and include this directory as a header file directory. Users can place custom apps in this directory. - By default, the project will compile
.cand.cppfiles under the components/esp-brookesia-stylesheet directory and include this directory as a header file directory. Users can place custom stylesheets in this directory.
- By default, the project will compile