diff --git a/main.c b/main.c index 677f7ea..71e2be6 100644 --- a/main.c +++ b/main.c @@ -59,7 +59,7 @@ int fd; int UPCASE=0; int count_value=0; int getPayloadTime=120*1000;//usecond -char softwareVersion[16]="1.1.20"; +char softwareVersion[16]="1.1.22"; char stationsn[16]="TJ251372224247";//TJ250995217957 char productid[8]="10045"; char appKey[32]="fdhQmhqhvbL1cf1K9mUqt"; @@ -1912,7 +1912,7 @@ void *thread_mqtt_recv(void *arg){ system("mv /userdata/tx_ota /userdata/ota"); system("mv /userdata/ota/ustart.sh /userdata"); system("sync"); - sleep(1); + sleep(15); system("reboot"); }else if(strcmp(mqtt_parm.msg_type,"5003")==0){ LOG_I("5003 need report station info\n"); @@ -2047,7 +2047,7 @@ void *thread_mqtt_recv(void *arg){ if(strcmp(msg_labelconfig_value,"")!=0){ mqtt_service_reply(stationsn,mqtt_parm.msg_messageId,"ok",1,productid); isSendComEnd=false; - isLightOn=false; + isLightOn=false; isLightOnByRule=true; isLabelUp=false; //isSearchLabel=false; @@ -2539,7 +2539,7 @@ int main(int argc, char *argv[]) { // 先检查标准输入是否可用 if (feof(stdin) || ferror(stdin)) { - LOG_I("stdin error or EOF, sleeping for 1 second\n"); + //LOG_I("stdin error or EOF, sleeping for 1 second\n"); sleep(1); continue; } @@ -2592,17 +2592,21 @@ void *thread_timeout_check(void *arg) { // 合并点亮线程 void *thread_3015_lighton_merge(void *arg) { - while (1) { + int total_all = 0; + + while (1) { pthread_mutex_lock(&lightsn_buffer_mutex); if (is_3015_collecting) { time_t now = time(NULL); if ((now - first_3015_time >= 3) || (lightsn_buffer_count >= MAX_LIGHTSN_BUFFER)) { int total = lightsn_buffer_count; - int batch_size = 10; + total_all += total; + int batch_size = 10; int sent = 0; while (sent < total) { int this_batch = (total - sent > batch_size) ? batch_size : (total - sent); - if (isLightEnable && this_batch > 0) { + LOG_I("-------total:%d, sent:%d, this batch: %d------\n", total, sent, this_batch); + if (isLightEnable && this_batch > 0) { isLightOn = true; isLightOnByRule = false; isLabelUp = false; @@ -2673,11 +2677,12 @@ void *thread_3015_lighton_merge(void *arg) { } sent += this_batch; if (sent < total) { - pthread_mutex_unlock(&lightsn_buffer_mutex); // 释放锁等待 sleep(3); - pthread_mutex_lock(&lightsn_buffer_mutex); // 重新加锁 } + + LOG_I("total_all: %d\n", total_all); } + // 不要立即清空buffer,等待isLightOn处理完成 is_3015_collecting = false; first_3015_time = 0;