diff --git a/include/lv_conf_v7.h b/include/lv_conf_v7.h index a1690534..c3d77e90 100644 --- a/include/lv_conf_v7.h +++ b/include/lv_conf_v7.h @@ -250,9 +250,9 @@ typedef void* lv_img_decoder_user_data_t; /* 1: use a custom tick source. * It removes the need to manually update the tick with `lv_tick_inc`) */ -#define LV_TICK_CUSTOM 0 +#define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/ #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ #endif /*LV_TICK_CUSTOM*/ diff --git a/include/lv_conf_v8.h b/include/lv_conf_v8.h index e78c6261..ce97b1ca 100644 --- a/include/lv_conf_v8.h +++ b/include/lv_conf_v8.h @@ -308,10 +308,10 @@ typedef void * lv_img_decoder_user_data_t; /* 1: use a custom tick source. * It removes the need to manually update the tick with `lv_tick_inc`) */ -#define LV_TICK_CUSTOM 0 +#define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/ +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ #endif /*LV_TICK_CUSTOM*/ typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ diff --git a/platformio.ini b/platformio.ini index 9e24bbb4..8879118a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -98,10 +98,8 @@ build_flags = -D NO_GLOBAL_HTTPUPDATE ; dont instantiate httpUpdate ; -- lvgl build options ----------------------------- -D LV_MEM_SIZE=61440U ; 60kB lvgl memory - ;-D LV_MEM_SIZE=10240U ; 10kB lvgl memory ; -- tft_espi build options ------------------------ ;-D USE_DMA_TO_TFT - ;-D ESP32_DMA ; Make touch reads wait for DMA ; -- hasp-lvgl build options ------------------------ -D HASP_USE_TELNET=1 -D HASP_USE_SPIFFS=1 @@ -118,8 +116,11 @@ lib_ignore = Adafruit GFX Library sstaub/Ticker lv_drv_fsmc_ili9341 + lv_drivers + AXP192 -lib_deps = LittleFS_esp32 +lib_deps = +; LittleFS_esp32 extra_scripts = tools/copy_partitions.py @@ -178,7 +179,7 @@ build_flags= -D HASP_USE_LITTLEFS=0 lib_deps = - sstaub/Ticker @ ^3.2.0 + ; sstaub/Ticker @ ^3.2.0 stm32duino/STM32duino LwIP @ ^2.1.2 ;https://github.com/stm32duino/LwIP.git diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index b19c5a69..10f19abb 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -25,7 +25,7 @@ //#include "tpcal.h" -#include "Ticker.h" +//#include "Ticker.h" #if HASP_USE_PNGDECODE > 0 #include "png_decoder.h" @@ -62,19 +62,19 @@ static uint8_t guiRotation = TFT_ROTATION; static uint8_t guiInvertDisplay = INVERT_COLORS; static uint16_t calData[5] = {0, 65535, 0, 65535, 0}; -#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) -static Ticker tick; /* timer for interrupt handler */ -#else -static Ticker tick(lv_tick_handler, LVGL_TICK_PERIOD); // guiTickPeriod); -#endif +// #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) +// static Ticker tick; /* timer for interrupt handler */ +// #else +// static Ticker tick(lv_tick_handler, LVGL_TICK_PERIOD); // guiTickPeriod); +// #endif /* **************************** GUI TICKER ************************************** */ /* Interrupt driven periodic handler */ -static void ICACHE_RAM_ATTR lv_tick_handler(void) -{ - lv_tick_inc(LVGL_TICK_PERIOD); -} +// static void ICACHE_RAM_ATTR lv_tick_handler(void) +// { +// lv_tick_inc(LVGL_TICK_PERIOD); +// } /* Reading input device (simulated encoder here) */ /*bool read_encoder(lv_indev_drv_t * indev, lv_indev_data_t * data) @@ -242,25 +242,7 @@ void guiCalibrate() void guiSetup() { - // Driver intializations: - drv_touch_init(guiRotation); // Touch - lv_init(); // GUI - -#if 0 - tft.begin(); - tft.setSwapBytes(true); /* set endianess */ - - #ifdef USE_DMA_TO_TFT - // DMA - should work with STM32F2xx/F4xx/F7xx processors - // NOTE: >>>>>> DMA IS FOR SPI DISPLAYS ONLY <<<<<< - tft.initDMA(); // Initialise the DMA engine (tested with STM32F446 and STM32F767) - #endif - - tft.setRotation(guiRotation); /* 1/3=Landscape or 0/2=Portrait orientation */ - #if TOUCH_DRIVER == 2046 && USE_TFT_ESPI > 0 - tft_espi_set_touch(calData); - #endif -#endif + lv_init(); /* Initialize the Virtual Device Buffers */ #if defined(ARDUINO_ARCH_ESP32) @@ -328,24 +310,21 @@ void guiSetup() Log.verbose(TAG_GUI, F("Backlight: Pin %d"), guiBacklightPin); #if defined(ARDUINO_ARCH_ESP32) - // pinMode(guiBacklightPin, OUTPUT); - // configure LED PWM functionalitites ledcSetup(BACKLIGHT_CHANNEL, 20000, 10); - // attach the channel to the GPIO to be controlled ledcAttachPin(guiBacklightPin, BACKLIGHT_CHANNEL); #elif defined(ARDUINO_ARCH_ESP8266) pinMode(guiBacklightPin, OUTPUT); #endif } - Log.verbose(TAG_GUI, F("Rotation : %d"), guiRotation); + Log.verbose(TAG_GUI, F("Rotation : %d"), guiRotation); - Log.verbose(TAG_LVGL, F("Version : %u.%u.%u %s"), LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH, + Log.verbose(TAG_LVGL, F("Version : %u.%u.%u %s"), LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH, PSTR(LVGL_VERSION_INFO)); #ifdef LV_MEM_SIZE - Log.verbose(TAG_LVGL, F("MEM size : %d"), LV_MEM_SIZE); + Log.verbose(TAG_LVGL, F("MEM size : %d"), LV_MEM_SIZE); #endif - Log.verbose(TAG_LVGL, F("VFB size : %d"), (size_t)sizeof(lv_color_t) * guiVDBsize); + Log.verbose(TAG_LVGL, F("VFB size : %d"), (size_t)sizeof(lv_color_t) * guiVDBsize); #if LV_USE_LOG != 0 Log.notice(TAG_LVGL, F("Registering lvgl logging handler")); @@ -417,6 +396,7 @@ void guiSetup() #endif lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/ } + drv_touch_init(guiRotation); // Touch driver // guiStart(); // Ticker } @@ -426,7 +406,7 @@ void IRAM_ATTR guiLoop(void) lv_task_handler(); // process animations #if defined(STM32F4xx) - tick.update(); + // tick.update(); #endif } @@ -438,21 +418,21 @@ void guiEverySecond(void) void guiStart() { /*Initialize the graphics library's tick*/ -#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) - tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler); -#else - tick.start(); -#endif + // #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) + // tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler); + // #else + // tick.start(); + // #endif } void guiStop() { /*Deinitialize the graphics library's tick*/ -#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) - tick.detach(); -#else - tick.stop(); -#endif + // #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) + // tick.detach(); + // #else + // tick.stop(); + // #endif } ////////////////////////////////////////////////////////////////////////////////////////////////////