lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.03k stars 189 forks source link

Issues with GPIO 0 button on TTGO_TDISPLAY #389

Closed neilpas23 closed 1 year ago

neilpas23 commented 1 year ago

I'm currently using LovyanGFX because its the only library that I can scale/flip sprites in for a game. My issue is that it seems like the GPIO-0 Button on the TTGO T-Display doesn't work while using this library? Is it possible that this library could be effecting that button in some way?

neilpas23 commented 1 year ago

I've trouble shot it down to the lcd.init(); function. When you call lcd.init(); in setup gpio-0 gets shorted to LOW, it will only read out 0.

lovyan03 commented 1 year ago

I hate people who do not attach code to Issues. Please provide proof first.

lovyan03 commented 1 year ago

One possibility is that you are using autodetect and have changed the GPIO settings prior to that. You should set the pin mode later than lcd.init.

neilpas23 commented 1 year ago

define LGFX_TTGO_TDISPLAY

define LGFX_AUTODETECT

include

include

include

static LGFX lcd; int buttonVal;

void setup() {

Serial.begin(115200);
pinMode(0, INPUT_PULLUP);
lcd.init();

}

void loop() { buttonVal = digitalRead(0); Serial.println(buttonVal);

}

If you comment out lcd.init(); button on gpio-0 goes back to working as normal Sorry for not adding code.

lovyan03 commented 1 year ago

You should set the pin mode later than lcd.init.

neilpas23 commented 1 year ago

define LGFX_TTGO_TDISPLAY

define LGFX_AUTODETECT

include

include

include

static LGFX lcd; int buttonVal;

void setup() {

Serial.begin(115200);
lcd.init();
pinMode(0, INPUT_PULLUP);

}

void loop() { buttonVal = digitalRead(0); Serial.println(buttonVal);

}

The result with this is the same, still all 0s. And checking now commenting out lcd.init(); button goes back to working.

lovyan03 commented 1 year ago

Are you use latest version ?

lovyan03 commented 1 year ago

I have lost my T-Display and cannot verify.

neilpas23 commented 1 year ago

Just downloaded and replaced to 1.1.5 off the github instead of loading it thought the Arduino IDE. Reset and recompiled. Can confirm that this is still occurring. Maybe someone else on the GIT can verify if they own a T-display.

lovyan03 commented 1 year ago

umm,

please comment out this line...

 #define LGFX_AUTODETECT
lovyan03 commented 1 year ago

And, please set the debug log level to verbose and present the contents of the serial output.

lovyan03 commented 1 year ago

no, it's build log I mean runtime output log.

neilpas23 commented 1 year ago

23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0 23:42:38.348 -> 0

The Serial Monitor just updates 0s on loop because thats all thats printing. It should be printing 1, and 0 when the button is pressed. There is no other information in any of the Outputs once the program is sent to the device.

lovyan03 commented 1 year ago

boot log...

lovyan03 commented 1 year ago

I mean this...

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13220
ho 0 tail 12 room 4
load:0x40080400,len:3028
entry 0x400805e4
[     5][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[  3035][I][LGFX_AutoDetect_ESP32_all.hpp:1008] init_impl(): [LovyanGFX] [Autodetect] load from NVS : board:9
[  3036][V][LGFX_AutoDetect_ESP32_all.hpp:3350] autodetect(): [LGFX] pkg: 0
[  3041][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
[  3063][I][LGFX_AutoDetect_ESP32_all.hpp:2353] setup(): [LovyanGFX] [Autodetect] TTGO_TDisplay
neilpas23 commented 1 year ago

23:51:46.998 -> ets Jul 29 2019 12:21:46 23:51:46.999 -> 23:51:46.999 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 23:51:46.999 -> configsip: 0, SPIWP:0xee 23:51:46.999 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 23:51:46.999 -> mode:DIO, clock div:1 23:51:46.999 -> load:0x3fff0018,len:4 23:51:46.999 -> load:0x3fff001c,len:1044 23:51:46.999 -> load:0x40078000,len:10124 23:51:46.999 -> load:0x40080400,len:5856 23:51:46.999 -> entry 0x400806a8

Thats all the info it gives me before it starts printing 0s

lovyan03 commented 1 year ago

ログレベルを上げてください

neilpas23 commented 1 year ago

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:10124 load:0x40080400,len:5856 entry 0x400806a8 [I][LGFX_AutoDetect_ESP32_all.hpp:1008] init_impl(): [Autodetect] load from NVS : board:9 [V][LGFX_AutoDetect_ESP32_all.hpp:3304] autodetect(): pkg: 0 [V][LGFX_AutoDetect_ESP32_all.hpp:714] _read_panel_id(): [Autodetect] read cmd:04 = ff528585 [I][LGFX_AutoDetect_ESP32_all.hpp:2308] setup(): [Autodetect] TTGO_TDisplay

lovyan03 commented 1 year ago

ArduinoESP32 v1.0.6を使っていますか? もしそうであれば、v2.0.xに変更してみてください。

neilpas23 commented 1 year ago

I am using Arduino IDE 2.0.4. image

lovyan03 commented 1 year ago

no... it's IDE version... I mean Arduino core for ESP32 ( board manager ) version

lovyan03 commented 1 year ago

I have found areas that may be affected and made adjustments. You can grab the code from the develop branch and try it out.

neilpas23 commented 1 year ago

I though I had latest for Arduino ESP32 but I guess I didn't. Updated to 2.0.7 and I believe it works now. Should I still try the change you just made?

lovyan03 commented 1 year ago

If it has been resolved, that's fine.

neilpas23 commented 1 year ago

Thank You