lib_init 延后调用,调用太早,小板参数设置不成功
author@CHENG <2393524978@qq.com>
Sat, 12 Oct 2024 03:27:08 +0000 (11:27 +0800)
committer@CHENG <2393524978@qq.com>
Sat, 12 Oct 2024 03:27:08 +0000 (11:27 +0800)
1.doc/K18/BLE_Watch/keil/uart.c
2.sdk/sdk/gui/lv_drivers/indev/FR8012HAQ/fr8012haq.c
2.sdk/sdk/gui/lv_watch/lv_watch.c

index 5b64f8a..9798e03 100644 (file)
@@ -343,13 +343,14 @@ void user_parse_data(void)
                        if(1 != is_HA_activate)
                        {
                                unsigned int req_len = 0;
+                               co_printf("[@CHENG_DEBUG][%s][%d]: imei=%s\n", __FUNCTION__, __LINE__, sys_config.IMEI);
                                request_validation((unsigned char *)"ZHSX",4,(unsigned char *)sys_config.IMEI,strlen(sys_config.IMEI),(unsigned char *)sys_config.HA_req_code,&req_len);
                                sys_config.HA_req_code[req_len] = 0;
                                save_sys_config();//保存配置
                        }
                        UART_send_buf_len = snprintf((char *)UART_send_buf,UART_SEND_MAX,"{\"cmd\":\"2\",\"HA_req_code\":\"%s\"}\n",sys_config.HA_req_code);
                        uart0_write_data(UART_send_buf, UART_send_buf_len);
-                       co_printf("HA_req_code:HA_req_code:%s \n",sys_config.HA_req_code);
+                       co_printf("[@CHENG_DEBUG][%s][%d]: HA_req_code=%s\n", __FUNCTION__, __LINE__, sys_config.HA_req_code);
 
                        // unsigned int req_len = 0;
                        // request_validation((unsigned char *)"ZHSX",4,(unsigned char *)sys_config.IMEI,strlen(sys_config.IMEI),(unsigned char *)sys_config.HA_req_code,&req_len);
@@ -363,7 +364,7 @@ void user_parse_data(void)
                {
                        UART_send_buf_len = snprintf((char *)UART_send_buf,UART_SEND_MAX,"{\"cmd\":\"2\",\"HA_key_code\":\"%s\"}\n",sys_config.HA_key_code);
                        uart0_write_data(UART_send_buf, UART_send_buf_len);
-                       co_printf("HA_key_code:HA_key_code:%s \n",sys_config.HA_key_code);
+                       co_printf("[@CHENG_DEBUG][%s][%d]: HA_key_code=%s\n", __FUNCTION__, __LINE__, sys_config.HA_key_code);
                }
                //co_printf("[CHENG]:send_wear_status=%d\r\n", vc9202_alg_results.wear_status);
                // UART_send_buf_len = snprintf((char *)UART_send_buf,UART_SEND_MAX,"{\"cmd\":\"2\",\"wear_data\":\"%d\"}\n",vc9202_alg_results.wear_status);
@@ -389,6 +390,7 @@ void user_parse_data(void)
                                len_tmp = sizeof(sys_config.IMEI)-1;
                        }
                        memcpy(data_tmp,str_tmp,len_tmp);
+                       co_printf("[@CHENG_DEBUG][%s][%d]: %s,%s\n", __FUNCTION__, __LINE__, data_tmp, sys_config.IMEI);
                        if(memcmp(data_tmp,sys_config.IMEI,len_tmp)!=0)
                        {
                                memcpy(sys_config.IMEI,data_tmp,len_tmp);
index 349a0d0..f551234 100644 (file)
@@ -721,6 +721,7 @@ int fr8012haq_parse_returned_data(int timeout)
                     str_tmp = strstr(cmd_str_tmp,"\"HA_req_code\":\"");
                     if(str_tmp)
                     {    
+                                               cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                         //unsigned char hrs = 0;
                         memset(HA_req_code,0,sizeof(HA_req_code));
                         str_tmp += strlen("\"HA_req_code\":\"");
@@ -735,6 +736,7 @@ int fr8012haq_parse_returned_data(int timeout)
                     str_tmp = strstr(cmd_str_tmp,"\"HA_key_code\":\"");
                     if(str_tmp)
                     {
+                                               cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                         memset(HA_key_code,0,sizeof(HA_key_code));
                         str_tmp += strlen("\"HA_key_code\":\"");
                         num_buf_len = find_c(str_tmp,'\"');
@@ -954,6 +956,7 @@ void HA_lib_init(void)
         char imei[16] = {0};
         u_get_imei(imei);
         FR8012HAQ_LOG("HA_lib_init:IMEI:%s\n",imei);
+               cplog_printf("[@CHENG_DEBUG][%s][%d]: imei=%s\n", __FUNCTION__, __LINE__, imei);
         send_data_len = snprintf(send_data,sizeof(send_data),"{\"cmd\":\"3\",\"set_IMEI\":\"%s\"}\n",imei);
         fr8012haq_write_data(send_data,send_data_len);
         fr8012haq_parse_returned_data(500);
@@ -962,6 +965,7 @@ void HA_lib_init(void)
         {
             UOS_SleepMs(30);
             fr8012haq_write_data("{\"cmd\":\"2\",\"get_data\":\"HA_req_code\"}\n",sizeof("{\"cmd\":\"2\",\"get_data\":\"HA_req_code\"}\n"));
+                       cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
             if(fr8012haq_parse_returned_data(500)==2)
                 break;
         }
@@ -974,6 +978,7 @@ void HA_lib_init(void)
         {
             UOS_SleepMs(30);
             fr8012haq_write_data("{\"cmd\":\"2\",\"get_data\":\"HA_key_code\"}\n",sizeof("{\"cmd\":\"2\",\"get_data\":\"HA_key_code\"}\n"));
+                       cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
             if(fr8012haq_parse_returned_data(500)==2)
                 break;
         }
@@ -1032,7 +1037,9 @@ void Fr8012haq_Init(void)
     FR8012HAQ_restart();
     //uart4_debug();
     UOS_SleepMs(5);
-    HA_lib_init();
+
+       ////HA_lib_init();
+       
     fr8012haq_hisr_ref_flag = 0;
 
 }
index 3f94e58..f10a4a4 100644 (file)
@@ -546,6 +546,10 @@ static void simcheck_task(lv_task_t * param)
 
 static lv_obj_t * watch_create(bool silentReset)
 {
+#if USE_FR8012HAQ
+       HA_lib_init();
+#endif
+
     watch_poweron_logo_del();
 
     watch_info = lv_mem_alloc(sizeof(watch_info_t));