gengxin
authorCCC <2393524978@qq.com>
Mon, 18 Sep 2023 03:18:00 +0000 (11:18 +0800)
committerCCC <2393524978@qq.com>
Mon, 18 Sep 2023 03:18:00 +0000 (11:18 +0800)
2.sdk/project/Z5_K7/product/craneg_modem/config/watch/lv_watch_conf_CUSTOM.h
2.sdk/sdk/gui/lv_watch/lv_apps/calculator/calculator.c
2.sdk/sdk/gui/lv_watch/mmi_default.h
2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c

index c0235f6..13590d8 100644 (file)
 
 #define __MMI_WECHAT_SUPPORT__
 
-#define __MMI_ZHSX_SUPPORT_MAIN_MENU_FOUR_GRID__
+#define __MMI_MAIN_MENU_FOUR_GRID_STYLE__
 
 #define __MMI_HEALTH_MEASURE_HEART_SUPPORT__
 
index b887211..e57f87e 100644 (file)
@@ -130,6 +130,29 @@ static void calc_warn_task(lv_task_t * task)
     ext->warn_task_p = NULL;
 }
 
+#if 0//def __MMI_ZHSX_SUPPORT__
+char * mmi_strtok(char ** str1, uint8_t len1, char * str2, uint8_t len2)
+{
+       char * t_str = NULL;
+       uint8_t t_index = 0;
+       uint8_t i = 0;
+
+       t_str = *str1;
+       for(i = 0; i < len1; i++)
+       {
+               if(strncmp(* str1 + i, str2, len2) == 0)
+               {
+                       * str1 += (i + len2);
+
+                       t_str[i] = '\0';
+                       return t_str;
+               }
+       }
+
+       return NULL;
+}
+#endif
+
 static void calc_add_oper(char * ptr)
 {
     lv_calculator_obj_ext_t * ext = calc_get_ext();
@@ -141,7 +164,7 @@ static void calc_add_oper(char * ptr)
                else
        {
                        printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               #ifdef __MMI_ZHSX_SUPPORT__
+               #if 0//def __MMI_ZHSX_SUPPORT__
                        char * fac1 = NULL;
                        char * fac2 = NULL;
                        char * temp = NULL;
@@ -164,22 +187,53 @@ static void calc_add_oper(char * ptr)
                                if(sn) {
                                        temp = &sn[2];
                                }
+                                               
+                               printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+                       #if 1
                                strtok(temp, ext->oper);
+                               printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
                                fac2 = strtok(NULL, ptr);
+                               printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
                        #if CALC_LATIN_SYMBOL_MUL_AND_DIV_SUP != 0
                                if(strcmp(ext->oper, CALC_MUL) == 0 || strcmp(ext->oper, CALC_DIV) == 0) {
                                        fac2 = &fac2[1];
                                }
                        #endif
                                fac1 = (char *)text;
+                       
+                       #else
+                       
+                               fac1 = mmi_strtok(&temp, strlen(temp), ext->oper, strlen(ext->oper));
+                               printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+                               fac2 = mmi_strtok(&temp, strlen(temp), ptr, strlen(ptr));
+                               printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+                       #endif
+                       
                                printf("[@CHENG_DEBUG][%s][%d]: fac1=%s,fac2=%s\n", __FUNCTION__, __LINE__, fac1, fac2);
                                calc_get_result(fac1, fac2);
 
+
                                ext->oper = ptr;
                                calc_label_add_text(ext, ptr);
                                ext->finish_flag = false;
-                               ext->input_len = 0;
-                               ext->point = false;
+                               text = lv_label_get_text(ext->label);
+                               char * point = strchr(text, '.');
+                               if(point) 
+                               {
+                                       ext->point = true;
+                                       ext->input_len = strlen(point) - 1;
+
+                                       printf("[@CHENG_DEBUG][%s][%d]: input_len=%d\n", __FUNCTION__, __LINE__, ext->input_len);
+                               } 
+                               else 
+                               {
+                                       ext->point = false;
+                                       ext->input_len = strlen(text);
+                                       if(text[0] == '-') {
+                                               ext->input_len--;
+                                       }
+                                       printf("[@CHENG_DEBUG][%s][%d]: input_len=%d\n", __FUNCTION__, __LINE__, ext->input_len);
+                               }
                        }
                #endif
                        
@@ -840,6 +894,9 @@ static void calc_get_result(char * fac1, char * fac2)
     fval1 = atof(fac1);
     fval2 = atof(fac2);
 
+       printf("[@CHENG_DEBUG][%s][%d]: fval1=%f,fval2=%f\n", __FUNCTION__, __LINE__, fval1, fval2);
+
+
     if(strcmp(ext->oper, CALC_PLUS) == 0) {
         resval = fval1 + fval2;
     } else if(strcmp(ext->oper, CALC_MINUS) == 0) {
index d769809..e9eeb7c 100644 (file)
@@ -202,6 +202,12 @@ extern "C"
 #endif
 
 
+//main menu style
+#ifdef MMI_CUSTOMER_MAIN_MENU_STYLE
+#define MMI_MAIN_MENU_STYLE_DEFAULT            MMI_CUSTOMER_MAIN_MENU_STYLE
+#else
+#define MMI_MAIN_MENU_STYLE_DEFAULT            (MMI_MAIN_MENU_STYLE_FOUR_GRID)
+#endif
 
 
 
index 5489655..fc96c85 100644 (file)
@@ -36,6 +36,8 @@ typedef void (*FUNC_CB)(int);
 #define MMI_WATCH_LOCATION_PROCESS_DURATION            (1000 * 10) // ms
 #define MMI_WATCH_LOCATION_CHECK_TIMES_COUNT_MAX               (4) // 40000 ms
 
+#define MMI_WATCH_LOCATION_UPLOAD_INTERVAL_MIN         (2 * 60) // s
+
 
 typedef enum
 {
index 7e2c352..e139e23 100644 (file)
@@ -186,7 +186,7 @@ uint32_t mmi_protocol_watch_location_upload_interval_get(void)
 
 void mmi_protocol_watch_location_upload_interval_set(uint32_t value)
 {
-       s_watch_protocol_data.location_upload_interval = ((300 > value) ? 300 : value); // value;
+       s_watch_protocol_data.location_upload_interval = ((MMI_WATCH_LOCATION_UPLOAD_INTERVAL_MIN > value) ? MMI_WATCH_LOCATION_UPLOAD_INTERVAL_MIN : value); // value;
        mmi_watch_protocol_data_nv_write();
 }