gengxin
author@CHENG <2393524978@qq.com>
Mon, 13 May 2024 12:10:50 +0000 (20:10 +0800)
committer@CHENG <2393524978@qq.com>
Mon, 13 May 2024 12:10:50 +0000 (20:10 +0800)
2.sdk/sdk/gui/lv_watch/include/app_adaptor_interface.h
2.sdk/sdk/gui/lv_watch/lv_apps/dial/dial.h
2.sdk/sdk/gui/lv_watch/lv_apps/dial/dial_element.c
2.sdk/sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_test.c

index 41296aa..435781a 100644 (file)
@@ -95,7 +95,7 @@ typedef struct
 {
     hal_rtc_t date;
     uint32_t step;
-    uint16_t kcal;
+    float kcal; // uint16_t kcal;
     float    km;
 } app_adaptor_pedometer_record_t;
 
index 112e689..2771ad7 100644 (file)
@@ -72,6 +72,8 @@ enum {
     ELEMENT_TYPE_HEART_RATE,        //13
     ELEMENT_TYPE_BLOOD_OXYGEN,      //14
        ELEMENT_TYPE_USER,
+       ELEMENT_TYPE_SIGNAL,                    //16
+       
     ELEMENT_TYPE_BG_SWITCH,         //15  /*except when updating all elements, always at the last*/
     ELEMENT_TYPE_MAX
 };
@@ -203,6 +205,8 @@ enum {
     LABEL_TYPE_HEART_RATE_BPM,      //25
     LABEL_TYPE_BLOOD_OXYGEN,        //26
     LABEL_TYPE_LUNAR ,       //27
+       LABEL_TYPE_SIGNAL_NUMBER_PERCENT, // 28
+       LABEL_TYPE_BATTERY_NUMBER_PERCENT, // 29
 
 };
 typedef uint8_t watch_label_type_t;
index 5694748..959d2c2 100644 (file)
@@ -507,7 +507,7 @@ static void dial_update_canvas_label(watch_element_base_t * base)
     uint8_t len = 64;
     char infotxt[len];
     app_adaptor_weather_t weather;
-    app_adaptor_pedometer_record_t record;
+    app_adaptor_pedometer_record_t record = {0};
     //app_adaptor_health_info_t health;
        nv_watch_health_info_t health_info = {0};
     lv_point_t pos;
@@ -611,7 +611,7 @@ static void dial_update_canvas_label(watch_element_base_t * base)
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
             case LABEL_TYPE_CALORIE:
-                snprintf(infotxt, len, "%d", record.kcal);
+                snprintf(infotxt, len, "%.1f", record.kcal);
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
             case LABEL_TYPE_HEART_RATE:
@@ -651,6 +651,22 @@ static void dial_update_canvas_label(watch_element_base_t * base)
                 //sprintf(infotxt, "%-3d-%-3d", health_info.blood_low_value, health_info.blood_high_value);
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
+
+                       case LABEL_TYPE_SIGNAL_NUMBER_PERCENT:
+                               uint32_t signal_value = 0;
+                               if(true == watch_modem_sim_present_check_req())
+                               {
+                                       signal_value = watch_modem_get_signal_bar_req() * 20;
+                               }
+                snprintf(infotxt, len, "%d%%", signal_value);
+                dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
+                               break;
+
+                       case LABEL_TYPE_BATTERY_NUMBER_PERCENT:
+                snprintf(infotxt, len, "%d%%", Hal_Battery_Get_Status());
+                dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
+                               break;
+                               
             default:
                 break;
         }
@@ -895,22 +911,22 @@ static void dial_update_canvas_img(watch_element_base_t * base)
                 break;
             }
             case IMG_TYPE_CALORIE_HUNDRED:
-                sub_img = dial_get_sub_img(img_dsc, record.kcal / 100);
+                sub_img = dial_get_sub_img(img_dsc, ((uint32_t)record.kcal) / 100);
                 if(sub_img)
                     dial_update_canvas(sub_img, 0, pos.x + img_dsc->img_pos.x, pos.y + img_dsc->img_pos.y);
                 break;
             case IMG_TYPE_CALORIE_TENS:
-                sub_img = dial_get_sub_img(img_dsc, (record.kcal % 100) / 10);
+                sub_img = dial_get_sub_img(img_dsc, (((uint32_t)record.kcal) % 100) / 10);
                 if(sub_img)
                     dial_update_canvas(sub_img, 0, pos.x + img_dsc->img_pos.x, pos.y + img_dsc->img_pos.y);
                 break;
             case IMG_TYPE_CALORIE_UNIT:
-                sub_img = dial_get_sub_img(img_dsc, record.kcal % 10);
+                sub_img = dial_get_sub_img(img_dsc, ((uint32_t)record.kcal) % 10);
                 if(sub_img)
                     dial_update_canvas(sub_img, 0, pos.x + img_dsc->img_pos.x, pos.y + img_dsc->img_pos.y);
                 break;
             case IMG_TYPE_CALORIE_PROGRESS:
-                sub_img = dial_get_sub_img(img_dsc, ((record.kcal * 100 / 1000) / (100 / img_dsc->subimg->sub_img_cnt)));
+                sub_img = dial_get_sub_img(img_dsc, ((((uint32_t)record.kcal) * 100 / 1000) / (100 / img_dsc->subimg->sub_img_cnt)));
                 if(sub_img)
                     dial_update_canvas(sub_img, 0, pos.x + img_dsc->img_pos.x, pos.y + img_dsc->img_pos.y);
                 break;
index 63c6dec..11edc1f 100644 (file)
@@ -1707,7 +1707,7 @@ static void mmi_factorymode_temperature_update(lv_anim_t * anim)
        float body_temp_value = 0.0;
 
     mmi_tsensor_body_value_get(&body_temp_value);
-    sprintf(str, "%s:\n    %.2f %s", (char *)lv_lang_get_text(WATCH_TEXT_ID_TEMPERATURE), 
+    sprintf(str, "%s:\n    %.1f %s", (char *)lv_lang_get_text(WATCH_TEXT_ID_TEMPERATURE), 
                                                                        body_temp_value,
                                                                        (char *)lv_lang_get_text(WATCH_TEXT_ID_TEMPERATURE_UNIT));
     lv_label_set_text(anim->var,str);