Files
ESP32-S3-LCD-1.3/.docs/PROJECT_STRUCTURE.md
T
2026-09-21 10:28:35 +02:00

6.3 KiB

ESP32-S3-LCD-1.3 Project Structure

Directory Layout

ESP32-S3-LCD-1.3/
├── .docs/
│   └── ESP32-S3-LCD-1.3-Implementation-Guide.md    # Full implementation guide
│
├── include/
│   ├── config/
│   │   └── lv_conf.h                                # LVGL 8.4.0 configuration
│   ├── display/
│   │   └── (future display-specific headers)
│   ├── modules/
│   │   └── display_init.h                           # Display initialization interface
│   ├── protocol/
│   │   └── automotive_data.h                        # UART protocol (Phase 2+)
│   └── ui/
│       ├── components/
│       │   └── ui_comp_hook.c                       # SquareLine Studio components
│       ├── screens/
│       │   ├── ui_Home_Screen.c                     # Home screen from SquareLine
│       │   └── ui_Home_Screen.h
│       ├── ui.c                                     # SquareLine main UI file
│       ├── ui.h
│       ├── ui_events.h                              # UI event handlers
│       ├── ui_helpers.c                             # UI utility functions
│       └── ui_helpers.h
│
├── src/
│   ├── display_init.cpp                             # LovyanGFX implementation
│   └── main.cpp                                     # Main application (Phase 1)
│
├── lib/                                             # Custom libraries
├── test/                                            # Unit tests
│
├── .gitignore                                       # Git ignore rules
├── platformio.ini                                   # PlatformIO configuration
├── PIN_CONFIG.md                                    # ⚠️ Pin verification guide
├── PROJECT_STRUCTURE.md                             # This file
└── README.md                                        # Main documentation

Include Path Configuration

The platformio.ini is configured with the following include paths (in order):

-I include
-I include/config          # For lv_conf.h
-I include/display         # For display-specific headers
-I include/modules         # For display_init.h, uart_receiver.h, etc.
-I include/protocol        # For automotive_data.h
-I include/ui              # For SquareLine Studio UI files
-I src                     # For source files

Build Source Filter

The following source directories are included in the build:

build_src_filter = +<*> +<modules/*> +<../include/ui/*> +<../include/display/*>

This ensures:

  • All files in src/ are compiled
  • Module implementations in src/modules/ are compiled (future)
  • SquareLine UI files in include/ui/ are compiled (.c files)
  • Display files in include/display/ are compiled (future)

File Organization Guidelines

Phase 1 Files (Current)

  • src/main.cpp: Main application entry point
  • src/display_init.cpp: Display hardware initialization
  • include/modules/display_init.h: Display interface
  • include/config/lv_conf.h: LVGL configuration
  • include/ui/*: SquareLine Studio exported UI (optional for Phase 1)

Future Phase Files

Phase 2: UART Reception

  • src/uart_receiver.cpp: UART data reception and parsing
  • include/modules/uart_receiver.h: UART interface
  • include/protocol/automotive_data.h: Protocol definitions (already created)

Phase 3: Dashboard UI

  • src/ui_renderer.cpp: Dashboard rendering logic
  • include/modules/ui_renderer.h: UI rendering interface
  • Update SquareLine Studio UI in include/ui/

Phase 4: Validation

  • src/data_validator.cpp: Packet validation
  • include/modules/data_validator.h: Validator interface

Phase 5: Settings

  • src/settings_manager.cpp: Persistent settings (NVS)
  • include/modules/settings_manager.h: Settings interface

SquareLine Studio Integration

The include/ui/ folder contains exported UI files from SquareLine Studio:

  • ui.c/ui.h: Main UI initialization
  • ui_helpers.c/ui_helpers.h: Helper functions for UI creation
  • ui_events.h: Event handler declarations
  • screens/: Individual screen implementations
  • components/: Reusable UI components

Using SquareLine UI in main.cpp

To use the SquareLine UI instead of the Phase 1 test UI:

#include "ui/ui.h"  // Include SquareLine UI

void setup() {
    // ... display init ...

    // Initialize SquareLine UI
    ui_init();

    // ... start LVGL task ...
}

Configuration Files

platformio.ini

  • Platform: espressif32@^6.0.0
  • Board: esp32-s3-devkitc-1
  • Framework: Arduino
  • PSRAM: Enabled (OPI mode)
  • Build type: Release
  • C++ standard: gnu++17

lv_conf.h

  • Location: include/config/lv_conf.h
  • LVGL version: 8.4.0
  • Color depth: RGB565 (16-bit)
  • Memory: 64KB heap
  • Theme: Dark theme enabled
  • Widgets: Arc, Label, LED, Meter, etc.

Consistency with Controller A

This structure mirrors the ESP32-S3-Touch-LCD-5B (Controller A) project:

✅ Same include path structure ✅ Same build source filter pattern ✅ Same LVGL configuration location (include/config/lv_conf.h) ✅ Same module organization pattern ✅ Same protocol header location

Build Verification

To verify the project structure is correct:

# Clean build
pio run --target clean

# Build project
pio run

# Should compile successfully with all include paths resolved

Expected output:

Building in release mode
Compiling .pio/build/.../src/main.cpp.o
Compiling .pio/build/.../src/display_init.cpp.o
Compiling .pio/build/.../ui/ui.c.o
...
Linking .pio/build/.../firmware.elf
Building .pio/build/.../firmware.bin

Troubleshooting

Include path issues

If you see errors like fatal error: lv_conf.h: No such file or directory:

  • Verify lv_conf.h is in include/config/
  • Check -I include/config is in build_flags

UI files not compiling

If SquareLine UI files aren't being compiled:

  • Check build_src_filter includes +<../include/ui/*>
  • Verify .c files exist in include/ui/

Module header not found

If module headers aren't found:

  • Verify headers are in include/modules/
  • Check -I include/modules is in build_flags

Last Updated: 2025-11-08 Project Phase: Phase 1 - Display Setup ✅