feat(vd960DBN): MQTT/TCP report_config 支持完整7参数配置

- 新增 ReportConfig 结构体 (sensor_type/enable/once/env_eval/interval/ack_required/timeout)
- net_srv.c: MQTT report_config handler — 查询/设置均返回完整配置JSON
- tcp_json_srv.c: TCP JSON handle_report_config 同步升级,兼容旧 active_report
- iot_mqtt_srv.c: g_report_active → g_report_cfg.enable
- g_report_active 全局变量替换为 g_report_cfg 结构体
This commit is contained in:
wangfq
2026-07-07 18:39:45 +08:00
parent cd92f3e0c3
commit a7de4dfcde
4 changed files with 162 additions and 26 deletions
@@ -31,7 +31,7 @@
*===========================================================================*/
extern uint8_t g_report_active; // from tcp_json_srv.c, 0=inactive 1=active
extern ReportConfig g_report_cfg; // from tcp_json_srv.c
extern uint8_t SocketId_TCP; // from net_srv.c, MQTT socket created by WCHNET_CreateTcpMqttSocket
uint8_t g_iot_socket = 0xFF; // MQTT TCP socket ID
IotMqttState g_iot_state = IOT_STATE_DISCONNECTED;
@@ -372,7 +372,7 @@ static void iot_process_recv(void) {
*===========================================================================*/
void iot_mqtt_publish_sensor(void) {
if (g_iot_state != IOT_STATE_READY) return;
if (!g_report_active) return;
if (!g_report_cfg.enable) return;
/* 复用 g_pkg_uart_2 中的传感器帧 */
if (g_pkg_uart_2.flag == 0) return;