删除多余步骤,减少等待时间
This commit is contained in:
parent
255ebf0855
commit
b94dd4dd74
18
main.c
18
main.c
@ -1790,22 +1790,6 @@ void *thread_mqtt_recv(void *arg){
|
||||
if(isLightEnable){
|
||||
mqtt_service_reply(stationsn,mqtt_parm.msg_messageId,"ok",1,productid);
|
||||
|
||||
// 先搜索灯带
|
||||
LOG_I("Searching for lights...\n");
|
||||
isLightOn=false;
|
||||
isLightOnByRule=false;
|
||||
isLabelUp=false;
|
||||
searchTimeOut=120; // 设置搜索超时时间为120秒
|
||||
LOG_I("searchTimeOut:%d\n",searchTimeOut);
|
||||
searchTimeOld=getCurrentTime();
|
||||
LOG_I("searchTimeOld:%d\n",searchTimeOld);
|
||||
isSearchLabelOn=true;
|
||||
|
||||
// 等待搜索完成
|
||||
while(isSearchLabelOn && (getCurrentTime() - searchTimeOld) < searchTimeOut) {
|
||||
usleep(100000); // 休眠100ms
|
||||
}
|
||||
|
||||
// 设置规则并广播点亮
|
||||
isSendComEnd=false;
|
||||
isLightOn=true;
|
||||
@ -1824,7 +1808,7 @@ void *thread_mqtt_recv(void *arg){
|
||||
uart_data_send_head_lightonrule(&uartSend, 5);
|
||||
|
||||
// 再次广播,提升可靠性
|
||||
usleep(500000); // 等待500ms
|
||||
usleep(100000); // 等待100ms
|
||||
LOG_I("Sending second broadcast\n");
|
||||
uart_data_send_head_lightonrule(&uartSend, 5);
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user