You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ESP-NOW接收回调获取到错误MAC地址问题求助

ESP-NOW接收回调获取到错误MAC地址问题求助

我有两台ESP32设备,使用ESP-NOW在它们之间传输数据。

下面是两台设备上的onMessageReceived函数:

typedef struct {
  uint8_t type;
  uint8_t data[MAX_PAYLOAD_SIZE];
} Message;

void onDataReceived(const uint8_t* macAddr, const uint8_t* data, int len) {
  Message msg;
  memcpy(&msg, data, sizeof(Message));

  Serial.print("Received message of type: ");
  Serial.print(msg.type);
  Serial.print(" from: ");
  Serial.printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
                macAddr[0], macAddr[1], macAddr[2],
                macAddr[3], macAddr[4], macAddr[5]);
}

我是这样注册回调函数的:esp_now_register_recv_cb(esp_now_recv_cb_t(onDataReceived));

当发送消息时,两台ESP32的串口监视器都会输出类似这样的内容:

Received message of type: 1 from: 46:f3:fa:3f:40:f3

但这个MAC地址并不是两台ESP32中任何一台的,我完全搞不清它是从哪来的...

备注:内容来源于stack exchange,提问作者SagiZiv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 09:58:09