; 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_INCLUDE_SIMPLE
  -D LV_CONF_SKIP
  ;------------- LVGL ------------------------------------------
  -D LV_MEM_CUSTOM=1
  -D LV_MEM_SIZE="\(48U * 1024U\)"
  -D LV_FONT_MONTSERRAT_12=1
  -D LV_FONT_MONTSERRAT_16=1
  -D LV_FONT_MONTSERRAT_24=1
  -D LV_USE_CALENDAR=1
  -D LV_USE_IMGBTN=1
  -D LV_USE_WIN=1
  -D LV_THEME_DEFAULT_DARK=1
  -D LV_BUILD_EXAMPLES=0

  ;------------ OMOTE Defines -----------------------------------
  ; Currently based on the ILI9341_DRIVER
  -D SCREEN_WIDTH=240
  -D SCREEN_HEIGHT=320

  ; ------------- Includes ------------------------------------
  -I OmoteUI
  -I HAL
  -I HAL/Interface

lib_deps =
  lvgl/lvgl@^8.3.9
lib_archive = false
build_src_filter =
  +<../OmoteUI/*>



[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 =
  ${env.lib_deps}
	sparkfun/SparkFun LIS3DH Arduino Library@^1.0.3
	crankyoldgit/IRremoteESP8266@^2.8.4
	adafruit/Adafruit FT6206 Library@^1.0.6
	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

	; ---------------- TFT_eSPI Defines replace(User_setup.h-file)---------
	-D USER_SETUP_LOADED=1
	-D ILI9341_DRIVER=1
	;-D TFT_WIDTH=SCREEN_WIDTH
	;-D TFT_HEIGHT=SCREEN_HEIGHT
	-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

  ; --------------- LVGL Defines --------------------------------------
  -D LV_TICK_CUSTOM=1
  -D LV_TICK_CUSTOM_INCLUDE="\"Arduino.h\""
  -D LV_TICK_CUSTOM_SYS_TIME_EXPR="'(millis())'"

  ; ------------- Includes --------------------------------------------
  -I HAL/Targets/ESP32

build_unflags =
    -std=gnu++11
build_src_filter =
  +<main.cpp>
  +<../HAL/Targets/ESP32/*>
  ${env.build_src_filter}


[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 ; SDL2 must be installed on system! Windows:msys2 ubuntu:apt-get
  ; --------- SDL drivers options -----------------------------
  -D LV_LVGL_H_INCLUDE_SIMPLE
  -D LV_DRV_NO_CONF
  -D USE_SDL
  -D SDL_HOR_RES=SCREEN_WIDTH
  -D SDL_VER_RES=SCREEN_HEIGHT
  -D SDL_ZOOM=1
  -D SDL_INCLUDE_PATH="\"SDL2/SDL.h\""

  ; -------------- Sim Includes ---------------------------
  -I HAL/Targets/Simulator

debug_build_flags =
  -g ;Allow debugging in vscode

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

