refactor(vd960DBN): replace compile-time NET_SSC/NET_JSON/NET_IOT macros with runtime g_sub_code_enable.iot_enable

- Remove NET_SSC_ENABLE, NET_JSON_ENABLE, NET_IOT_ENABLE from net_config.h
- Socket config always allocates max: 1 UDP + 2 TCP + 1 TCP_LISTEN
- All #if guards in net_srv.c/h and peripheral_main.c replaced with
  runtime g_sub_code_enable.iot_enable checks
- iot_enable=0 -> SSC mode (UDP + TCP client + JSON server)
- iot_enable=1 -> IoT MQTT mode (MQTT client via iot_mqtt_srv)
This commit is contained in:
wangfq
2026-07-03 18:07:32 +08:00
parent 9629729dc9
commit 5333fe40de
5 changed files with 35 additions and 101 deletions
@@ -24,9 +24,7 @@
#include "storage.h"
#include "tcp_json_srv.h"
#include "loop_uart_proto.h"
#if NET_IOT_ENABLE
#include "iot_mqtt_srv.h"
#endif
/*********************************************************************
* GLOBAL TYPEDEFS
@@ -239,7 +237,6 @@ void Main_Circulation(void)
}
if(g_net_state.flag == 2)
{
#if NET_SSC_ENABLE
if(g_sub_code_enable.iot_enable){
if(iot_net_info.mode == IOT_Addr_IP_Mode){
if(get_ipstr_to_array(iot_net_info.remote_addr, RemoteIP) == 0){
@@ -255,7 +252,6 @@ void Main_Circulation(void)
{
WCHNET_CreateTcpSocket();
}
#endif
}
@@ -273,13 +269,13 @@ void Main_Circulation(void)
poll_dbn_ble();
#if NET_IOT_ENABLE
iot_mqtt_publish_sensor(); // Push 0xC0 sensor data to MQTT broker
iot_mqtt_poll(); // IoT MQTT state machine + heartbeat
#else
tcp_json_push_sensor(); // Push 0xC0 sensor data to TCP JSON client
tcp_json_poll();
#endif
if (g_sub_code_enable.iot_enable) {
iot_mqtt_publish_sensor(); // Push 0xC0 sensor data to MQTT broker
iot_mqtt_poll(); // IoT MQTT state machine + heartbeat
} else {
tcp_json_push_sensor(); // Push 0xC0 sensor data to TCP JSON client
tcp_json_poll();
}
key_event_srv();
}