From 1d1bfdba94eb904cf6fbfcdaa683ed7e33c15e42 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 15:25:23 +0200 Subject: [PATCH 01/13] New Branch, Touch TEST for ESP32S3 Makerfabs --- .../LGFX_MakerFabs_Parallel_S3.hpp | 56 ++++++++++++++----- src/gui/lvgl.h | 24 ++++---- 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp index 9e1ffd5e..23b0c416 100644 --- a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp +++ b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp @@ -5,29 +5,35 @@ #include "SPI.h" #include -#define I2C_SCL 39 -#define I2C_SDA 38 +// #define I2C_SCL 39 +// #define I2C_SDA 38 -//#define NS2009_TOUCH //Resistive screen driver -#define FT6236_TOUCH //Capacitive screen driver +// // #define NS2009_TOUCH //Resistive screen driver +// #define FT6236_TOUCH // Capacitive screen driver -#ifdef NS2009_TOUCH -#include "NS2009.h" -const int i2c_touch_addr = NS2009_ADDR; -#define get_pos ns2009_pos -#endif +// #ifdef NS2009_TOUCH +// #include "NS2009.h" +// const int i2c_touch_addr = NS2009_ADDR; +// #define get_pos ns2009_pos +// #endif -#ifdef FT6236_TOUCH -#include "FT6236.h" -const int i2c_touch_addr = TOUCH_I2C_ADD; -#define get_pos ft6236_pos -#endif +// #ifdef FT6236_TOUCH +// #include "FT6236.h" +// const int i2c_touch_addr = TOUCH_I2C_ADD; +// #define get_pos ft6236_pos +// #endif class LGFX : public lgfx::LGFX_Device { + static constexpr int I2C_PORT_NUM = 0; + static constexpr int I2C_PIN_SDA = 38; + static constexpr int I2C_PIN_SCL = 39; + static constexpr int I2C_PIN_INT = 40; + // lgfx::Panel_ILI9341 _panel_instance; lgfx::Panel_ILI9488 _panel_instance; lgfx::Bus_Parallel16 _bus_instance; // 8ビットパラレルバスのインスタンス (ESP32のみ) + lgfx::Touch_FT5x06 _touch_instance; public: // コンストラクタを作成し、ここで各種設定を行います。 @@ -93,5 +99,27 @@ class LGFX : public lgfx::LGFX_Device } setPanel(&_panel_instance); // 使用するパネルをセットします。 + + { + auto cfg = _touch_instance.config(); + + cfg.x_min = 0; + cfg.x_max = 320; + cfg.y_min = 0; + cfg.y_max = 480; + cfg.pin_int = I2C_PIN_INT; + cfg.bus_shared = true; + cfg.offset_rotation = 0; + + cfg.i2c_port = I2C_PORT_NUM; + cfg.i2c_addr = 0x38; + cfg.pin_sda = I2C_PIN_SDA; + cfg.pin_scl = I2C_PIN_SCL; + cfg.freq = 400000; + + _touch_instance.config(cfg); + _panel_instance.setTouch(&_touch_instance); + } + setPanel(&_panel_instance); } }; diff --git a/src/gui/lvgl.h b/src/gui/lvgl.h index d55d198c..67ad7e35 100644 --- a/src/gui/lvgl.h +++ b/src/gui/lvgl.h @@ -73,19 +73,19 @@ void touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) { uint16_t touchX, touchY; -#ifndef MAKERF_ESP32S3 +//#ifndef MAKERF_ESP32S3 bool touched = tft.getTouch(&touchX, &touchY); -#else - int pos[2] = {0, 0}; - bool touched = false; - get_pos(pos); - if (pos[0]!=0 && pos[1]!=0) - { - touched = true; - touchX = pos[0]; - touchY = pos[1]; - } -#endif +//#else + // int pos[2] = {0, 0}; + // bool touched = false; + // get_pos(pos); + // if (pos[0]!=0 && pos[1]!=0) + // { + // touched = true; + // touchX = pos[0]; + // touchY = pos[1]; + // } +//#endif if (!touched) data->state = LV_INDEV_STATE_RELEASED; else From 68b7fa58a7d42643413dd123abf51d72021df621 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 16:11:04 +0200 Subject: [PATCH 02/13] Fix empty texts in notifybar and compass screen --- src/gui/screens-lvgl/main_scr.h | 1 + src/gui/screens-lvgl/notify_bar.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gui/screens-lvgl/main_scr.h b/src/gui/screens-lvgl/main_scr.h index ecc4ed5f..a78b16a1 100644 --- a/src/gui/screens-lvgl/main_scr.h +++ b/src/gui/screens-lvgl/main_scr.h @@ -75,6 +75,7 @@ void create_main_scr() lv_obj_set_align(compass_heading, LV_ALIGN_CENTER); lv_obj_set_y(compass_heading, 35); lv_obj_set_style_text_font(compass_heading, &lv_font_montserrat_48, 0); + lv_label_set_text(compass_heading, " ---\xC2\xB0"); lv_obj_t *arrow_img = lv_img_create(compass_tile); lv_img_set_src(arrow_img, "F:/arrow.bin"); diff --git a/src/gui/screens-lvgl/notify_bar.h b/src/gui/screens-lvgl/notify_bar.h index 9b457483..9825557d 100644 --- a/src/gui/screens-lvgl/notify_bar.h +++ b/src/gui/screens-lvgl/notify_bar.h @@ -70,6 +70,7 @@ void create_notify_bar() temp = lv_label_create(lv_scr_act()); lv_obj_set_size(temp, 50, 20); lv_obj_set_pos(temp, TFT_WIDTH - 145, 2); + lv_label_set_text(temp, "--\xC2\xB0"); gps_time = lv_label_create(lv_scr_act()); lv_obj_set_size(gps_time, 100, 20); From 02f19ae5c8fca8495deaf31c980d0c21cdbf78e7 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 21:16:01 +0200 Subject: [PATCH 03/13] Fix I2C --- README.md | 4 ++++ platformio.ini | 1 + src/gui/events/main_screen.h | 2 ++ src/gui/events/notify_bar.h | 2 ++ src/hardware/compass.h | 3 ++- src/hardware/tft.h | 6 +++--- src/main.cpp | 9 +++++++++ 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 534f9b1c..15720abe 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,7 @@ Specifications: * MPU6050 Accelerometer and Gyroscope IMU * HT1818Z3G5L GPS Module * LVGL UI + LovyanGFX + +Added support to Makerfabs ESP32-S3 Parallel TFT with Touch 3.5" ILI9488 (thanks to @hpsaturn) + + diff --git a/platformio.ini b/platformio.ini index f33bb4f7..924104c8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -66,6 +66,7 @@ build_flags = -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -D ENABLE_COMPASS=1 + -D ENABLE_BME=1 -D TFT_WIDTH=320 -D TFT_HEIGHT=480 -D TFT_BL=33 diff --git a/src/gui/events/main_screen.h b/src/gui/events/main_screen.h index cde598a1..32ae603b 100644 --- a/src/gui/events/main_screen.h +++ b/src/gui/events/main_screen.h @@ -53,8 +53,10 @@ void update_main_screen(lv_timer_t *t) switch (act_tile) { case COMPASS: +#ifdef ENABLE_COMPASS heading = read_compass(); lv_event_send(compass_heading, LV_EVENT_VALUE_CHANGED, NULL); +#endif if (GPS.location.isUpdated()) { diff --git a/src/gui/events/notify_bar.h b/src/gui/events/notify_bar.h index 3acedbfa..095a1c29 100644 --- a/src/gui/events/notify_bar.h +++ b/src/gui/events/notify_bar.h @@ -106,9 +106,11 @@ void update_notify_bar(lv_timer_t *t) sat_count_old = GPS.satellites.value(); } +#ifdef ENABLE_BME if (int(bme.readTemperature()) != temp_old) { lv_label_set_text_fmt(temp, "%02d\xC2\xB0", int(bme.readTemperature())); temp_old = int(bme.readTemperature()); } +#endif } \ No newline at end of file diff --git a/src/hardware/compass.h b/src/hardware/compass.h index 53b5ea89..f48fc4ec 100644 --- a/src/hardware/compass.h +++ b/src/hardware/compass.h @@ -6,6 +6,7 @@ * @date 2022-10-09 */ +#ifdef ENABLE_COMPASS #include #include @@ -43,4 +44,4 @@ int read_compass() heading -= 2 * PI; return (int)(heading * 180 / M_PI); } - +#endif diff --git a/src/hardware/tft.h b/src/hardware/tft.h index 50547f47..c5f65041 100644 --- a/src/hardware/tft.h +++ b/src/hardware/tft.h @@ -16,7 +16,7 @@ #include -int brightness_level = 255; +uint8_t brightness_level = 255; static TFT_eSPI tft; #define LVGL_BKG 0x10A2 @@ -27,7 +27,7 @@ static TFT_eSPI tft; * * @param brightness -> 0..255 */ -void set_brightness(int brightness) +void set_brightness(uint8_t brightness) { if (brightness <= 255) { @@ -41,7 +41,7 @@ void set_brightness(int brightness) * * @return int -> brightness value 0..255 */ -int get_brightness() +uint8_t get_brightness() { return brightness_level; } diff --git a/src/main.cpp b/src/main.cpp index 360ba967..b8714b90 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,8 +25,12 @@ unsigned long millis_actual = 0; #include "hardware/serial.h" #include "hardware/sdcard.h" #include "hardware/tft.h" +#ifdef ENABLE_COMPASS #include "hardware/compass.h" +#endif +#ifdef ENABLE_BME #include "hardware/bme.h" +#endif #include "hardware/battery.h" #include "hardware/gps.h" #include "hardware/power.h" @@ -45,8 +49,13 @@ unsigned long millis_actual = 0; */ void setup() { + +#ifdef ENABLE_BME bme.begin(BME_ADDRESS); +#endif +#ifdef ENABLE_COMPASS compass.begin(); +#endif #ifdef DEBUG init_serial(); From e8228b179e287ef8b702fb910cd569079dddf9c8 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 22:22:58 +0200 Subject: [PATCH 04/13] Fix & Clean code --- lib/makefabs-esp32s3parallel/FT6236.cpp | 76 ------------------- lib/makefabs-esp32s3parallel/FT6236.h | 16 ---- .../LGFX_MakerFabs_Parallel_S3.hpp | 20 +---- lib/makefabs-esp32s3parallel/NS2009.cpp | 50 ------------ lib/makefabs-esp32s3parallel/NS2009.h | 20 ----- platformio.ini | 2 +- src/gui/screens-lvgl/main_scr.h | 2 +- src/hardware/compass.h | 3 +- src/main.cpp | 3 + 9 files changed, 7 insertions(+), 185 deletions(-) delete mode 100644 lib/makefabs-esp32s3parallel/FT6236.cpp delete mode 100644 lib/makefabs-esp32s3parallel/FT6236.h delete mode 100644 lib/makefabs-esp32s3parallel/NS2009.cpp delete mode 100644 lib/makefabs-esp32s3parallel/NS2009.h diff --git a/lib/makefabs-esp32s3parallel/FT6236.cpp b/lib/makefabs-esp32s3parallel/FT6236.cpp deleted file mode 100644 index 0a3d2e55..00000000 --- a/lib/makefabs-esp32s3parallel/FT6236.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "FT6236.h" - -int readTouchReg(int reg) -{ - int data = 0; - Wire.beginTransmission(TOUCH_I2C_ADD); - Wire.write(reg); - Wire.endTransmission(); - Wire.requestFrom(TOUCH_I2C_ADD, 1); - if (Wire.available()) - { - data = Wire.read(); - } - return data; -} - -/* -int getTouchPointX() -{ - int XL = 0; - int XH = 0; - - XH = readTouchReg(TOUCH_REG_XH); - XL = readTouchReg(TOUCH_REG_XL); - - return ((XH & 0x0F) << 8) | XL; -} -*/ - -int getTouchPointX() -{ - int XL = 0; - int XH = 0; - - XH = readTouchReg(TOUCH_REG_XH); - //Serial.println(XH >> 6,HEX); - if(XH >> 6 == 1) - return -1; - XL = readTouchReg(TOUCH_REG_XL); - - return ((XH & 0x0F) << 8) | XL; -} - -int getTouchPointY() -{ - int YL = 0; - int YH = 0; - - YH = readTouchReg(TOUCH_REG_YH); - YL = readTouchReg(TOUCH_REG_YL); - - return ((YH & 0x0F) << 8) | YL; -} - -int ft6236_pos(int pos[2]) -{ - int XL = 0; - int XH = 0; - int YL = 0; - int YH = 0; - - XH = readTouchReg(TOUCH_REG_XH); - if(XH >> 6 == 1) - { - pos[0] = -1; - pos[1] = -1; - return 0; - } - XL = readTouchReg(TOUCH_REG_XL); - YH = readTouchReg(TOUCH_REG_YH); - YL = readTouchReg(TOUCH_REG_YL); - - pos[0] = ((XH & 0x0F) << 8) | XL; - pos[1] = ((YH & 0x0F) << 8) | YL; - return 1; -} \ No newline at end of file diff --git a/lib/makefabs-esp32s3parallel/FT6236.h b/lib/makefabs-esp32s3parallel/FT6236.h deleted file mode 100644 index eb7a494d..00000000 --- a/lib/makefabs-esp32s3parallel/FT6236.h +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#define TOUCH_I2C_ADD 0x38 - -#define TOUCH_REG_XL 0x04 -#define TOUCH_REG_XH 0x03 -#define TOUCH_REG_YL 0x06 -#define TOUCH_REG_YH 0x05 - -int readTouchReg(int reg); - -int getTouchPointX(); - -int getTouchPointY(); - -int ft6236_pos(int pos[2]); \ No newline at end of file diff --git a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp index 23b0c416..b69f919e 100644 --- a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp +++ b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp @@ -5,27 +5,9 @@ #include "SPI.h" #include -// #define I2C_SCL 39 -// #define I2C_SDA 38 - -// // #define NS2009_TOUCH //Resistive screen driver -// #define FT6236_TOUCH // Capacitive screen driver - -// #ifdef NS2009_TOUCH -// #include "NS2009.h" -// const int i2c_touch_addr = NS2009_ADDR; -// #define get_pos ns2009_pos -// #endif - -// #ifdef FT6236_TOUCH -// #include "FT6236.h" -// const int i2c_touch_addr = TOUCH_I2C_ADD; -// #define get_pos ft6236_pos -// #endif - class LGFX : public lgfx::LGFX_Device { - static constexpr int I2C_PORT_NUM = 0; + static constexpr int I2C_PORT_NUM = 1; static constexpr int I2C_PIN_SDA = 38; static constexpr int I2C_PIN_SCL = 39; static constexpr int I2C_PIN_INT = 40; diff --git a/lib/makefabs-esp32s3parallel/NS2009.cpp b/lib/makefabs-esp32s3parallel/NS2009.cpp deleted file mode 100644 index c43c0d23..00000000 --- a/lib/makefabs-esp32s3parallel/NS2009.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "NS2009.h" - -//I2C receive -void ns2009_recv(const uint8_t *send_buf, size_t send_buf_len, uint8_t *receive_buf, - size_t receive_buf_len) -{ - Wire.beginTransmission(NS2009_ADDR); - Wire.write(send_buf, send_buf_len); - Wire.endTransmission(); - Wire.requestFrom(NS2009_ADDR, receive_buf_len); - while (Wire.available()) - { - *receive_buf++ = Wire.read(); - } -} - -//read 12bit data -unsigned int ns2009_read(uint8_t cmd) -{ - uint8_t buf[2]; - ns2009_recv(&cmd, 1, buf, 2); - return (buf[0] << 4) | (buf[1] >> 4); -} - -int ns2009_get_press() -{ - return ns2009_read(NS2009_LOW_POWER_READ_Z1); -} - -int ns2009_pos(int pos[2]) -{ - int press = ns2009_read(NS2009_LOW_POWER_READ_Z1); - if (press > 30) - { - int x, y, z = 0; - - x = ns2009_read(NS2009_LOW_POWER_READ_X); - y = ns2009_read(NS2009_LOW_POWER_READ_Y); - - pos[0] = x * SCREEN_X_PIXEL / 4096; //4096 = 2 ^ 12 - pos[1] = y * SCREEN_Y_PIXEL / 4096; - return 1; - } - else - { - pos[0] = -1; - pos[1] = -1; - return 0; - } -} \ No newline at end of file diff --git a/lib/makefabs-esp32s3parallel/NS2009.h b/lib/makefabs-esp32s3parallel/NS2009.h deleted file mode 100644 index 57171e9a..00000000 --- a/lib/makefabs-esp32s3parallel/NS2009.h +++ /dev/null @@ -1,20 +0,0 @@ -#include - -//NS2009 -#define NS2009_ADDR 0x48 //10010000 - -#define NS2009_LOW_POWER_READ_X 0xc0 -#define NS2009_LOW_POWER_READ_Y 0xd0 -#define NS2009_LOW_POWER_READ_Z1 0xe0 - -#define SCREEN_X_PIXEL 320 -#define SCREEN_Y_PIXEL 480 - -void ns2009_recv(const uint8_t *send_buf, size_t send_buf_len, uint8_t *receive_buf, - size_t receive_buf_len); - -unsigned ns2009_read(uint8_t cmd, int *val); - -int ns2009_pos(int pos[2]); - -int ns2009_get_press(); \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 924104c8..438e0174 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,7 +16,7 @@ default_envs = CUSTOMBOARD platform = espressif32 framework = arduino version = 0.1.1 -revision = 7 +revision = 8 monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 diff --git a/src/gui/screens-lvgl/main_scr.h b/src/gui/screens-lvgl/main_scr.h index a78b16a1..6c42a6c5 100644 --- a/src/gui/screens-lvgl/main_scr.h +++ b/src/gui/screens-lvgl/main_scr.h @@ -75,7 +75,7 @@ void create_main_scr() lv_obj_set_align(compass_heading, LV_ALIGN_CENTER); lv_obj_set_y(compass_heading, 35); lv_obj_set_style_text_font(compass_heading, &lv_font_montserrat_48, 0); - lv_label_set_text(compass_heading, " ---\xC2\xB0"); + lv_label_set_text(compass_heading, "-----\xC2\xB0"); lv_obj_t *arrow_img = lv_img_create(compass_tile); lv_img_set_src(arrow_img, "F:/arrow.bin"); diff --git a/src/hardware/compass.h b/src/hardware/compass.h index f48fc4ec..53b5ea89 100644 --- a/src/hardware/compass.h +++ b/src/hardware/compass.h @@ -6,7 +6,6 @@ * @date 2022-10-09 */ -#ifdef ENABLE_COMPASS #include #include @@ -44,4 +43,4 @@ int read_compass() heading -= 2 * PI; return (int)(heading * 180 / M_PI); } -#endif + diff --git a/src/main.cpp b/src/main.cpp index b8714b90..e82b92a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,9 @@ void setup() powerOn(); init_sd(); init_SPIFFS(); +#ifdef MAKERF_ESP32S3 + Wire.end(); +#endif init_LVGL(); init_tft(); init_gps(); From 714b616cba543447c970ca390cac7cd1561bb610 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 22:35:17 +0200 Subject: [PATCH 05/13] Trying FIX i2c --- .../LGFX_MakerFabs_Parallel_S3.hpp | 2 +- src/gui/lvgl.h | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp index b69f919e..4988434d 100644 --- a/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp +++ b/lib/makefabs-esp32s3parallel/LGFX_MakerFabs_Parallel_S3.hpp @@ -7,7 +7,7 @@ class LGFX : public lgfx::LGFX_Device { - static constexpr int I2C_PORT_NUM = 1; + static constexpr int I2C_PORT_NUM = 0; static constexpr int I2C_PIN_SDA = 38; static constexpr int I2C_PIN_SCL = 39; static constexpr int I2C_PIN_INT = 40; diff --git a/src/gui/lvgl.h b/src/gui/lvgl.h index 67ad7e35..a5163e14 100644 --- a/src/gui/lvgl.h +++ b/src/gui/lvgl.h @@ -72,20 +72,7 @@ void disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) void touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) { uint16_t touchX, touchY; - -//#ifndef MAKERF_ESP32S3 bool touched = tft.getTouch(&touchX, &touchY); -//#else - // int pos[2] = {0, 0}; - // bool touched = false; - // get_pos(pos); - // if (pos[0]!=0 && pos[1]!=0) - // { - // touched = true; - // touchX = pos[0]; - // touchY = pos[1]; - // } -//#endif if (!touched) data->state = LV_INDEV_STATE_RELEASED; else From 9ddd68d389661940ee425093fd41558643ccc936 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 22:46:02 +0200 Subject: [PATCH 06/13] Try to FIX touch --- src/gui/lvgl.h | 14 +++++++------- src/main.cpp | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/lvgl.h b/src/gui/lvgl.h index a5163e14..23784e18 100644 --- a/src/gui/lvgl.h +++ b/src/gui/lvgl.h @@ -94,13 +94,13 @@ void init_LVGL() lv_port_spiffs_fs_init(); lv_port_sd_fs_init(); - if (psramFound()) - { - static lv_color_t *buf1 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); - static lv_color_t *buf2 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); - lv_disp_draw_buf_init(&draw_buf, buf1, buf2, TFT_WIDTH * TFT_HEIGHT); - } - else + // if (psramFound()) + // { + // static lv_color_t *buf1 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); + // static lv_color_t *buf2 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); + // lv_disp_draw_buf_init(&draw_buf, buf1, buf2, TFT_WIDTH * TFT_HEIGHT); + // } + // else { static lv_color_t buf_norm[TFT_WIDTH * TFT_HEIGHT / 10]; lv_disp_draw_buf_init(&draw_buf, buf_norm, NULL, TFT_WIDTH * TFT_HEIGHT / 10); diff --git a/src/main.cpp b/src/main.cpp index e82b92a2..40219660 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -65,6 +65,7 @@ void setup() init_SPIFFS(); #ifdef MAKERF_ESP32S3 Wire.end(); + Wire.begin(38,39); #endif init_LVGL(); init_tft(); From ffe59e62296d02875fcae2dafb6b8f93af7e1d55 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 22:59:02 +0200 Subject: [PATCH 07/13] Fix LVGL & I2C Issues --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 40219660..e7ebff17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include From 9d20b25afe0d1eaad05d5f4a63b5638a540250a5 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 23:00:19 +0200 Subject: [PATCH 08/13] Fix LVGL & I2C Issues --- src/gui/lvgl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/lvgl.h b/src/gui/lvgl.h index 23784e18..a5163e14 100644 --- a/src/gui/lvgl.h +++ b/src/gui/lvgl.h @@ -94,13 +94,13 @@ void init_LVGL() lv_port_spiffs_fs_init(); lv_port_sd_fs_init(); - // if (psramFound()) - // { - // static lv_color_t *buf1 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); - // static lv_color_t *buf2 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); - // lv_disp_draw_buf_init(&draw_buf, buf1, buf2, TFT_WIDTH * TFT_HEIGHT); - // } - // else + if (psramFound()) + { + static lv_color_t *buf1 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); + static lv_color_t *buf2 = (lv_color_t *)ps_malloc((TFT_WIDTH * TFT_HEIGHT) * sizeof(lv_color_t)); + lv_disp_draw_buf_init(&draw_buf, buf1, buf2, TFT_WIDTH * TFT_HEIGHT); + } + else { static lv_color_t buf_norm[TFT_WIDTH * TFT_HEIGHT / 10]; lv_disp_draw_buf_init(&draw_buf, buf_norm, NULL, TFT_WIDTH * TFT_HEIGHT / 10); From c77876ea3aeec548f5b5939762d15552ff675759 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 23:34:17 +0200 Subject: [PATCH 09/13] Fix LV_TICK_CUSTOM I2C Issues --- lib/lv_CUSTOMBOARD_conf.h | 6 ++++-- lib/lv_MAKERF_ESP32S3_conf.h | 6 ++++-- src/main.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/lv_CUSTOMBOARD_conf.h b/lib/lv_CUSTOMBOARD_conf.h index c81d2482..c79a94b7 100644 --- a/lib/lv_CUSTOMBOARD_conf.h +++ b/lib/lv_CUSTOMBOARD_conf.h @@ -90,8 +90,10 @@ *It removes the need to manually update the tick with `lv_tick_inc()`)*/ #define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM - #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 system time function*/ + //#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ + #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" + #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) #endif /*LV_TICK_CUSTOM*/ /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. diff --git a/lib/lv_MAKERF_ESP32S3_conf.h b/lib/lv_MAKERF_ESP32S3_conf.h index c81d2482..c79a94b7 100644 --- a/lib/lv_MAKERF_ESP32S3_conf.h +++ b/lib/lv_MAKERF_ESP32S3_conf.h @@ -90,8 +90,10 @@ *It removes the need to manually update the tick with `lv_tick_inc()`)*/ #define LV_TICK_CUSTOM 1 #if LV_TICK_CUSTOM - #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 system time function*/ + //#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ + #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" + #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) #endif /*LV_TICK_CUSTOM*/ /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. diff --git a/src/main.cpp b/src/main.cpp index e7ebff17..c8877dc4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,7 @@ void setup() init_SPIFFS(); #ifdef MAKERF_ESP32S3 Wire.end(); - Wire.begin(38,39); +// Wire.begin(38,39); #endif init_LVGL(); init_tft(); From 7fa850ad078a3e81d4e24697b54b909740cddcec Mon Sep 17 00:00:00 2001 From: jgauchia Date: Sun, 9 Apr 2023 23:57:29 +0200 Subject: [PATCH 10/13] Try to fix ESP32S3 touch issues --- lib/lv_MAKERF_ESP32S3_conf.h | 2 +- platformio.ini | 2 +- src/main.cpp | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/lv_MAKERF_ESP32S3_conf.h b/lib/lv_MAKERF_ESP32S3_conf.h index c79a94b7..134ac498 100644 --- a/lib/lv_MAKERF_ESP32S3_conf.h +++ b/lib/lv_MAKERF_ESP32S3_conf.h @@ -88,7 +88,7 @@ /*Use a custom tick source that tells the elapsed time in milliseconds. *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -#define LV_TICK_CUSTOM 1 +#define LV_TICK_CUSTOM 0 #if LV_TICK_CUSTOM //#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*/ diff --git a/platformio.ini b/platformio.ini index 438e0174..06c3ccd0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,7 +16,7 @@ default_envs = CUSTOMBOARD platform = espressif32 framework = arduino version = 0.1.1 -revision = 8 +revision = 9 monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 diff --git a/src/main.cpp b/src/main.cpp index c8877dc4..71a21d56 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,6 +86,9 @@ void setup() */ void loop() { +#ifdef MAKERF_ESP32S3 + lv_tick_inc(2); +#endif lv_timer_handler(); - delay(5); + delayMicroseconds(5); } From 5e9148ba2260ac74ddcdd2be731bdf05340a1e6a Mon Sep 17 00:00:00 2001 From: jgauchia Date: Mon, 10 Apr 2023 00:11:25 +0200 Subject: [PATCH 11/13] Updated LVGL to 8.3.4 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 06c3ccd0..6f75c99f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -40,7 +40,7 @@ lib_deps = adafruit/Adafruit BME280 Library@^2.2.2 paulstoffregen/Time@^1.6.1 me-no-dev/ESP Async WebServer@^1.2.3 - lvgl/lvgl@^8.3.2 + lvgl/lvgl@^8.3.4 lovyan03/LovyanGFX@^1.1.5 jchristensen/Timezone@^1.2.4 From f4c03036c1be94039090eb66d0b1a6eb7be547d7 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Mon, 10 Apr 2023 00:15:00 +0200 Subject: [PATCH 12/13] Fix version & revision --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 6f75c99f..dd17985f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,8 +15,8 @@ default_envs = CUSTOMBOARD [common] platform = espressif32 framework = arduino -version = 0.1.1 -revision = 9 +version = 0.1.2 +revision = 10 monitor_speed = 115200 monitor_rts = 0 monitor_dtr = 0 From efb5c286bad6a59577a362f8c48c9a2bfea29236 Mon Sep 17 00:00:00 2001 From: jgauchia Date: Mon, 10 Apr 2023 00:25:23 +0200 Subject: [PATCH 13/13] Fix search sat spinner --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 71a21d56..15299e78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,7 +87,7 @@ void setup() void loop() { #ifdef MAKERF_ESP32S3 - lv_tick_inc(2); + lv_tick_inc(5); #endif lv_timer_handler(); delayMicroseconds(5);