im using arduino ide v2.0.0-rc9 and the board manager is set to my board which is an ESP32 DOIT DEV KIT1. im am getting compile time errors while attempting to use the touch sensors on the esp32 using tcmenu touch button. problem seems to stem from`ESP32TouchKeysAbstraction::runLoop()':. i have not customised any code and am just compiling the src from tcmenu code generation. i have tried setting the touch sensors with my pin numbers which also failed to compile with same error. i uninstalled all tcmenu related files and tried again with default pin settings for the touch sensor plugin.
error is as follows:
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::runLoop()':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:12: multiple definition of `ESP32TouchKeysAbstraction::runLoop()'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:12: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::attachInterrupt(unsigned char, void (*)(), unsigned char)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:16: multiple definition of `ESP32TouchKeysAbstraction::attachInterrupt(unsigned char, void (*)(), unsigned char)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:16: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:5: multiple definition of `intCount'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:5: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `esp32TouchKeyInterruptHandler(void*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:7: multiple definition of `esp32TouchKeyInterruptHandler(void*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:7: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::pinDirection(unsigned char, unsigned char)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:30: multiple definition of `ESP32TouchKeysAbstraction::pinDirection(unsigned char, unsigned char)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:30: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int, touch_high_volt_t, touch_low_volt_t, touch_volt_atten_t)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:37: multiple definition of `ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int, touch_high_volt_t, touch_low_volt_t, touch_volt_atten_t)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:37: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int, touch_high_volt_t, touch_low_volt_t, touch_volt_atten_t)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:37: multiple definition of `ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int, touch_high_volt_t, touch_low_volt_t, touch_volt_atten_t)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:37: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::ensureInterruptRegistered()':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:50: multiple definition of `ESP32TouchKeysAbstraction::ensureInterruptRegistered()'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:50: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\ESP32TouchKeysAbstraction.cpp.o: in function `ESP32TouchKeysAbstraction::readValue(unsigned char)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ESP32TouchKeysAbstraction.cpp:20: multiple definition of `ESP32TouchKeysAbstraction::readValue(unsigned char)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\ESP32TouchKeysAbstraction.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ESP32TouchKeysAbstraction.cpp:20: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o: in function `fnSETTINGSRtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)':
C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:38: multiple definition of `fnSETTINGSRtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:38: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o: in function `fnDISPLAYMODERtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)':
C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:48: multiple definition of `fnDISPLAYMODERtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:48: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/ThemeMonoBordered.h:4: multiple definition of `defaultItemPaletteMono'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ThemeMonoBordered.h:4: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o: in function `installMonoBorderedTheme(tcgfx::GraphicsDeviceRenderer&, tcgfx::MenuFontDef const&, tcgfx::MenuFontDef const&, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/ThemeMonoBordered.h:9: multiple definition of `installMonoBorderedTheme(tcgfx::GraphicsDeviceRenderer&, tcgfx::MenuFontDef const&, tcgfx::MenuFontDef const&, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/ThemeMonoBordered.h:9: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:17: multiple definition of `glArduinoEeprom'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:17: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:18: multiple definition of `gfx'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:18: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:20: multiple definition of `renderer'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:20: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:51: multiple definition of `menuDISPLAYMODE'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:51: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:21: multiple definition of `esp32Touch'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:21: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o: in function `setupMenu()':
C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:53: multiple definition of `setupMenu()'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:53: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:19: multiple definition of `gfxDrawable'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:19: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:16: multiple definition of `applicationInfo'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:16: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:35: multiple definition of `menuBRIGHTNESS'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:35: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:37: multiple definition of `menuNewBoolItemDE'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:37: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:40: multiple definition of `menuBackSETTINGS'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:40: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:41: multiple definition of `menuSETTINGS'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:41: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:47: multiple definition of `menuDISPMODELIST'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:47: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5\src/TCMENU5_menu.cpp:50: multiple definition of `menuBackDISPLAYMODE'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\TCMENU5_menu.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/TCMENU5_menu.cpp:50: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawText(tcgfx::Coord const&, void const*, int, char const*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:66: multiple definition of `U8g2Drawable::drawText(tcgfx::Coord const&, void const*, int, char const*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:66: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawXBitmap(tcgfx::Coord const&, tcgfx::Coord const&, unsigned char const*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:88: multiple definition of `U8g2Drawable::drawXBitmap(tcgfx::Coord const&, tcgfx::Coord const&, unsigned char const*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:88: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawCircle(tcgfx::Coord const&, int, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:109: multiple definition of `U8g2Drawable::drawCircle(tcgfx::Coord const&, int, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:109: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::textExtents(void const*, int, char const*, int*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:134: multiple definition of `U8g2Drawable::textExtents(void const*, int, char const*, int*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:134: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawBox(tcgfx::Coord const&, tcgfx::Coord const&, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:99: multiple definition of `U8g2Drawable::drawBox(tcgfx::Coord const&, tcgfx::Coord const&, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:99: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawPolygon(tcgfx::Coord const*, int, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:114: multiple definition of `U8g2Drawable::drawPolygon(tcgfx::Coord const*, int, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:114: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::transaction(bool, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:124: multiple definition of `U8g2Drawable::transaction(bool, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:124: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::drawBitmap(tcgfx::Coord const&, tcgfx:

rawableIcon const*, bool)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:75: multiple definition of `U8g2Drawable::drawBitmap(tcgfx::Coord const&, tcgfx:

rawableIcon const*, bool)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:75: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `safeGetFont(void const*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:21: multiple definition of `safeGetFont(void const*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:21: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:57: multiple definition of `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:57: first defined here
c:/users/g/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\src\tcMenuU8g2.cpp.o: in function `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)':
C:\Users\G\Documents\Arduino\TCMENU5\src/tcMenuU8g2.cpp:57: multiple definition of `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)'; C:\Users\G\AppData\Local\Temp\arduino-sketch-308E1AD3B25F93D54ED7638502BBDC66\sketch\tcMenuU8g2.cpp.o:C:\Users\G\Documents\Arduino\TCMENU5/tcMenuU8g2.cpp:57: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
TCMENU_5.ino
#include "TCMENU5_menu.h"
void setup() {
setupMenu();
}
void loop() {
taskManager.runLoop();
}
void CALLBACK_FUNCTION DEVMODECallback(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION DISPCallback(int id) {
// TODO - your menu change code
}
void CALLBACK_FUNCTION BRIGHTNESSCallback(int id) {
// TODO - your menu change code
}
TCMENU5_menu.cpp
/*
The code in this file uses open source libraries provided by thecoderscorner
DO NOT EDIT THIS FILE, IT WILL BE GENERATED EVERY TIME YOU USE THE UI DESIGNER
INSTEAD EITHER PUT CODE IN YOUR SKETCH OR CREATE ANOTHER SOURCE FILE.
All the variables you may need access to are marked extern in this file for easy
use elsewhere.
*/
#include <tcMenu.h>
#include "TCMENU5_menu.h"
#include "ThemeMonoBordered.h"
// Global variable declarations
const PROGMEM ConnectorLocalInfo applicationInfo = { "OLED", "8f58573e-a350-4863-a4a6-ad4d5cee06d2" };
ArduinoEEPROMAbstraction glArduinoEeprom(&EEPROM);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C gfx(U8G2_R0, U8X8_PIN_NONE, SCL, SDA);
U8g2Drawable gfxDrawable(&gfx);
GraphicsDeviceRenderer renderer(30, applicationInfo.name, &gfxDrawable);
ESP32TouchKeysAbstraction esp32Touch(800, TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_1V);
// Global Menu Item declarations
const char enumStrBRIGHTNESS_0[] PROGMEM = "255";
const char enumStrBRIGHTNESS_1[] PROGMEM = "225";
const char enumStrBRIGHTNESS_2[] PROGMEM = "200";
const char enumStrBRIGHTNESS_3[] PROGMEM = "175";
const char enumStrBRIGHTNESS_4[] PROGMEM = "150";
const char enumStrBRIGHTNESS_5[] PROGMEM = "125";
const char enumStrBRIGHTNESS_6[] PROGMEM = "100";
const char enumStrBRIGHTNESS_7[] PROGMEM = "75";
const char enumStrBRIGHTNESS_8[] PROGMEM = "50";
const char* const enumStrBRIGHTNESS[] PROGMEM = { enumStrBRIGHTNESS_0, enumStrBRIGHTNESS_1, enumStrBRIGHTNESS_2, enumStrBRIGHTNESS_3, enumStrBRIGHTNESS_4, enumStrBRIGHTNESS_5, enumStrBRIGHTNESS_6, enumStrBRIGHTNESS_7, enumStrBRIGHTNESS_8 };
const PROGMEM EnumMenuInfo minfoBRIGHTNESS = { "BRIGHTNESS", 5, 5, 8, BRIGHTNESSCallback, enumStrBRIGHTNESS };
EnumMenuItem menuBRIGHTNESS(&minfoBRIGHTNESS, 0, NULL);
const PROGMEM BooleanMenuInfo minfoNewBoolItemDE = { "DEV MODE", 4, 4, 1, DEVMODECallback, NAMING_ON_OFF };
BooleanMenuItem menuNewBoolItemDE(&minfoNewBoolItemDE, false, &menuBRIGHTNESS);
RENDERING_CALLBACK_NAME_INVOKE(fnSETTINGSRtCall, backSubItemRenderFn, "SETTINGS", -1, NO_CALLBACK)
const PROGMEM SubMenuInfo minfoSETTINGS = { "SETTINGS", 3, 0xffff, 0, NO_CALLBACK };
BackMenuItem menuBackSETTINGS(fnSETTINGSRtCall, &menuNewBoolItemDE);
SubMenuItem menuSETTINGS(&minfoSETTINGS, &menuBackSETTINGS, NULL);
const char enumStrDISPMODELIST_0[] PROGMEM = "PRESET MODE";
const char enumStrDISPMODELIST_1[] PROGMEM = "ARTNET WIFI";
const char enumStrDISPMODELIST_2[] PROGMEM = "FFT AUDIO";
const char* const enumStrDISPMODELIST[] PROGMEM = { enumStrDISPMODELIST_0, enumStrDISPMODELIST_1, enumStrDISPMODELIST_2 };
const PROGMEM EnumMenuInfo minfoDISPMODELIST = { "DISPMODE_LIST", 2, 2, 2, DISPCallback, enumStrDISPMODELIST };
EnumMenuItem menuDISPMODELIST(&minfoDISPMODELIST, 0, NULL);
RENDERING_CALLBACK_NAME_INVOKE(fnDISPLAYMODERtCall, backSubItemRenderFn, "DISPLAY MODE", -1, NO_CALLBACK)
const PROGMEM SubMenuInfo minfoDISPLAYMODE = { "DISPLAY MODE", 1, 0xffff, 0, NO_CALLBACK };
BackMenuItem menuBackDISPLAYMODE(fnDISPLAYMODERtCall, &menuDISPMODELIST);
SubMenuItem menuDISPLAYMODE(&minfoDISPLAYMODE, &menuBackDISPLAYMODE, &menuSETTINGS);
void setupMenu() {
// First we set up eeprom and authentication (if needed).
menuMgr.setEepromRef(&glArduinoEeprom);
// Code generated by plugins.
gfx.begin();
renderer.setUpdatesPerSecond(10);
switches.init(internalDigitalIo(), SWITCHES_POLL_EVERYTHING, false);
menuMgr.initForUpDownOk(&renderer, &menuDISPLAYMODE, 3, 3, 3);
esp32Touch.ensureInterruptRegistered();
renderer.setTitleMode(BaseGraphicalRenderer::TITLE_FIRST_ROW);
renderer.setUseSliderForAnalog(false);
installMonoBorderedTheme(renderer, MenuFontDef(nullptr, 1), MenuFontDef(nullptr, 1), true);
}
TCMENU5_menu.h
/*
The code in this file uses open source libraries provided by thecoderscorner
DO NOT EDIT THIS FILE, IT WILL BE GENERATED EVERY TIME YOU USE THE UI DESIGNER
INSTEAD EITHER PUT CODE IN YOUR SKETCH OR CREATE ANOTHER SOURCE FILE.
All the variables you may need access to are marked extern in this file for easy
use elsewhere.
*/
#ifndef MENU_GENERATED_CODE_H
#define MENU_GENERATED_CODE_H
#include <Arduino.h>
#include <tcMenu.h>
#include "tcMenuU8g2.h"
#include "ESP32TouchKeysAbstraction.h"
#include <IoAbstraction.h>
#include <ArduinoEEPROMAbstraction.h>
// variables we declare that you may need to access
extern const PROGMEM ConnectorLocalInfo applicationInfo;
extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C gfx;
extern GraphicsDeviceRenderer renderer;
extern ESP32TouchKeysAbstraction esp32Touch;
// Any externals needed by IO expanders, EEPROMs etc
// Global Menu Item exports
extern EnumMenuItem menuBRIGHTNESS;
extern BooleanMenuItem menuNewBoolItemDE;
extern BackMenuItem menuBackSETTINGS;
extern SubMenuItem menuSETTINGS;
extern EnumMenuItem menuDISPMODELIST;
extern BackMenuItem menuBackDISPLAYMODE;
extern SubMenuItem menuDISPLAYMODE;
// Provide a wrapper to get hold of the root menu item and export setupMenu
inline MenuItem& rootMenuItem() { return menuDISPLAYMODE; }
void setupMenu();
// Callback functions must always include CALLBACK_FUNCTION after the return type
#define CALLBACK_FUNCTION
void CALLBACK_FUNCTION BRIGHTNESSCallback(int id);
void CALLBACK_FUNCTION DEVMODECallback(int id);
void CALLBACK_FUNCTION DISPCallback(int id);
#endif // MENU_GENERATED_CODE_H
tcMenuU8g2.cpp
/*
* Copyright (c) 2018
https://www.thecoderscorner.com (Dave Cherry).
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
*/
/**
* @file tcMenuU8g2.h
*
* U8g2 renderer that renders menus onto this type of display. This file is a plugin file and should not
* be directly edited, it will be replaced each time the project is built. If you want to edit this file in place,
* make sure to rename it first.
*
* LIBRARY REQUIREMENT
* This library requires the u8g2 library available for download from your IDE library manager.
*/
#include <U8g2lib.h>
#include <Wire.h>
#include "tcMenuU8g2.h"
const uint8_t* safeGetFont(const void* fnt) {
if(fnt) return static_cast<const uint8_t *>(fnt);
return u8g2_font_6x10_tf;
}
#if WANT_TASK_MANAGER_FRIENDLY_YIELD == 1
static uint8_t bytesSent = 0;
TwoWire* U8g2Drawable::pWire = nullptr;
uint8_t u8g2_byte_with_yield(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) {
if(!U8g2Drawable::pWire) return 0;
switch(msg)
{
case U8X8_MSG_BYTE_SEND:
bytesSent+= arg_int;
U8g2Drawable::pWire->write((uint8_t *)arg_ptr, (int)arg_int);
if(bytesSent > 16) {
taskManager.yieldForMicros(0);
bytesSent = 0;
}
break;
case U8X8_MSG_BYTE_START_TRANSFER:
U8g2Drawable::pWire->beginTransmission(u8x8_GetI2CAddress(u8x

>>1);
break;
case U8X8_MSG_BYTE_END_TRANSFER:
U8g2Drawable::pWire->endTransmission();
break;
case U8X8_MSG_BYTE_INIT:
case U8X8_MSG_BYTE_SET_DC:
break;
default:
return 0;
}
return 1;
}
#endif // WANT_TASK_MANAGER_FRIENDLY_YIELD
U8g2Drawable::U8g2Drawable(U8G2 *u8g2, TwoWire* wireImpl) : u8g2(u8g2) {
#if WANT_TASK_MANAGER_FRIENDLY_YIELD == 1
pWire = wireImpl;
if(wireImpl) {
u8g2->getU8x8()->byte_cb = u8g2_byte_with_yield;
}
#endif
}
void U8g2Drawable::drawText(const Coord &where, const void *font, int mag, const char *text) {
u8g2->setFont(safeGetFont(font));
u8g2->setFontMode(drawColor == 2);
auto extraHeight = u8g2->getMaxCharHeight();
u8g2->setDrawColor(drawColor);
u8g2->setCursor(where.x, where.y + extraHeight);
u8g2->print(text);
}
void U8g2Drawable::drawBitmap(const Coord &where, const DrawableIcon *icon, bool selected) {
u8g2->setDrawColor(backgroundColor);
u8g2->drawBox(where.x, where.y, icon->getDimensions().x, icon->getDimensions().y);
u8g2->setDrawColor(drawColor);
if(icon->getIconType() == DrawableIcon::ICON_XBITMAP) {
#if defined(__AVR__) || defined(ESP8266)
u8g2->drawXBMP(where.x, where.y, icon->getDimensions().x, icon->getDimensions().y, icon->getIcon(selected));
#else
u8g2->drawXBM(where.x, where.y, icon->getDimensions().x, icon->getDimensions().y, icon->getIcon(selected));
#endif
}
}
void U8g2Drawable::drawXBitmap(const Coord &where, const Coord &size, const uint8_t *data) {
u8g2->setDrawColor(backgroundColor);
u8g2->drawBox(where.x, where.y, size.x, size.y);
u8g2->setDrawColor(drawColor);
#if defined(__AVR__) || defined(ESP8266)
u8g2->drawXBMP(where.x, where.y, size.x, size.y, data);
#else
u8g2->drawXBM(where.x, where.y, size.x, size.y, data);
#endif
}
void U8g2Drawable::drawBox(const Coord &where, const Coord &size, bool filled) {
u8g2->setDrawColor(drawColor);
if(filled) {
u8g2->drawBox(where.x, where.y, size.x, size.y);
}
else {
u8g2->drawFrame(where.x, where.y, size.x, size.y);
}
}
void U8g2Drawable::drawCircle(const Coord &where, int radius, bool filled) {
u8g2->setDrawColor(drawColor);
u8g2->drawCircle(where.x, where.y, radius);
}
void U8g2Drawable::drawPolygon(const Coord *points, int numPoints, bool filled) {
if(numPoints == 2) {
u8g2->drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
}
else if(numPoints == 3) {
u8g2->drawTriangle(points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y);
}
}
void U8g2Drawable::transaction(bool isStarting, bool redrawNeeded) {
if(isStarting) {
u8g2->setFontPosBottom();
u8g2->setFontRefHeightExtendedText();
}
else if(redrawNeeded) {
u8g2->sendBuffer();
}
}
Coord U8g2Drawable::textExtents(const void *font, int mag, const char *text, int *baseline) {
u8g2->setFont(safeGetFont(font));
if(baseline) *baseline = (int)u8g2->getFontDescent();
return Coord(u8g2->getStrWidth(text), u8g2->getMaxCharHeight());
}
tcMenuU8g2.h
/*
* Copyright (c) 2018
https://www.thecoderscorner.com (Dave Cherry).
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
*/
/**
* @file tcMenuU8g2.h
*
* U8g2 renderer that renders menus onto this type of display. This file is a plugin file and should not
* be directly edited, it will be replaced each time the project is built. If you want to edit this file in place,
* make sure to rename it first.
*
* LIBRARY REQUIREMENT
* This library requires the u8g2 library available for download from your IDE library manager.
*/
#ifndef _TCMENU_U8G2_H_
#define _TCMENU_U8G2_H_
#include <tcMenu.h>
#include <tcUtil.h>
#include <Wire.h>
#include <U8g2lib.h>
#include <graphics/BaseGraphicalRenderer.h>
#include <graphics/GraphicsDeviceRenderer.h>
#include <BaseDialog.h>
#include <tcUtil.h>
// If you DONT want task manager yield code in I2C set to 0
#ifndef WANT_TASK_MANAGER_FRIENDLY_YIELD
#define WANT_TASK_MANAGER_FRIENDLY_YIELD 0
#endif // WANT_TASK_MANAGER_FRIENDLY_YIELD
using namespace tcgfx;
/**
* A standard menu render configuration that describes how to renderer each item and the title.
* Specialised for u8g2 fonts.
*/
typedef struct ColorGfxMenuConfig<const uint8_t*> U8g2GfxMenuConfig;
// some colour displays don't create this value
#ifndef BLACK
#define BLACK 0
#endif
// some colour displays don't create this value
#ifndef WHITE
#define WHITE 1
#endif
/**
* This is used to draw to I2C including a task manager yield to improve performance on slower I2C devices.
* Not really needed for SPI as we are talking in low order millis for a full refresh.
*/
uint8_t u8g2_byte_with_yield(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
/**
* A basic renderer that can use the AdaFruit_GFX library to render information onto a suitable
* display. It is your responsibility to fully initialise and prepare the display before passing
* it to this renderer. The usual procedure is to create a display variable globally in your
* sketch and then provide that as the parameter to setGraphicsDevice. If you are using the
* designer you provide the display variable name in the code generation parameters.
*
* You can also override many elements of the display using AdaColorGfxMenuConfig, to use the defaults
* just call prepareAdaColorDefaultGfxConfig(..) passing it a pointer to your config object. Again the
* designer UI takes care of this.
*/
class U8g2Drawable : public DeviceDrawable {
private:
U8G2* u8g2;
#if WANT_TASK_MANAGER_FRIENDLY_YIELD == 1
static TwoWire* pWire;
friend uint8_t u8g2_byte_with_yield(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
#endif // WANT_TASK_MANAGER_FRIENDLY_YIELD
public:
explicit U8g2Drawable(U8G2* u8g2, TwoWire* wire = nullptr);
~U8g2Drawable() override = default;
DeviceDrawable* getSubDeviceFor(const Coord &where, const Coord &size, const color_t *palette, int paletteSize) override {return nullptr; }
void drawText(const Coord &where, const void *font, int mag, const char *text) override;
void drawBitmap(const Coord &where, const DrawableIcon *icon, bool selected) override;
void drawXBitmap(const Coord &where, const Coord &size, const uint8_t *data) override;
void drawBox(const Coord &where, const Coord &size, bool filled) override;
void drawCircle(const Coord &where, int radius, bool filled) override;
void drawPolygon(const Coord *points, int numPoints, bool filled) override;
Coord getDisplayDimensions() override { return Coord(u8g2->getWidth(), u8g2->getHeight()); }
void transaction(bool isStarting, bool redrawNeeded) override;
Coord textExtents(const void *font, int mag, const char *text, int *baseline) override;
color_t getUnderlyingColor(color_t col) { return (col<4) ? col : 1; }
};
#endif // _TCMENU_U8G2_H_
ESP32TouchKeysAbstraction.cpp
#include <PlatformDetermination.h>
#include "ESP32TouchKeysAbstraction.h"
#include <driver/touch_sensor.h>
volatile int intCount = 0;
void esp32TouchKeyInterruptHandler(void* touchAbsAsVoid) {
TaskManager::markInterrupted(0);
intCount++;
}
bool ESP32TouchKeysAbstraction::runLoop() {
return allOk;
}
void ESP32TouchKeysAbstraction::attachInterrupt(pinid_t pin, RawIntHandler interruptHandler, uint8_t mode) {
interruptCodeNeeded = true;
}
uint8_t ESP32TouchKeysAbstraction::readValue(pinid_t pin) {
if(!allOk) return 0;
ensureInterruptRegistered();
uint16_t val;
touch_pad_read_filtered((touch_pad_t)pin, &val);
return val <= pinThreshold;
}
void ESP32TouchKeysAbstraction::pinDirection(pinid_t pin, uint8_t mode) {
if(!allOk) return;
serdebugF2("Pin Direction ", pin);
touch_pad_config((touch_pad_t) pin, pinThreshold);
touch_pad_set_trigger_mode(TOUCH_TRIGGER_BELOW);
}
ESP32TouchKeysAbstraction::ESP32TouchKeysAbstraction(int defThreshold, touch_high_volt_t highVoltage,
touch_low_volt_t lowVoltage, touch_volt_atten_t attenuation) {
allOk = touch_pad_init() == ESP_OK;
serdebugF2("touch_pad_init ", allOk);
touch_pad_set_voltage(highVoltage, lowVoltage, attenuation);
serdebugF2("touch_pad set voltage ", allOk);
interruptCodeNeeded = false;
startedUp = false;
pinThreshold = defThreshold;
enabledPinMask = 0;
taskManager.scheduleFixedRate(5, [] {serdebugF2("intCount=", intCount);}, TIME_SECONDS);
}
void ESP32TouchKeysAbstraction::ensureInterruptRegistered() {
if(!startedUp) {
startedUp = true;
touch_pad_filter_start(DEFAULT_TOUCHKEY_FILTER_FREQ);
}
if(interruptCodeNeeded) {
interruptCodeNeeded = false;
touch_pad_isr_register(esp32TouchKeyInterruptHandler, this);
allOk = touch_pad_intr_enable() == ESP_OK;
serdebugF2("Enabled interrupts for touch sensor ok=", allOk);
}
}
ESP32TouchKeysAbstraction.h
/*
* Copyright (c) 2018
https://www.thecoderscorner.com (Dave Cherry).
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
*/
#ifndef IOABSTRACTION_ESP32TOUCHKEYSABSTRACTION_H
#define IOABSTRACTION_ESP32TOUCHKEYSABSTRACTION_H
#include <IoAbstraction.h>
/**
* @file ESP32TouchKeysAbstraction.h
*
* Contains an ESP32 specific touch key implementation
*/
#ifndef DEFAULT_TOUCHKEY_FILTER_FREQ
#define DEFAULT_TOUCHKEY_FILTER_FREQ 10
#endif
/**
* An IoAbstraction tht can work with the touch key sensors on ESP32 boards using the underlying functions.
*/
class ESP32TouchKeysAbstraction : public BasicIoAbstraction {
private:
uint16_t pinThreshold;
uint16_t enabledPinMask;
bool allOk;
bool interruptCodeNeeded;
bool startedUp;
public:
ESP32TouchKeysAbstraction(int defThreshold, touch_high_volt_t highVoltage = TOUCH_HVOLT_2V7, touch_low_volt_t lowVoltage = TOUCH_LVOLT_0V5,
touch_volt_atten_t attenuation = TOUCH_HVOLT_ATTEN_1V);
~ESP32TouchKeysAbstraction() override = default;
void ensureInterruptRegistered();
/**
* You can call this method to check if any errors occurred during initialisation
* @return true if correctly created, otherwise false.
*/
bool isCorrectlyCreated() const { return allOk; }
/**
* Sets the direction, but direction is always input for this abstraction. Must still be called to initialise the
* touch interface for that pin.
* @param pin the touch pin number 0..9
* @param mode always input, ignored
*/
void pinDirection(pinid_t pin, uint8_t mode) override;
uint8_t readValue(pinid_t pin) override;
void attachInterrupt(pinid_t pin, RawIntHandler interruptHandler, uint8_t mode) override;
bool runLoop() override;
//
// Unimplemented functions
//
void writePort(pinid_t pin, uint8_t portVal) override { }
void writeValue(pinid_t pin, uint8_t value) override { }
uint8_t readPort(pinid_t pin) override { return 0; }
};
#endif //IOABSTRACTION_ESP32TOUCHKEYSABSTRACTION_H