diff --git a/platformio_override-template.ini b/platformio_override-template.ini index 7202556b..25c8ff1d 100644 --- a/platformio_override-template.ini +++ b/platformio_override-template.ini @@ -22,6 +22,7 @@ build_flags = ;region -- Default Build Environments : Used when Build All --- extra_default_envs = ; Comment unneeded environments or create extra + ; arduitouch-esp32_ili9341 ; d1-mini-esp32_ili9341 ; d1-mini-esp8266_ili9341 ; d132-unoshield diff --git a/src/dev/esp32/esp32.h b/src/dev/esp32/esp32.h index 15cbaad9..8633748a 100644 --- a/src/dev/esp32/esp32.h +++ b/src/dev/esp32/esp32.h @@ -8,6 +8,18 @@ #if defined(ESP32) +#ifndef TFT_BACKLIGHT_ON +#define TFT_BACKLIGHT_ON LOW +#endif + +#ifndef MQTT_NODENAME +#define MQTT_NODENAME "plate" +#endif + +#ifndef TFT_BCKL +#define TFT_BCKL -1 +#endif + namespace dev { class Esp32Device : public BaseDevice { @@ -15,19 +27,11 @@ class Esp32Device : public BaseDevice { public: Esp32Device() { -#ifdef MQTT_NODENAME - _hostname = MQTT_NODENAME; -#else - _hostname = "plate"; -#endif + _hostname = MQTT_NODENAME; + _backlight_invert = (TFT_BACKLIGHT_ON == LOW); _backlight_power = 1; - _backlight_invert = 0; _backlight_level = 255; -#ifdef TFT_BCKL - _backlight_pin = TFT_BCKL; -#else - _backlight_pin = -1; -#endif + _backlight_pin = TFT_BCKL; } void reboot() override; void show_info() override; diff --git a/user_setups/esp32/arduitouch-esp32_ili9341.ini b/user_setups/esp32/arduitouch-esp32_ili9341.ini new file mode 100644 index 00000000..aa540645 --- /dev/null +++ b/user_setups/esp32/arduitouch-esp32_ili9341.ini @@ -0,0 +1,35 @@ +;***************************************************; +; AZ ArduiTouch PCB with ESP32 with 2.4" or 2.8" ; +; - ESP32-WROOM-32 board ; +; - ili9341 TFT ; +; - xpt2046 touch controller ; +;***************************************************; + +[env:arduitouch-esp32_ili9341] +extends = esp32 +board = esp32dev + +build_flags = + ${env.build_flags} + ${esp32.build_flags} + +;region -- TFT_eSPI build options ------------------------ + ${lcd.lolin24} + ${esp32.vspi} ; Use VSPI hardware SPI bus + -D TFT_DC=4 + -D TFT_CS=5 + -D TFT_RST=22 ; RST + -D TFT_BCKL=15 + -D TOUCH_CS=14 + -D TFT_BACKLIGHT_ON=LOW +;endregion + +;region -- Library options ------------------------------- +lib_deps = + ${env.lib_deps} + ${esp32.lib_deps} + +lib_ignore = + ${env.lib_ignore} + ${esp32.lib_ignore} +;endregion \ No newline at end of file