From 64a10c83d070f4f329f81b6e6877539c6881641d Mon Sep 17 00:00:00 2001 From: zzh Date: Sat, 21 Jun 2025 09:51:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B71.1.15=202.=20=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84reboot=203.=20=E4=BF=AE=E6=94=B9ota=E9=80=BB?= =?UTF-8?q?=E8=BE=91=204.=20ota=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=87=E5=BF=97=E4=BD=8D=E9=98=B2=E6=AD=A2=E5=A4=9A=E6=AC=A1?= =?UTF-8?q?=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index 2431f4a..5eb26ef 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.13"; +char softwareVersion[16]="1.1.15"; char stationsn[16]="TJ251372224247";//TJ250995217957 char productid[8]="10045"; char appKey[32]="fdhQmhqhvbL1cf1K9mUqt"; @@ -695,7 +695,6 @@ int readQrcode() ret = pthread_create(&pt_handleqrcode,NULL,actHandleQrcode,input_value_copy); if(ret!=0){ LOG_I("pthread_create handleqrcode fail\n"); - system("reboot"); }else{ pthread_detach(pt_handleqrcode); } @@ -1802,8 +1801,7 @@ void *thread_mqtt_recv(void *arg){ system("reboot"); }else if(strcmp(mqtt_parm.msg_type,"1014")==0){ LOG_I("1014 update fw\n"); - system("rm -fr ota"); - system("mkdir ota"); + isSendComEnd=false; get_int_from_json_string_by_key(msg_data, "needWifi", &mqtt_parm.msg_needWifi); LOG_I("needWifi:%d\n",mqtt_parm.msg_needWifi); get_string_from_json_string_by_key_unescape(msg_data, "zipPath", mqtt_parm.msg_zipPath, sizeof(mqtt_parm.msg_zipPath)); @@ -1818,14 +1816,15 @@ void *thread_mqtt_recv(void *arg){ LOG_I("version:%s\n",mqtt_parm.msg_version); mqtt_service_reply(stationsn,mqtt_parm.msg_messageId,"ok",1,productid); char otaCmd[256]={0}; - sprintf(otaCmd,"curl -o /root/ota/tx_ota.zip %s",mqtt_parm.msg_zipPath); + sprintf(otaCmd,"curl -o /userdata/tx_ota.zip %s",mqtt_parm.msg_zipPath); //sprintf(otaCmd,"curl -o /root/tx_server https://fscdn.zto.com/cloudm/iot-device-package/7d609af2165b4d14ae318f17659b2fbf.bin"); system(otaCmd); sleep(15); - system("unzip ota/tx_ota.zip"); - system("mv tx_ota/* ota"); - system("rm -fr tx_ota"); - system("mv ota/start.sh /root"); + system("unzip /userdata/tx_ota.zip"); + //system("mv ../tx_ota/* /userdata/ota"); + //system("rm -fr /userdata/ota/tx_ota"); + system("mv /userdata/tx_ota /userdata/ota"); + system("mv /userdata/ota/ustart.sh /userdata"); system("sync"); sleep(1); system("reboot"); @@ -2227,25 +2226,25 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_watchdog,NULL,thread_feed_watchdog,NULL); if(ret!=0){ LOG_I("pthread_create watchdog fail\n"); - system("reboot"); }else{ LOG_I("pthread_create watchdog success\n"); pthread_detach(pt_watchdog); } #endif + +#if 0 ret = pthread_create(&pt_reboot,NULL,thread_reboot,NULL); if(ret!=0){ LOG_I("pthread_create reboot fail\n"); - system("reboot"); }else{ LOG_I("pthread_create reboot success\n"); pthread_detach(pt_reboot); } +#endif ret = pthread_create(&pt_uart_recv_ack,NULL,thread_uart_recv_ack,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_ack fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_ack); LOG_I("pthread_create uart_recv_ack success\n"); @@ -2254,7 +2253,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_uart_recv_data,NULL,thread_uart_recv_data,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_data fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_data); LOG_I("pthread_create uart_recv_data success\n"); @@ -2263,7 +2261,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_uart_recv_back,NULL,thread_uart_recv_back,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_back fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_back); LOG_I("pthread_create uart_recv_back success\n"); @@ -2272,7 +2269,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_mqtt_recv,NULL,thread_mqtt_recv,NULL); if(ret!=0){ LOG_I("pthread_create mqtt_recv fail\n"); - system("reboot"); }else{ pthread_detach(pt_mqtt_recv); LOG_I("pthread_create mqtt_recv success\n"); @@ -2281,7 +2277,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_tagsearch,NULL,thread_tag_search_send,NULL); if(ret!=0){ LOG_I("pthread_create tag search send fail\n"); - system("reboot"); }else{ LOG_I("pthread_create tag search success\n"); pthread_detach(pt_tagsearch); @@ -2290,7 +2285,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_removeduplicatetag,NULL,thread_remove_duplicate_tag,NULL); if(ret!=0){ LOG_I("pthread_create remove duplicate tag send fail\n"); - system("reboot"); }else{ LOG_I("pthread_create remove duplicate tag success\n"); pthread_detach(pt_removeduplicatetag); @@ -2311,7 +2305,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&timeout_thread, NULL, thread_timeout_check, NULL); if(ret!=0){ LOG_I("pthread_create timeout_check fail\n"); - system("reboot"); }else{ LOG_I("pthread_create timeout_check success\n"); pthread_detach(timeout_thread); @@ -2320,7 +2313,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_ota,NULL,thread_ota,NULL); if(ret!=0){ LOG_I("pthread_create ota fail\n"); - system("reboot"); }else{ LOG_I("pthread_create ota success\n"); pthread_detach(pt_ota); @@ -2329,7 +2321,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_doota,NULL,thread_do_ota,NULL); if(ret!=0){ LOG_I("pthread_create doota fail\n"); - system("reboot"); }else{ LOG_I("pthread_create doota success\n"); pthread_detach(pt_doota); @@ -2392,7 +2383,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_mqtt,NULL,thread_mqtt,NULL); if(ret!=0){ LOG_I("pthread_create mqtt fail\n"); - system("reboot"); }else{ pthread_detach(pt_mqtt); LOG_I("pthread_create mqtt success\n");