Skip to content

Latest commit

 

History

History
105 lines (93 loc) · 7.35 KB

README.md

File metadata and controls

105 lines (93 loc) · 7.35 KB

lv_port_esp32_squareline_studio

Overview

This repository can be used to generate SquareLine Studio boards for ESP32 devices (connected to supported display drivers defined in lvgl_esp32_drivers).

Project structure in _ui_project_name_ follows a similar structure to lv_port_esp32.

Tested Library Versions

Boards

Board Name Driver Image Example
esp32_ssd1306_128x64 SSD1306 esp32_ssd1306_128x64.png esp32_ssd1306_128x64_example.gif
Source Files

Create a new board

Refer to https://docs.squareline.io/docs/obp.

  1. Clone this repo
  2. Create a new directory under boards/
    • Example: your_board_name/
  3. Add the your_board_name.png file
    • A photo of the board to be displayed in SquareLine Studio.
  4. Add the your_board_name.slb
    • SquareLine board definition file (see https://docs.squareline.io/docs/obp#your_boardslb for more information)
      • For monochrome displays such as the SSD1306 OLED panel, keep the color_depth at 8, SquareLine currently does not support depth < 8. You will need to fix this, see below.
      • Set the lvgl_export_path to false as the submodule reference _ui_project_name_/components/lvgl is used
      • Set the pattern_match_files to CMakeLists.txt,main/main.c as this will replace templated tags such as __UI_PROJECT_NAME__
      • Set the ui_export_path to ./components/ui
      • Set the supported_lvgl_version to 8.3.*
  5. Copy your_board_name/ directory to the SquareLine installation's boards/Espressif directory
  6. Create a compressed ZIP file of the _ui_project_name_ directory
  7. Rename the ZIP file to your_board_name.zip
  8. Copy the your_board_name.zip to SquareLine installation's boards/Espressif/your_board_name directory

Create a new SquareLine Studio Project

  1. Once you have created a new board (or used one of the existing boards in this repo), open SquareLine Studio.
  2. The board you've created will appear in SquareLine Studio.
  3. Set your project settings and create the project
    • squareline_studio_create_project_panel.png
  4. Once the new project is created and loaded, export the template project via Export -> Create Template Project
    • squareline_studio_export_dropdown.png
    • You can export the template project anywhere. In this example, I have created an export directory inside the SquareLine project's directory
      • squareline_studio_export_project_filebrowser.png
    • Once exported, verify that the template project files are exported in the path you specified
      • verify_squareline_studio_project_export_files.png
  5. Open the exported template project directory via your IDE. I am using CLion to open it.

CMake error add_library command is not scriptable

  1. Once the project is opened via the IDE, CMake will throw the following error:
    • add_library_cmake_error.png
      • This error is in the exported ui directory's CMakeLists.txt file
        • add_library_cmake_error_in_file.png
      • Replace the add_library(ui ${SOURCES}) line with the following:
        • idf_component_register(SRCS ${SOURCES}
                  REQUIRES lvgl)
          • fixed_ui_cmakelists_file.png
          • NOTE: You will need to modify this every time you export the UI files.
      • Reset CMake cache and reload CMake project
  2. Run idf.py menuconfig to configure the display drivers and LVGL
  3. Build the ESP-IDF project
  4. Flash the ESP32 board

Monochrome display LV_COLOR_DEPTH assertion error

As previously mentioned, SquareLine Studio currently does not support color depth < 8. Assuming that you've set the LVGL color depth to 1 via the project's menuconfig, build attempts will result in the following error:

  • monochrome_lv_color_depth_error.png
    • This error is the result of an automatically added assertion/config check, in the generated UI files. It checks if the set LV_COLOR_DEPTH (i.e set via menuconfig) matches the color_depth set in the board's .slb file.
      • monochrome_lv_color_depth_error_check_source_file.png
    • To fix this error, simply replace the expected color depth (i.e. 8) to 1
      • monochrome_lv_color_depth_error_fix.png
      • NOTE: You will need to modify this every time you export the UI files.
    • Building the project after fixing this error will succeed
      • monochrome_lv_color_depth_error_fix_build_success.png

Monochrome display lv_theme_*_init error

Assuming that you've only enabled the "Monochrome theme" for your monochrome display (as you should via the project configuration i.e.menuconfig)

  • Example
    • monochrome_theme_menuconfig.png build attempts will result in a similar error to the one shown below: monochrome_theme_error.png
    • The error is in the exported ui.c file
      • monochrome_theme_error_source_file.png

This happens because SquareLine Studio currently does not include an option to select the monochrome theme.

To fix this issue, simply change the theme initialization code as follows: monochrome_theme_error_fixed.png

  • NOTE: You will need to modify this every time you export the UI files.