mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-11 12:38:14 +08:00
fix:优化代码
This commit is contained in:
@@ -115,10 +115,8 @@ static void key_short_press( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *json_str = cJSON_Print( json_send );
|
char *json_str = cJSON_Print( json_send );
|
||||||
if ( !user_mqtt_isconnect( ) ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
user_udp_send( json_str );
|
user_send(false,json_str);
|
||||||
else
|
|
||||||
user_mqtt_send( json_str );
|
|
||||||
|
|
||||||
free( (void *) json_str );
|
free( (void *) json_str );
|
||||||
cJSON_Delete( json_send );
|
cJSON_Delete( json_send );
|
||||||
|
|||||||
@@ -180,10 +180,7 @@ void rtc_thread( mico_thread_arg_t arg )
|
|||||||
if ( buf != NULL )
|
if ( buf != NULL )
|
||||||
{
|
{
|
||||||
sprintf( buf, "{\"idx\":%d,\"nvalue\":%d}", user_config->plug[i].idx, user_config->plug[i].on );
|
sprintf( buf, "{\"idx\":%d,\"nvalue\":%d}", user_config->plug[i].idx, user_config->plug[i].on );
|
||||||
if ( !user_mqtt_isconnect( ) )
|
user_send(false,buf);
|
||||||
user_udp_send( buf ); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
else
|
|
||||||
user_mqtt_send( buf );
|
|
||||||
free( buf );
|
free( buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,10 +236,7 @@ void rtc_thread( mico_thread_arg_t arg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *json_str = cJSON_Print( json_send );
|
char *json_str = cJSON_Print( json_send );
|
||||||
if ( !user_mqtt_isconnect( ) )
|
user_send(false,json_str);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
user_udp_send( json_str ); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
else
|
|
||||||
user_mqtt_send( json_str );
|
|
||||||
|
|
||||||
free( json_str );
|
free( json_str );
|
||||||
cJSON_Delete( json_send );
|
cJSON_Delete( json_send );
|
||||||
|
|||||||
Reference in New Issue
Block a user