evert-arias / EasyButton

Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
https://easybtn.earias.me
MIT License
452 stars 63 forks source link

Pressed example does not work with new Arduino Nano ESP32 board #85

Closed jsolderitsch closed 1 year ago

jsolderitsch commented 1 year ago

I posted an inquiry at: https://forum.arduino.cc/t/easybutton-library-sample-code-does-not-work/1155696

The standard pressed.ino example throws exceptions:

In file included from /Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/Arduino.h:223,
                 from /private/var/folders/6v/1p1396h55_72kp8gnv3gsnv00000gq/T/arduino/sketches/9AF4919C475D15D2FB9CC92B2D1DAFB4/sketch/Pressed-Nano-ESP32.ino.cpp:1:
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/io_pin_remap.h:44:69: error: variable or field 'attachInterrupt' declared void
 #define attachInterrupt(pin, fcn, mode)             attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)
                                                                     ^~~~~~~~~~~~~~~~~~~~~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/FunctionalInterrupt.h:18:6: note: in expansion of macro 'attachInterrupt'
 void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
      ^~~~~~~~~~~~~~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/FunctionalInterrupt.h:18:30: error: expected primary-expression before 'pin'
 void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
                              ^~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/io_pin_remap.h:44:92: note: in definition of macro 'attachInterrupt'
 #define attachInterrupt(pin, fcn, mode)             attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)
                                                                                            ^~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/FunctionalInterrupt.h:18:61: error: expected primary-expression before 'intRoutine'
 void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
                                                             ^~~~~~~~~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/io_pin_remap.h:44:98: note: in definition of macro 'attachInterrupt'
 #define attachInterrupt(pin, fcn, mode)             attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)
                                                                                                  ^~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/FunctionalInterrupt.h:18:73: error: expected primary-expression before 'int'
 void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
                                                                         ^~~
/Users/jjs/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32/io_pin_remap.h:44:103: note: in definition of macro 'attachInterrupt'
 #define attachInterrupt(pin, fcn, mode)             attachInterrupt(digitalPinToGPIONumber(pin), fcn, mode)
                                                                                                       ^~~~

exit status 1

Compilation error: exit status 1
jsolderitsch commented 1 year ago

A member of the Arduino team replied to my forum post and said he duplicated the problem and reported that this will be fixed in the next release of the Nano ESP32 core. He also noted a work-around and applying this temporary fix solved the compilation problem for me.

Closing this issue as it does not seem to be an EasyButton problem.