我正在使用 PowerPoint_to_sketch powerpoint 宏从演示文稿文件生成 ino 文件。
问题就在这里。遵守第一个示例样式中列出的规则后,ino 文件已成功自动生成,但是在尝试为 ESP32 编译该文件并连接到它的 320x240 TFT+触摸显示屏后,出现了一些我不知道的错误怎么解决。 (我确定 TFT_eSPI 库配置正确。)
这是错误:
Indexing .pio\build\esp32doit-devkit-v1\lib37e\libTFT_eSPI.a
src/main.cpp:31:33: error: no matching function for call to 'TFT_eSPI_ext::TFT_eSPI_ext()'
TFT_eSPI_ext tft = TFT_eSPI_ext();
^
In file included from lib/PowerPoint_to_sketch/ILI9341_t3.h:2,
from lib/PowerPoint_to_sketch/font_Arial.h:4,
from src/main.cpp:24:
lib/PowerPoint_to_sketch/TFT_eSPI_ext.h:36:3: note: candidate: 'TFT_eSPI_ext::TFT_eSPI_ext(TFT_eSPI*)'
TFT_eSPI_ext(TFT_eSPI *tft)
^~~~~~~~~~~~
lib/PowerPoint_to_sketch/TFT_eSPI_ext.h:36:3: note: candidate expects 1 argument, 0 provided
lib/PowerPoint_to_sketch/TFT_eSPI_ext.h:29:7: note: candidate: 'TFT_eSPI_ext::TFT_eSPI_ext(const TFT_eSPI_ext&)'
class TFT_eSPI_ext : public TFT_eSPI
^~~~~~~~~~~~
lib/PowerPoint_to_sketch/TFT_eSPI_ext.h:29:7: note: candidate expects 1 argument, 0 provided
src/main.cpp: In function 'void setup()':
src/main.cpp:75:44: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button4.initButton(&tft,154, 54, 222, 5, 0x10000, 0xFFFF, 0xFFFF, buttonLabel4, 2);
^~~~~~~
src/main.cpp:76:46: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button5.initButton(&tft,154, 112, 193, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel5, 2);
^~~~~~~
src/main.cpp:77:46: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button6.initButton(&tft,154, 168, 193, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel6, 2);
^~~~~~~
src/main.cpp:78:44: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button7.initButton(&tft,294, 24, 37, 35, 0x10000, 0xF800, 0xFFFF, buttonLabel7, 2);
^~~~~~~
src/main.cpp:79:45: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button8.initButton(&tft,93, 110, 110, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel8, 2);
^~~~~~~
src/main.cpp:80:46: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button9.initButton(&tft,215, 112, 110, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel9, 2);
^~~~~~~
src/main.cpp:81:46: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button10.initButton(&tft,93, 170, 110, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel10, 2);
^~~~~~~
src/main.cpp:82:47: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button11.initButton(&tft,215, 170, 110, 31, 0x10000, 0xC2C2, 0xFFFF, buttonLabel11, 2);
^~~~~~~
src/main.cpp:83:45: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button12.initButton(&tft,154, 54, 222, 5, 0x10000, 0xFFFF, 0xFFFF, buttonLabel12, 2);
^~~~~~~
src/main.cpp:84:45: warning: unsigned conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} changes value from '65536' to '0' [-Woverflow]
Button13.initButton(&tft,294, 24, 37, 35, 0x10000, 0xF800, 0xFFFF, buttonLabel13, 2);
^~~~~~~
src/main.cpp: In function 'void loop()':
src/main.cpp:92:3: error: 'Screen1' was not declared in this scope
Screen1();
^~~~~~~
src/main.cpp:92:3: note: suggested alternative: '_reent'
Screen1();
^~~~~~~
_reent
src/main.cpp:97:3: error: 'Screen2' was not declared in this scope
Screen2();
^~~~~~~
src/main.cpp:97:3: note: suggested alternative: '_reent'
Screen2();
^~~~~~~
_reent
src/main.cpp:102:3: error: 'Screen3' was not declared in this scope
Screen3();
^~~~~~~
src/main.cpp:102:3: note: suggested alternative: '_reent'
Screen3();
^~~~~~~
_reent
Compiling .pio\build\esp32doit-devkit-v1\libc11\PowerPoint_to_sketch\font_ArialBold.c.o
*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
这是我的一段代码,提供了一些信息:
#include <font_Arial.h>
#include <font_ArialBold.h>
#include <font_ArialItalic.h>
#include <font_ArialBoldItalic.h>
#include <SPI.h>
#include <TFT_eSPI_ext.h>
TFT_eSPI_ext tft = TFT_eSPI_ext();
在此存储库中,可以找到所有需要的标头:TFT_eSPI_ext
问题已经解决了。
我刚刚换了
TFT_eSPI_ext tft = TFT_eSPI_ext();
由
TFT_eSPI tftExt; // Create the base TFT_eSPI instance
TFT_eSPI_ext tft(&tftExt); // Pass a pointer to the base instance
还在指令之后和设置函数之前添加了屏幕声明,现在一切正常。