diff --git a/src/drv/tft/tft_driver_lovyangfx.cpp b/src/drv/tft/tft_driver_lovyangfx.cpp index f6dd3c9f..a3868c3a 100644 --- a/src/drv/tft/tft_driver_lovyangfx.cpp +++ b/src/drv/tft/tft_driver_lovyangfx.cpp @@ -94,7 +94,7 @@ void LovyanGfx::init(int w, int h) { // Set SPI bus control auto bus = (lgfx::v1::Bus_SPI*)tft._bus_instance; auto cfg = bus->config(); // Get the structure for bus configuration. - cfg.spi_host = HSPI_HOST; // Select the SPI to use (VSPI_HOST or HSPI_HOST) + cfg.spi_host = FSPI_HOST; // Select the SPI to use (VSPI_HOST or HSPI_HOST) cfg.spi_mode = 0; // Set SPI communication mode (0 ~ 3) cfg.freq_write = SPI_FREQUENCY; // SPI clock during transmission (Max 80MHz, 80MHz Can be rounded to the value // divided by an integer ) @@ -185,7 +185,7 @@ void LovyanGfx::init(int w, int h) cfg.offset_rotation = 0; // Adjustment when the display and touch orientation do not match: // Set with a value from 0 to 7 cfg.bus_shared = true; // Set to true if you are using the same bus as the screen - cfg.spi_host = HSPI_HOST; // Select the SPI to use (HSPI_HOST or VSPI_HOST) + cfg.spi_host = FSPI_HOST; // Select the SPI to use (HSPI_HOST or VSPI_HOST) cfg.pin_sclk = TFT_SCLK; // SCLK Pin Number cfg.pin_mosi = TFT_MOSI; // MOSI Pin Number cfg.pin_miso = TFT_MISO; // MISO Pin Number diff --git a/src/drv/tft/tft_driver_lovyangfx.h b/src/drv/tft/tft_driver_lovyangfx.h index 4e3ba121..f8cfd9ba 100644 --- a/src/drv/tft/tft_driver_lovyangfx.h +++ b/src/drv/tft/tft_driver_lovyangfx.h @@ -61,6 +61,13 @@ class LovyanGfx : BaseTft { const char* get_tft_model(); + int32_t width(){ + return tft.width(); + } + int32_t height(){ + return tft.height(); + } + private: uint32_t get_tft_driver(); uint32_t get_touch_driver(); diff --git a/src/drv/tft/tft_driver_sdl2.cpp b/src/drv/tft/tft_driver_sdl2.cpp index 63b47644..6ebbdd64 100644 --- a/src/drv/tft/tft_driver_sdl2.cpp +++ b/src/drv/tft/tft_driver_sdl2.cpp @@ -41,7 +41,16 @@ static int tick_thread(void* data) return 0; } -void TftSdl::init(int w, int h) +int32_t TftSdl::width() +{ + return _width; +} +int32_t TftSdl::height() +{ + return _height; +} + +void TftSdl::init(int32_t w, int h) { // Workaround for sdl2 `-m32` crash @@ -50,6 +59,9 @@ void TftSdl::init(int w, int h) setenv("DBUS_FATAL_WARNINGS", "0", 1); #endif + _width = w; + _height = h; + /* Add a display * Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ monitor_init(w, h); // (MONITOR_HOR_RES, MONITOR_VER_RES); diff --git a/src/drv/tft/tft_driver_sdl2.h b/src/drv/tft/tft_driver_sdl2.h index ad376978..b8acbd3e 100644 --- a/src/drv/tft/tft_driver_sdl2.h +++ b/src/drv/tft/tft_driver_sdl2.h @@ -27,6 +27,12 @@ class TftSdl : BaseTft { bool is_driver_pin(uint8_t pin); const char* get_tft_model(); + + int32_t width(); + int32_t height(); + + private: + int32_t _width, _height; }; } // namespace dev diff --git a/src/drv/tft/tft_driver_tftespi.h b/src/drv/tft/tft_driver_tftespi.h index 50753b3d..14cb891c 100644 --- a/src/drv/tft/tft_driver_tftespi.h +++ b/src/drv/tft/tft_driver_tftespi.h @@ -40,6 +40,13 @@ class TftEspi : BaseTft { const char* get_tft_model(); + int32_t width(){ + return tft.width(); + } + int32_t height(){ + return tft.height(); + } + private: void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset) { diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index d6cf91ae..1571335e 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -1115,8 +1115,8 @@ void dispatch_send_discovery(const char*, const char*, uint8_t source) // Display resolution JsonArray disp = doc.createNestedArray(F("disp")); - disp.add(haspTft.tft.width()); - disp.add(haspTft.tft.height()); + disp.add(haspTft.width()); + disp.add(haspTft.height()); size_t len = serializeJson(doc, data);