New 7" Display
Hi
Squareline demo still not working.
It is working with my old 5" display but not with my new 7" (the new version with I2C port.
Sometimes I can see a faint image on screen 1, screen 2 fading and switching. Touch doesn't work, or you can see the coordinates coming in but nothing else.
Any suggestions?
Comments
Hello @SM0PYH ,
Please change the screen driver from Arduino_GFX to LovyanGFX
and modify
into
Hi
Thanks for your answer.
I could not download the library LovyanGFX.zip
Broken link i think Best regards
https://forum.elecrow.com/uploads/122/JY9XJ2Z4TL5W.zip
Hey All,
I have the same issue as SM0PYH (7 inch screen as well), I downloaded the LovyanGFX included in the set of libraries that is on the tutorial page and none of the codes work. Now I get the following error:
base operand of '->' has non-pointer type 'LGFX'
lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
First I used the original code that said Arduino_GFX while the included library only contained an Adafruit_GFX. I sourced Arduino_GFX got the same error as SM0PYH.
I also tried the last method and failed in the above mentioned way.
Could someone please please help us out here?
My Code:
__________________________________________________________________________________________________________________________________________________________
#include <Wire.h>
#include <SPI.h>
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#define USE_UI //if you want to use the ui export from Squareline, please do not annotate this line.
#if defined USE_UI
#include <lvgl.h>
#include "ui.h"
#endif
#include <LovyanGFX.h>
#define TFT_BL 2
#define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
class LGFX : public lgfx::LGFX_Device
{
public:
lgfx::Bus_RGB _bus_instance;
lgfx::Panel_RGB _panel_instance;
LGFX(void)
{
{
auto cfg = _bus_instance.config();
cfg.panel = &_panel_instance;
cfg.pin_d0 = GPIO_NUM_15; // B0
cfg.pin_d1 = GPIO_NUM_7; // B1
cfg.pin_d2 = GPIO_NUM_6; // B2
cfg.pin_d3 = GPIO_NUM_5; // B3
cfg.pin_d4 = GPIO_NUM_4; // B4
cfg.pin_d5 = GPIO_NUM_9; // G0
cfg.pin_d6 = GPIO_NUM_46; // G1
cfg.pin_d7 = GPIO_NUM_3; // G2
cfg.pin_d8 = GPIO_NUM_8; // G3
cfg.pin_d9 = GPIO_NUM_16; // G4
cfg.pin_d10 = GPIO_NUM_1; // G5
cfg.pin_d11 = GPIO_NUM_14; // R0
cfg.pin_d12 = GPIO_NUM_21; // R1
cfg.pin_d13 = GPIO_NUM_47; // R2
cfg.pin_d14 = GPIO_NUM_48; // R3
cfg.pin_d15 = GPIO_NUM_45; // R4
cfg.pin_henable = GPIO_NUM_41;
cfg.pin_vsync = GPIO_NUM_40;
cfg.pin_hsync = GPIO_NUM_39;
cfg.pin_pclk = GPIO_NUM_0;
cfg.freq_write = 15000000;
cfg.hsync_polarity = 0;
cfg.hsync_front_porch = 40;
cfg.hsync_pulse_width = 48;
cfg.hsync_back_porch = 40;
cfg.vsync_polarity = 0;
cfg.vsync_front_porch = 1;
cfg.vsync_pulse_width = 31;
cfg.vsync_back_porch = 13;
cfg.pclk_active_neg = 1;
cfg.de_idle_high = 0;
cfg.pclk_idle_high = 0;
_bus_instance.config(cfg);
}
{
auto cfg = _panel_instance.config();
cfg.memory_width = 800;
cfg.memory_height = 480;
cfg.panel_width = 800;
cfg.panel_height = 480;
cfg.offset_x = 0;
cfg.offset_y = 0;
_panel_instance.config(cfg);
}
_panel_instance.setBus(&_bus_instance);
setPanel(&_panel_instance);
}
};
LGFX lcd;
/*******************************************************************************
* Screen Driver Configuration end
*******************************************************************************/
/*******************************************************************************
Please config the touch panel in touch.h
******************************************************************************/
#include "touch.h"
#ifdef USE_UI
/* Change to your screen resolution */
static uint32_t screenWidth;
static uint32_t screenHeight;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t disp_draw_buf[800 * 480 / 10]; //5,7inch: lv_color_t disp_draw_buf[800*480/10] 4.3inch: lv_color_t disp_draw_buf[480*272/10]
//static lv_color_t disp_draw_buf;
static lv_disp_drv_t disp_drv;
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
#if (LV_COLOR_16_SWAP != 0)
lcd->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#else
lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#endif
lv_disp_flush_ready(disp);
}
void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
{
if (touch_has_signal())
{
if (touch_touched())
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = touch_last_x;
data->point.y = touch_last_y;
Serial.print( "Data x :" );
Serial.println( touch_last_x );
Serial.print( "Data y :" );
Serial.println( touch_last_y );
}
else if (touch_released())
{
data->state = LV_INDEV_STATE_REL;
}
}
else
{
data->state = LV_INDEV_STATE_REL;
}
delay(15);
}
#endif
void setup()
{
Serial.begin(9600);
Serial.println("LVGL Widgets Demo");
#if defined(Display_50) || defined(Display_70)
//IO Port Pins
pinMode(38, OUTPUT);
digitalWrite(38, LOW);
pinMode(17, OUTPUT);
digitalWrite(17, LOW);
pinMode(18, OUTPUT);
digitalWrite(18, LOW);
pinMode(42, OUTPUT);
digitalWrite(42, LOW);
#elif defined(Display_43)
pinMode(20, OUTPUT);
digitalWrite(20, LOW);
pinMode(19, OUTPUT);
digitalWrite(19, LOW);
pinMode(35, OUTPUT);
digitalWrite(35, LOW);
pinMode(38, OUTPUT);
digitalWrite(38, LOW);
pinMode(0, OUTPUT);//TOUCH-CS
#endif
// Init Display
lcd->begin();
lcd->fillScreen(BLACK);
lcd->setTextSize(2);
delay(200);
#ifdef USE_UI
lv_init();
delay(100);
touch_init();
screenWidth = lcd->width();
screenHeight = lcd->height();
lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * screenHeight / 10);
// lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, 480 * 272 / 10);
/* Initialize the display */
lv_disp_drv_init(&disp_drv);
/* Change the following line to your display resolution */
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
/* Initialize the (dummy) input device driver */
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
#endif
#ifdef TFT_BL
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
#ifdef USE_UI
ui_init();//ui from Squareline or GUI Guider
#else
lcd->fillScreen(RED);
delay(800);
lcd->fillScreen(BLUE);
delay(800);
lcd->fillScreen(YELLOW);
delay(800);
lcd->fillScreen(GREEN);
delay(800);
#endif
Serial.println( "Setup done" );
}
void loop()
{
while(1)
{
#ifdef USE_UI
lv_timer_handler();
delay(5);
#endif
}
}
__________________________________________________________________________________________________________________________________________________________
Error message:
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino: In function 'void my_disp_flush(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:133:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
^~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino: In function 'void setup()':
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:197:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->begin();
^~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:198:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->fillScreen(BLACK);
^~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:198:19: error: 'BLACK' was not declared in this scope
lcd->fillScreen(BLACK);
^~~~~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:199:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->setTextSize(2);
^~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:208:20: error: base operand of '->' has non-pointer type 'LGFX'
screenWidth = lcd->width();
^~
C:\Users\HughMungus\Documents\Arduino\7inch_display\Demo\Demo.ino:209:21: error: base operand of '->' has non-pointer type 'LGFX'
screenHeight = lcd->height();
^~
exit status 1
Compilation error: base operand of '->' has non-pointer type 'LGFX'
Thanks for the help in advanced!
Hello,
Sorry for the broken link. You can install the library by opening the Library Manager in Arduino IDE, and searching for "LovyanGFX". Then click "install".
Hi
Thanks for your effort.
Using LovyanGFX version 1.1.12
I got the same error as Hugh_Mungus
Could you please make a copy of the demofile and make the changes you suggest, compile and publish the code for us.
https://github.com/Elecrow-RD/esp32-display/blob/master/7.0/3%E3%80%81arduino/7.0-inch_Squareline_Demo/7.0-inch_Squareline_Demo.ino
//Hans
Error In file included from C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:98:
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\touch.h: In function 'bool touch_touched()':
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\touch.h:168:74: error: base operand of '->' has non-pointer type 'LGFX'
touch_last_x = map(ts.points[0].x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd->width() - 1);
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\touch.h:169:74: error: base operand of '->' has non-pointer type 'LGFX'
touch_last_y = map(ts.points[0].y, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd->height() - 1);
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino: In function 'void my_disp_flush(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:118:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino: In function 'void setup()':
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:170:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->begin();
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:171:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->fillScreen(BLACK);
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:171:19: error: 'BLACK' was not declared in this scope
lcd->fillScreen(BLACK);
^~~~~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:172:6: error: base operand of '->' has non-pointer type 'LGFX'
lcd->setTextSize(2);
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:181:20: error: base operand of '->' has non-pointer type 'LGFX'
screenWidth = lcd->width();
^~
C:\Users\habr\Desktop\Arduino Projekts\Ny 7 Demo\ESP32_Display_Squareline_Demo\ESP32_Display_Squareline_Demo.ino:182:21: error: base operand of '->' has non-pointer type 'LGFX'
screenHeight = lcd->height();
^~
Multiple libraries were found for "Wire.h"
Used: C:\Users\habr\Desktop\Arduino Projekts\Libraries\Wire
Not used: C:\Users\habr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire
Multiple libraries were found for "SPI.h"
Used: C:\Users\habr\Desktop\Arduino Projekts\Libraries\SPI
Not used: C:\Users\habr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\SPI
exit status 1
Compilation error: base operand of '->' has non-pointer type 'LGFX'
Hello,
The "->" needs to be changed to ".", and the color need to add TFT_
For example, " lcd->fillScreen(BLACK);" change to "lcd.fillScreen(TFT_BLACK);"
Is there an updated 7.0" espif demo? This did not fix my issue. The code compiles and builds but faults and the display reboots.