Search code examples
c++

Problem with building the generated ino file from ppt


I'm using PowerPoint_to_sketch powerpoint macro to generate ino files from a presentation file.

Here is the problem. After complying with the rules listed at the first sample style, the ino file has been successfully autogenerated, BUT after trying to compile the file for ESP32 and a 320x240 TFT+touch display connected to it, there are some errors that I don't know how to solve. ( I'm sure that TFT_eSPI lib is configured correctly.)

Here is the error:



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

and here is a piece of my code providing some information:

#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();

In this repo, all needed headers can be found: TFT_eSPI_ext


Solution

  • The problem's been solved.

    I just replaced

    TFT_eSPI_ext tft = TFT_eSPI_ext();
    

    By

    TFT_eSPI tftExt; // Create the base TFT_eSPI instance
    TFT_eSPI_ext tft(&tftExt); // Pass a pointer to the base instance
    

    Also declarations of Screens after directives and before the setup function were added and everything works now.