rzeldent / esp32-smartdisplay

PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S024N/R/C, ESP32-2432S028R/C, ESP32-3248S035R/C, ESP32_8048S070N/C
https://github.com/rzeldent/platformio-espressif32-sunton
GNU General Public License v3.0
400 stars 71 forks source link

Compilation issue with touch & ESP32-8048S070 #104

Closed dronecz closed 8 months ago

dronecz commented 8 months ago

Hello,

I´m trying to port this project from ESP32-2432S028R to ESP32-8048S070 and I can not make it compile. Compiler give me this issue:

c:/users/dronecz/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio/build/esp32-8048S070C/src/main.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: multiple definition of "touch_calibration_data"; .pio/build/esp328048S070C/src/core/screen_driver.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: first defined here c:/users/dronecz/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio/build/esp32-8048S070C/src/ui/ip_setup.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: multiple definition of "touch_calibration_data"; .pio/build/esp32-8048S070C/src/core/screen_driver.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: first defined here c:/users/dronecz/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio/build/esp32-8048S070C/src/ui/main_ui.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: multiple definition of "touch_calibration_data"; .pio/build/esp32-8048S070C/src/core/screen_driver.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: first defined here c:/users/dronecz/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio/build/esp32-8048S070C/src/ui/panels/settings_panel.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: multiple definition of "touch_calibration_data"; .pio/build/esp32-8048S070C/src/core/screen_driver.cpp.o:C:\Users\dronecz\Documents\GitHub\CYD-Klipper\CYD-Klipper/.pio/libdeps/esp32-8048S070C/esp32_smartdisplay/include/esp32_smartdisplay.h:37: first defined here

If I remove "-DBOARD_HAS_TOUCH" from JSON file, I can compile code and upload it to the display. Code does not work properly yet, but I can at least see something on the screen (if I comment out some lines in setup and loop of the program).

Here is my fork with changes for the bigger display.

Many thanks for any help and thank you for your awesome library!

rzeldent commented 8 months ago

The smartdisplay.h file can only be included once; but is included in multiple projects:

Can you try to put extern in front of the definition in the smartdisplay.h? touch_calibration_data_t touch_calibration_data;

dronecz commented 8 months ago

Thank you very much!

I added an extern to the esp32_smartdisplay.h and now I can compile it with touch. image