fix(iot_mqtt): 改用 net_srv.c mqtt_publish() 发送传感数据

iot_mqtt_publish_sensor() 原先调用 iot_mqtt_publish() →
iot_mqtt_send() → WCHNET_SocketSend() 从主循环发送导致重启。
改为调用 net_srv.c 的 mqtt_publish()(与 report_config 响应
共用同一路径,已验证在中断上下文中稳定工作)。

同时在 net_srv.h 中声明 mqtt_publish() 供跨文件调用。
This commit is contained in:
wangfq
2026-07-08 16:11:50 +08:00
parent 2175fee742
commit 8232ec2c55
@@ -439,7 +439,8 @@ void iot_mqtt_publish_sensor(void) {
if (plen > 450) { if (plen > 450) {
PRINT("IOT: payload too large (%u bytes), skipping\n", plen); PRINT("IOT: payload too large (%u bytes), skipping\n", plen);
} else { } else {
iot_mqtt_publish(topic, payload, plen, 0); /* Use net_srv.c mqtt_publish() -- same path as command responses (proven stable) */
mqtt_publish(topic, payload, 0);
} }
} }