How to fix 'Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled' caused by registerForNotify()

How to fix 'Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled' caused by registerForNotify()

我正在尝试通过蓝牙连接两台ESP32,一台作为服务器,一台作为客户端。将客户端连接到服务器工作正常,发现特征也有效。但是当我尝试为通知注册特性时,我收到一条错误消息。

我的其余代码似乎工作正常,因为如果我不注册通知特性,我不会有任何问题。

if (pRemoteCharacteristic->canNotify()) {
  Serial.println("Setting up notify");
  pRemoteCharacteristic->registerForNotify(notifyCallback);
}

我总是收到以下错误消息:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d495f  PS      : 0x00060330  A0      : 0x800d4154      A1      : 0x3ffca250
A2      : 0x00000000  A3      : 0x3ffca29e  A4      : 0x00000002      A5      : 0x00000000
A6      : 0x3ffe1ac8  A7      : 0x3f01a2e0  A8      : 0x800d3e4c      A9      : 0x3ffca200
A10     : 0x3ffca24c  A11     : 0xaab8b50c  A12     : 0x3ffc60e4      A13     : 0xaab8b50c
A14     : 0x3ffca200  A15     : 0xff000000  SAR     : 0x00000008      EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000030  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6      LCOUNT  : 0x00000000

Backtrace: 0x400d495f:0x3ffca250 0x400d4151:0x3ffca280 0x400d1ba5:0x3ffca2e0 0x400d1c42:0x3ffca350 0x400d86bd:0x3ffca390 0x40090461:0x3ffca3b0

BLE 实现在某些部分使用字符串(小 s)函数并使用此方法,如

msg += ab.toString();

附加它们。

在 Avr 微控制器上,这会导致堆碎片,导致意外结果,例如 crash.The 通知(查看相应的 BLERemoteCharacteristic.h 和 cpp 文件)以这种方式构建消息。 (在编写最新的 aval 时版本为 1.0.4。) 将此问题作为可能的错误提交给 github 存储库。