T-vK / ESP32-BLE-Keyboard

Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
2.28k stars 379 forks source link

ESP32 keeps rebooting when I call release() or releaseAll() method #221

Open evans-picolo opened 1 year ago

evans-picolo commented 1 year ago

Hello, how are you?

I'm trying to run a BleKeyboard on my project with ESP32 but it keeps rebooting. I did some testing and discovered it has something to do with the release() and releaseAll() methods, since the problem won't occour when I comment them.

Board: ESP32 dev module Compiler: Arduino IDE 1.8.15 on Windows 7 Library version: 0.3.2 OS tested: IOS, Android and Windows 11

Here is the reboot message on serial monitor: abort() was called at PC 0x4016c5bb on core 1 14:34:37.233 -> 14:34:37.233 -> Backtrace: 0x40091448:0x3ffc8500 0x40091679:0x3ffc8520 0x4016c5bb:0x3ffc8540 0x4016c602:0x3ffc8560 0x4016b8d5:0x3ffc8580 0x4016b658:0x3ffc85a0 0x400d4b0d:0x3ffc85c0 0x400d6d72:0x3ffc85e0 0x400d3997:0x3ffc8610 0x400d20c7:0x3ffc86f0 0x400d21e9:0x3ffc8710 0x400d19bc:0x3ffc8730 0x400d88d5:0x3ffc8750 0x4008e089:0x3ffc8770 14:34:37.280 -> 14:34:37.280 -> Rebooting... 14:34:37.280 -> ets Jun 8 2016 00:22:57 14:34:37.280 -> 14:34:37.280 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 14:34:37.280 -> configsip: 0, SPIWP:0xee 14:34:37.280 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 14:34:37.280 -> mode:DIO, clock div:1 14:34:37.280 -> load:0x3fff0018,len:4 14:34:37.280 -> load:0x3fff001c,len:1216 14:34:37.280 -> ho 0 tail 12 room 4 14:34:37.280 -> load:0x40078000,len:9720 14:34:37.280 -> ho 0 tail 12 room 4 14:34:37.326 -> load:0x40080400,len:6352 14:34:37.326 -> entry 0x400806b8

And here is the Exception Decoder result: 0x40091448: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155 0x40091679: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170 0x4016c5bb: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 43 0x4016c602: std::unexpected() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc line 70 0x4016b8d5: __cxxabiv1::__cxa_free_exception(void*) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_alloc.cc line 278 0x4016b658: __cxxabiv1::__class_type_info::~__class_type_info() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/class_type_info.cc line 29 0x400d4b0d: std::_Rb_tree , std::_Select1st >, std::less , std::allocator > >::_M_copy , std::_Select1st >, std::less , std::allocator > >::_Alloc_node>(std::_Rb_tree_node > const*, std::_Rb_tree_node >*, std::_Rb_tree , std::_Select1st >, std::less , std::allocator > >::_Alloc_node&) at c:\users\asthor\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits/stl_tree.h line 570 0x400d6d72: BLEServer::getPeerDevices(bool) at c:\users\asthor\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits/stl_tree.h line 107 0x400d3997: BLECharacteristic::notify(bool) at C:\Users\Asthor\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\BLE\src\BLECharacteristic.cpp line 522 0x400d20c7: BleKeyboard::press(unsigned char) at C:\Users\Asthor\OneDrive\Projetos Asthor\Arduino\libraries\ESP32-BLE-Keyboard-master\BleKeyboard.cpp line 362 0x400d21e9: BleKeyboard::write(unsigned char) at C:\Users\Asthor\OneDrive\Projetos Asthor\Arduino\libraries\ESP32-BLE-Keyboard-master\BleKeyboard.cpp line 475 0x400d19bc: BleKeyboard::~BleKeyboard() at C:\Users\Asthor\OneDrive\Projetos Asthor\Arduino\libraries\ESP32-BLE-Keyboard-master/BleKeyboard.h line 131 0x400d88d5: app_main() at C:\Users\Asthor\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\main.cpp line 27 0x4008e089: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

Finaly, here is my code: Code