Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error: 'class TFT_eSPI_Button' has no member named 'drawButton2' #2

Closed
tobozo opened this issue Nov 19, 2019 · 13 comments
Closed
Labels
bug Something isn't working

Comments

@tobozo
Copy link
Contributor

tobozo commented Nov 19, 2019

the best I could come up with to end this error was to add this function to TFT_eSPI, not sure what yours is doing though:

void TFT_eSPI_Button::drawButton(String label, boolean inverted) {
  strncpy(_label, label.c_str(), 9);
  drawButton( inverted );
}

looks like it can't be wrapped outside TFT_eSPI anyway

[edit] User_Setup.h for LoLin D32 Pro, just in case someone needs it

// See SetupX_Template.h for all options available
#define ILI9341_DRIVER

// removed all TFT_* pins definitions as those are already defined by Arduino Board setting

#define TFT_BL   32  // LED back-light
#define TOUCH_CS 21     // Chip select pin (T_CS) of touch screen

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

// this will save ~20kbytes of FLASH
#define SMOOTH_FONT

#define SPI_FREQUENCY   5000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000
@tobozo
Copy link
Contributor Author

tobozo commented Nov 19, 2019

kinda working with a LoLin D32 Pro although the Touch doesn't seem to work, I may have to double-check the wiring, thanks for this great project !!

image

@justcallmekoko
Copy link
Owner

@tobozo Thank you for reminding me. I did extend the TFT_eSPI library by adding the drawButton2 function. I can't remember off the top of my head what I have it doing but I will let you know as soon as I sit down at my project PC.

To verify your wiring, check the schematic I included in the repo. The connections on the marauder may be different from the connections you made on your lolin but the inter-pin connections on the TFT will most likely be the issue. Just check and see which pins are part of the same Net on my schematic.

Also check to make sure the tft screen has the touch controller chip on the back. I know some manufacturers ship these screens without the touch controller.

PS. Great job getting it working. Thanks for sharing the picture and the progress.

@justcallmekoko justcallmekoko added the bug Something isn't working label Nov 19, 2019
@justcallmekoko
Copy link
Owner

justcallmekoko commented Nov 19, 2019

@tobozo
Added this line to line 22 of Button.h in the Extensions of Bodmer's TFT_eSPI library

void     drawButton2( String button_name = "", boolean inverted = false);

and this is my drawButton2 function in Button.cpp:

void TFT_eSPI_Button::drawButton2(String button_name, boolean inverted) {
  uint16_t fill, outline, text;

  if(!inverted) {
    fill    = _fillcolor;
    outline = _outlinecolor;
    text    = _textcolor;
  } else {
    fill    = _textcolor;
    outline = _outlinecolor;
    text    = _fillcolor;
  }

  uint8_t r = min(_w, _h) / 4; // Corner radius
  _gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
  _gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);

  _gfx->setTextColor(text);
  _gfx->setTextSize(_textsize);

  uint8_t tempdatum = _gfx->getTextDatum();
  _gfx->setTextDatum(ML_DATUM);
  if (button_name == "")
	_gfx->drawString(_label, _x1 + 22, _y1 + (_h/2));
  else
	_gfx->drawString(button_name, _x1 + 22, _y1 + (_h/2));
  _gfx->setTextDatum(tempdatum);
}

@tobozo
Copy link
Contributor Author

tobozo commented Nov 19, 2019

@justcallmekoko thanks! turns out T_CS was wired to the wrong pin 🤦‍♂️ so touch support is now tested and working as a charm 🎉

@lukorely
Copy link

lukorely commented Jun 1, 2020

when trying to upload the code I skip this in menufunctions.cpp
'class TFT_eSPI' has no member named 'setTouch'

@roschme
Copy link

roschme commented Feb 22, 2021

when trying to upload the code I skip this in menufunctions.cpp
'class TFT_eSPI' has no member named 'setTouch'

Same here unfortunately...

@roschme
Copy link

roschme commented Feb 22, 2021

ok, you'll have to config Bodmer's TFT_eSPI library take a look here:
Bodmer/TFT_eSPI#454 (comment)

@roschme
Copy link

roschme commented Feb 22, 2021

Display.h
Line 50 ->> #define TFT_DIY

@roschme
Copy link

roschme commented Feb 22, 2021

thx@koko great work!

@RChadwick7
Copy link

I have this same issue. I configured Bodmer's library by commenting and uncommenting the proper lines in User_Setup_Select.h, and I uncommented line 50 in Display.h. Is there anything else I'm missing?

@roschme
Copy link

roschme commented Feb 28, 2021

I have this same issue. I configured Bodmer's library by commenting and uncommenting the proper lines in
User_Setup_Select.h, and I uncommented line 50 in Display.h. Is there anything else I'm missing?

If you use the ILI9341, uncomment this in User_Setup_Select.h :

(Line 22)

#define ILI9341_DRIVER

AND this (Line 162; Pins according to "koko's" wiring diagram)

// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ######

// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 17 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
#define TFT_RST 5 // Reset pin (could connect to RST pin)
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST

#define TFT_BL 32 // LED back-light (only for ST7789 with backlight control pin)

#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen

//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only

@RChadwick7
Copy link

That fixed the issue, thanks!

@tigrik191
Copy link

a lot of library errors, give someone realties all the necessary libraries for this project in the archive

Arduino: 1.8.13 (Windows 10), Плата:"ESP32 Wrover Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), QIO, 80MHz, 921600, None"

Несколько библиотек найдено для "WiFi.h"

In file included from c:\users\dmitriy\documents\arduino\libraries\lvgl\src/lv_misc/lv_log.h:16:0,

Используется: C:\Users\Dmitriy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi

             from c:\users\dmitriy\documents\arduino\libraries\lvgl\lvgl.h:25,

Не используется: C:\Program Files\libraries\WiFi

             from C:\Users\Dmitriy\Documents\Arduino\libraries\lvgl\src/lvgl.h:17,

Несколько библиотек найдено для "SD.h"

             from sketch\Display.h:11,

Используется: C:\Users\Dmitriy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\SD

Не используется: C:\Program Files\libraries\SD

             from C:\Users\Dmitriy\Desktop\ESP32Marauder-master\esp32_marauder\esp32_marauder.ino:20:

c:\users\dmitriy\documents\arduino\libraries\lvgl\src\lv_conf_internal.h:40:101: fatal error: ../../lv_conf.h: No such file or directory

compilation terminated.

exit status 1

Ошибка компиляции для платы ESP32 Wrover Module.

Этот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
"Показать подробный вывод во время компиляции"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants