add:参数初始化

add:wifi未连接时不尝试连接mqtt服务器
This commit is contained in:
Zip
2019-01-29 12:47:10 +08:00
parent 0154e663ff
commit 96c3cf245b
3 changed files with 87 additions and 8 deletions

View File

@@ -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);