crankyoldgit / IRremoteESP8266

Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
GNU Lesser General Public License v2.1
3k stars 833 forks source link

timer-related functions in IRrecv.cpp need to be updated #2122

Closed xiemeiping closed 3 months ago

xiemeiping commented 3 months ago

Dear Developer,

I am using an ESP32 WROOM 32E with the Espressif ESP32 board. Due to changes in function names and usage in the ESP32 core, I am encountering the following error when using the library. It seems the timer-related functions in IRrecv.cpp need to be updated. Please refer to the link for more information: https://docs.espressif.com/projects/arduino-esp32/en/latest/api/timer.html

c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In function 'void gpio_intr()': c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:246:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'? 246 | timerAlarmEnable(timer); | ^~~~ | timerAlarm c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'void IRrecv::enableIRIn(bool)': c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:362:21: error: too many arguments to function 'hw_timer_t timerBegin(uint32_t)' 362 | timer = timerBegin(_timer_num, 80, true); | ~~^~~~~~ In file included from C:\Users\Daisy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal.h:84, from C:\Users\Daisy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/Arduino.h:36, from c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10, from c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6: C:\Users\Daisy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:35:13: note: declared here 35 | hw_timer_t timerBegin(uint32_t frequency); | ^~~~~~ c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:371:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'? 371 | timerAlarmWrite(timer, MS_TO_USEC(params.timeout), ONCE); | ^~~~~~~ | timerWrite c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:375:23: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t, void ()())' 375 | timerAttachInterrupt(timer, &read_timeout, false); | ~~~~^~~~~~~~~ C:\Users\Daisy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:50:6: note: declared here 50 | void timerAttachInterrupt(hw_timer_t timer, void (userFunc)(void)); | ^~~~~~~~ c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'void IRrecv::disableIRIn()': c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:401:3: error: 'timerAlarmDisable' was not declared in this scope 401 | timerAlarmDisable(timer); | ^~~~~ c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'void IRrecv::pause()': c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:416:3: error: 'gpio_intr_disable' was not declared in this scope; did you mean 'esp_intr_disable'? 416 | gpio_intr_disable((gpio_num_t)params.recvpin); | ^~~~~ | esp_intr_disable c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'void IRrecv::resume()': c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:429:3: error: 'timerAlarmDisable' was not declared in this scope 429 | timerAlarmDisable(timer); | ^~~~~ c:\Users\Daisy\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:430:3: error: 'gpio_intr_enable' was not declared in this scope; did you mean 'esp_intr_enable'? 430 | gpio_intr_enable((gpio_num_t)params.recvpin); | ^~~~ | esp_intr_enable

exit status 1

Compilation error: exit status 1

I kindly request you to update the library at your earliest convenience. Thank you very much for your assistance!

NiKiZe commented 3 months ago
  1. You are opening a duplicate of existing issue. Always search at least once before opening something new https://github.com/search?q=repo%3Acrankyoldgit%2FIRremoteESP8266+timerAlarmEnable&type=issues
  2. You ignored the issue template. In the end, that ends up being quite rude.
xiemeiping commented 3 months ago

I apologize, this was my first time asking a question and I did not notice the issue template. I will pay attention to it next time.