mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 13:08:13 +08:00
add:参数初始化
add:wifi未连接时不尝试连接mqtt服务器
This commit is contained in:
@@ -240,8 +240,16 @@ MQTT_start:
|
||||
#else
|
||||
ssl_settings.ssl_enable = false;
|
||||
#endif
|
||||
|
||||
LinkStatusTypeDef LinkStatus;
|
||||
while( 1 ){
|
||||
|
||||
micoWlanGetLinkStatus(&LinkStatus);
|
||||
if(LinkStatus.is_connected!=1){
|
||||
mqtt_log("ERROR:WIFI not connection , waiting 3s for connecting and then connecting MQTT ", rc);
|
||||
mico_rtos_thread_sleep( 3 );
|
||||
continue;
|
||||
}
|
||||
|
||||
rc = NewNetwork( &n, MQTT_SERVER, MQTT_SERVER_PORT, ssl_settings );
|
||||
if( rc == MQTT_SUCCESS ) break;
|
||||
mqtt_log("ERROR: MQTT network connection err=%d, reconnect after 3s...", rc);
|
||||
|
||||
Reference in New Issue
Block a user