; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = x64_sim


; Shared options
[env]
build_flags =
  -std=c++17
  -std=gnu++17
  ; Don't use lv_conf.h. Tweak params via platfom.ini.
  -D LV_CONF_SKIP
  -D LV_CONF_INCLUDE_SIMPLE
  ; Enable LVGL demo, remove when working on your own project
  ; -D LV_USE_DEMO_WIDGETS=1
  ; Add more defines below to overide lvgl:/src/lv_conf_simple.h
lib_deps =
  ; Use direct URL, because package registry is unstable
  ;lvgl@~7.11.0
  lvgl=https://github.com/lvgl/lvgl/archive/refs/tags/v8.2.0.zip
lib_archive = false


[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.f_flash = 80000000L
board_build.f_cpu = 240000000L
upload_speed = 1000000
lib_deps =
	sparkfun/SparkFun LIS3DH Arduino Library@^1.0.3
	crankyoldgit/IRremoteESP8266@^2.8.4
	adafruit/Adafruit FT6206 Library@^1.0.6
	lvgl/lvgl@^8.3.4
	bodmer/TFT_eSPI@^2.5.23
	knolleary/PubSubClient@^2.8
	Wire
	WiFi
	SPI
	Keypad
	Preferences
build_flags =
  ${env.build_flags}

  -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
	-I include
	-I OmoteUI
	-I HAL
	-I HAL/Interface
	-I HAL/Targets/ESP32

	; The following lines replace the TFT_eSPI User_setup.h-file
	-D USER_SETUP_LOADED=1
	-D ILI9341_DRIVER=1
	-D TFT_WIDTH=240
	-D TFT_HEIGHT=320
	-D TFT_MOSI=23
	-D TFT_SCLK=18
	-D TFT_CS=5
	-D TFT_DC=9
	-D TFT_RST=-1
	-D SPI_FREQUENCY=40000000 ; 40MHz default, some displays might support 80MHz
	-D SPI_TOUCH_FREQUENCY=2500000
	; TFT_eSPI fonts are disabled by default
	;-D LOAD_GLCD=1
	;-D LOAD_FONT2=1
	;-D LOAD_FONT4=1
	;-D LOAD_FONT6=1
	;-D LOAD_FONT7=1
	;-D LOAD_FONT8=1
	;-D LOAD_GFXFF=1
	;-D SMOOTH_FONT=1
build_unflags =
    -std=gnu++11
build_src_filter =
  +<main.cpp>
  +<../HAL/Targets/ESP32/*>
  +<../OmoteUI/*>


[env:x64_sim]
platform = native@^1.1.3
build_flags =
  ${env.build_flags}

  ;-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
  ;-D LV_LOG_PRINTF=1
  -lSDL2
  ; SDL drivers options
  -D LV_LVGL_H_INCLUDE_SIMPLE
  -D LV_DRV_NO_CONF
  -D USE_SDL
  -D SDL_HOR_RES=480
  -D SDL_VER_RES=320
  -D SDL_ZOOM=1
  -D SDL_INCLUDE_PATH="\"SDL2/SDL.h\""

  -I include
  -I OmoteUI
  -I HAL
  -I HAL/Interface
  -I HAL/Targets/Simulator

  ; LVGL memory options, setup for the demo to run properly
  -D LV_MEM_CUSTOM=1
  -D LV_MEM_SIZE="(128U * 1024U)"

debug_build_flags =
  -g

lib_deps =
  ${env.lib_deps}
  ; Use direct URL, because package registry is unstable
  ;lv_drivers@~7.9.0
  lv_drivers=https://github.com/lvgl/lv_drivers/archive/refs/tags/v8.2.0.zip
build_src_filter =
  +<simMain.cpp>
  +<../HAL/Targets/Simulator/*>
  +<../OmoteUI/*>
  ; Force compile LVGL demo, remove when working on your own project

