gengxin
authorCCC <2393524978@qq.com>
Wed, 20 Dec 2023 09:45:06 +0000 (17:45 +0800)
committerCCC <2393524978@qq.com>
Wed, 20 Dec 2023 09:45:06 +0000 (17:45 +0800)
2.sdk/sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c
2.sdk/sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.h
2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h
2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c
2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h

index 2e47af8..7beb733 100644 (file)
@@ -126,6 +126,19 @@ void mmi_pedometer_steps_mission(hal_rtc_t cur_time)
 }
 
 
+uint32_t mmi_sleep_roll_number_get(void)
+{
+       uint32_t roll_num = 0;
+
+#ifdef MMI_PROJECT_Z5_DS_Z12_COMMON
+       srand(Hal_Timer_Get_Counter());
+       roll_num = 1 + rand() % 25;
+#endif
+
+       return roll_num;
+}
+
+
 // heart sensor
 unsigned char mmi_hsensor_measure_get_wear_status(void)
 {
index 0e4ddcc..1dac209 100644 (file)
@@ -84,6 +84,8 @@ void asl_pedometer_steps_clear(void);
 uint8_t mmi_gsensor_sensor_id_get(void);
 
 
+uint32_t mmi_sleep_roll_number_get(void);
+
 
 /*hr_bp_bo*/
 void mmi_hsensor_measure_value_clear(void);
index df3a006..d69b960 100644 (file)
@@ -62,7 +62,25 @@ extern "C" {
 #endif
 #define NV_SECTION_UI_Not_Clear_DATA_LEN               (sizeof(nv_watch_not_clean_data_t))
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
-#define NV_SECTION_UI_REMIND_WAKE_UP_DATA_LEN          (sizeof(nv_watch_remind_wake_up_t))
+#define NV_SECTION_UI_REMIND_WAKE_UP_DATA_LEN          (sizeof(nv_watch_remind_item_t))
+#endif
+#ifdef __MMI_REMIND_SLEEP_SUPPORT__
+#define NV_SECTION_UI_REMIND_SLEEP_DATA_LEN            (sizeof(nv_watch_remind_item_t))
+#endif
+#ifdef __MMI_REMIND_REST_SUPPORT__
+#define NV_SECTION_UI_REMIND_REST_DATA_LEN             (sizeof(nv_watch_remind_rest_t))
+#endif
+#ifdef __MMI_REMIND_HOME_SUPPORT__
+#define NV_SECTION_UI_REMIND_HOME_DATA_LEN             (sizeof(nv_watch_remind_home_t))
+#endif
+#ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+#define NV_SECTION_UI_REMIND_MEDICINE_DATA_LEN         (sizeof(nv_watch_remind_medicine_t))
+#endif
+#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+#define NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA_LEN          (sizeof(nv_watch_remind_custom_medicine_t))
+#endif
+#ifdef __MMI_REMIND_DRINK_SUPPORT__
+#define NV_SECTION_UI_REMIND_DRINK_DATA_LEN            (sizeof(nv_watch_remind_drink_t))
 #endif
 #ifdef __MMI_CUSTOM_HENG_AI__
 #define NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE_LEN       (sizeof(nv_watch_switch_t))
@@ -178,6 +196,24 @@ typedef lv_fs_dir_t  ui_dir_t;
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
 #define NV_SECTION_UI_REMIND_WAKE_UP_DATA_FILE         "ui_remind_wake_up_data.nv"
 #endif
+#ifdef __MMI_REMIND_SLEEP_SUPPORT__
+#define NV_SECTION_UI_REMIND_SLEEP_DATA_FILE           "ui_remind_sleep_data.nv"
+#endif
+#ifdef __MMI_REMIND_REST_SUPPORT__
+#define NV_SECTION_UI_REMIND_REST_DATA_FILE            "ui_remind_rest_data.nv"
+#endif
+#ifdef __MMI_REMIND_HOME_SUPPORT__
+#define NV_SECTION_UI_REMIND_HOME_DATA_FILE            "ui_remind_home_data.nv"
+#endif
+#ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+#define NV_SECTION_UI_REMIND_MEDICINE_DATA_FILE                "ui_remind_medicine_data.nv"
+#endif
+#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+#define NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA_FILE         "ui_remind_custom_medicine_data.nv"
+#endif
+#ifdef __MMI_REMIND_DRINK_SUPPORT__
+#define NV_SECTION_UI_REMIND_DRINK_DATA_FILE           "ui_remind_drink_data.nv"
+#endif
 #ifdef __MMI_CUSTOM_HENG_AI__
 #define NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE_FILE      "ui_heng_ai_wake_ring_type.nv"
 #define NV_SECTION_UI_HENG_AI_SLEEP_ACTIVATION_FILE    "ui_heng_ai_sleep_activation.nv"
index 4d1859a..79053d0 100644 (file)
@@ -116,6 +116,30 @@ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId)
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
                        return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_WAKE_UP_DATA));
        #endif
+       #ifdef __MMI_REMIND_SLEEP_SUPPORT__
+               case NV_SECTION_UI_REMIND_SLEEP_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_SLEEP_DATA));
+       #endif
+       #ifdef __MMI_REMIND_REST_SUPPORT__
+               case NV_SECTION_UI_REMIND_REST_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_REST_DATA));
+       #endif
+       #ifdef __MMI_REMIND_HOME_SUPPORT__
+               case NV_SECTION_UI_REMIND_HOME_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_HOME_DATA));
+       #endif
+       #ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_MEDICINE_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_MEDICINE_DATA));
+       #endif
+       #ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA));
+       #endif
+       #ifdef __MMI_REMIND_DRINK_SUPPORT__
+               case NV_SECTION_UI_REMIND_DRINK_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_DRINK_DATA));
+       #endif
        #ifdef __MMI_CUSTOM_HENG_AI__
                case NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE:
                        return (NV_SECTION_LEN(NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE));
@@ -239,6 +263,30 @@ char * UI_NV_Get_Section_path(NV_UI_SECTION_ID SectionId)
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
                        return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_WAKE_UP_DATA));
        #endif
+       #ifdef __MMI_REMIND_SLEEP_SUPPORT__
+               case NV_SECTION_UI_REMIND_SLEEP_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_SLEEP_DATA));
+       #endif
+       #ifdef __MMI_REMIND_REST_SUPPORT__
+               case NV_SECTION_UI_REMIND_REST_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_REST_DATA));
+       #endif
+       #ifdef __MMI_REMIND_HOME_SUPPORT__
+               case NV_SECTION_UI_REMIND_HOME_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_HOME_DATA));
+       #endif
+       #ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_MEDICINE_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_MEDICINE_DATA));
+       #endif
+       #ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA));
+       #endif
+       #ifdef __MMI_REMIND_DRINK_SUPPORT__
+               case NV_SECTION_UI_REMIND_DRINK_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_DRINK_DATA));
+       #endif
        #ifdef __MMI_CUSTOM_HENG_AI__
                case NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE:
                        return (NV_SECTION_FILE_PATH(NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE));
@@ -312,8 +360,23 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
        nv_watch_sim_iccid_t * sim_iccid_data;
 #endif
        nv_watch_not_clean_data_t * not_clean_data;
-#ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
-       nv_watch_remind_wake_up_t * remind_wake_up_data;
+#if defined(__MMI_REMIND_WAKE_UP_SUPPORT__) || defined(__MMI_REMIND_SLEEP_SUPPORT__)
+       nv_watch_remind_item_t * remind_item_data;
+#endif
+#ifdef __MMI_REMIND_REST_SUPPORT__
+       nv_watch_remind_rest_t * remind_rest_data;
+#endif
+#ifdef __MMI_REMIND_HOME_SUPPORT__
+       nv_watch_remind_home_t * remind_home_data;
+#endif
+#ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+       nv_watch_remind_medicine_t * remind_medicine_data;
+#endif
+#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+       nv_watch_remind_custom_medicine_t * remind_custom_medicine_data;
+#endif
+#ifdef __MMI_REMIND_DRINK_SUPPORT__
+       nv_watch_remind_drink_t * remind_drink_data;
 #endif
 #ifdef __MMI_CUSTOM_HENG_AI__
        nv_watch_heng_ai_sleep_activation_t * heng_ai_sleep_activation;
@@ -575,11 +638,53 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
 
        #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
-                       remind_wake_up_data = lv_mem_alloc(SectionLen);
-                       memset(remind_wake_up_data, 0x0, SectionLen);
-                       TempData = (char *)remind_wake_up_data;
+                       remind_item_data = lv_mem_alloc(SectionLen);
+                       memset(remind_item_data, 0x0, SectionLen);
+                       TempData = (char *)remind_item_data;
                        break;                  
        #endif
+       #ifdef __MMI_REMIND_SLEEP_SUPPORT__
+               case NV_SECTION_UI_REMIND_SLEEP_DATA:
+                       remind_item_data = lv_mem_alloc(SectionLen);
+                       memset(remind_item_data, 0x0, SectionLen);
+                       TempData = (char *)remind_item_data;
+                       break;
+       #endif
+       #ifdef __MMI_REMIND_REST_SUPPORT__
+               case NV_SECTION_UI_REMIND_REST_DATA:
+                       remind_rest_data = lv_mem_alloc(SectionLen);
+                       memset(remind_rest_data, 0x0, SectionLen);
+                       TempData = (char *)remind_rest_data;
+                       break;
+       #endif
+       #ifdef __MMI_REMIND_HOME_SUPPORT__
+               case NV_SECTION_UI_REMIND_HOME_DATA:
+                       remind_home_data = lv_mem_alloc(SectionLen);
+                       memset(remind_home_data, 0x0, SectionLen);
+                       TempData = (char *)remind_home_data;
+                       break;
+       #endif
+       #ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_MEDICINE_DATA:
+                       remind_medicine_data = lv_mem_alloc(SectionLen);
+                       memset(remind_medicine_data, 0x0, SectionLen);
+                       TempData = (char *)remind_medicine_data;
+                       break;
+       #endif
+       #ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+               case NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA:
+                       remind_custom_medicine_data = lv_mem_alloc(SectionLen);
+                       memset(remind_custom_medicine_data, 0x0, SectionLen);
+                       TempData = (char *)remind_custom_medicine_data;
+                       break;
+       #endif
+       #ifdef __MMI_REMIND_DRINK_SUPPORT__
+               case NV_SECTION_UI_REMIND_DRINK_DATA:
+                       remind_drink_data = lv_mem_alloc(SectionLen);
+                       memset(remind_drink_data, 0x0, SectionLen);
+                       TempData = (char *)remind_drink_data;
+                       break;
+       #endif
        
        #ifdef __MMI_CUSTOM_HENG_AI__
                case NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE:
index 90b459f..eb024d2 100644 (file)
@@ -138,14 +138,6 @@ typedef struct
     nv_watch_alarm_info_t alarm_info[NV_ALARM_MAX_ALARM_NUM];
 } __packed nv_watch_alarm_t;
 
-#ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
-#define NV_REMIND_WAKE_UP_MAX_NUM    (3)
-typedef struct
-{
-    nv_watch_alarm_info_t remind_info[NV_REMIND_WAKE_UP_MAX_NUM];
-} __packed nv_watch_remind_wake_up_t;
-#endif
-
 
 typedef struct
 {
@@ -308,6 +300,9 @@ typedef struct
        //uint8_t power_on_off_volume;
        uint8_t white_list_switch;
        uint8_t dial_pad_switch;
+       uint8_t low_battery_switch;
+       uint8_t fall_down_switch;
+       uint8_t take_off_switch;
 #ifdef __MMI_PAGE_MAIN_MENU_TTS_SUPPORT__
        uint8_t page_main_menu_tts;
 #endif
@@ -331,6 +326,96 @@ typedef struct
 } __packed nv_watch_sim_iccid_t;
 #endif
 
+#if defined(__MMI_REMIND_WAKE_UP_SUPPORT__) || defined(__MMI_REMIND_SLEEP_SUPPORT__)
+#define NV_REMIND_ITEM_MAX_NUM    (3)
+
+typedef struct
+{
+    uint8_t is_valid;                                                // 1: valid, 0: invalid
+    uint8_t hour;                                                 // [0, 23]
+    uint8_t min;                                                  // [0, 59]
+    uint8_t repeat_bitmap;                                        /* Bit 7: 0 means alarm once, 1 means repeat alarm */
+                                                                                                                                       /* Bit 0 ~ 6 are valid if bit 7 is 1 */
+                                                                                                                                       /* Bit 0: Sunday, bit 1: Monday ... bit 6: Saturday */
+} __packed nv_watch_remind_item_info_t;
+
+typedef struct
+{
+    nv_watch_remind_item_info_t remind_info[NV_REMIND_ITEM_MAX_NUM];
+} __packed nv_watch_remind_item_t;
+#endif
+
+#ifdef __MMI_REMIND_REST_SUPPORT__
+#define NV_REMIND_REST_MAX_NUM    (2)
+
+typedef struct
+{
+    uint8_t hour_begin;                                                 // [0, 23]
+    uint8_t min_begin;                                                  // [0, 59]
+    uint8_t hour_end;                                                 // [0, 23]
+    uint8_t min_end;                                                  // [0, 59]
+} __packed nv_watch_remind_rest_info_t;
+
+typedef struct
+{
+    uint8_t is_valid;                                             // 1: valid, 0: invalid
+       nv_watch_remind_rest_info_t remind_info[NV_REMIND_REST_MAX_NUM];
+} __packed nv_watch_remind_rest_t;
+#endif
+
+#ifdef __MMI_REMIND_HOME_SUPPORT__
+typedef struct
+{
+    uint8_t is_valid;                                             // 1: valid, 0: invalid
+    uint8_t hour;                                                 // [0, 23]
+    uint8_t min;                                                  // [0, 59]
+} __packed nv_watch_remind_home_t;
+#endif
+
+#ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+#define NV_REMIND_MEDICINE_MAX_NUM    (3)
+
+typedef struct
+{
+    uint8_t is_valid;                                             // 1: valid, 0: invalid
+    uint8_t hour;                                                 // [0, 23]
+    uint8_t min;                                                  // [0, 59]
+} __packed nv_watch_remind_medicine_info_t;
+
+typedef struct
+{
+       nv_watch_remind_medicine_info_t remind_info[NV_REMIND_MEDICINE_MAX_NUM];
+} __packed nv_watch_remind_medicine_t;
+#endif
+
+#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+#define NV_REMIND_CUSTOM_MEDICINE_MAX_NUM    (3)
+
+typedef struct
+{
+    uint8_t is_valid;                                             // 1: valid, 0: invalid
+    uint8_t hour;                                                 // [0, 23]
+    uint8_t min;                                                  // [0, 59]
+} __packed nv_watch_remind_custom_medicine_info_t;
+
+typedef struct
+{
+       nv_watch_remind_custom_medicine_info_t remind_info[NV_REMIND_CUSTOM_MEDICINE_MAX_NUM];
+    uint8_t repeat_bitmap;                                        /* Bit 7: 0 means alarm once, 1 means repeat alarm */
+                                                                                                                                   /* Bit 0 ~ 6 are valid if bit 7 is 1 */
+                                                                                                                                   /* Bit 0: Sunday, bit 1: Monday ... bit 6: Saturday */
+} __packed nv_watch_remind_custom_medicine_t;
+#endif
+
+#ifdef __MMI_REMIND_DRINK_SUPPORT__
+typedef struct
+{
+    uint8_t is_valid;                                             // 1: valid, 0: invalid
+    uint8_t hour_value;
+} __packed nv_watch_remind_drink_t;
+#endif
+
+
 typedef struct
 {
     uint32_t hx3918_data[4];                 // ::string
@@ -553,7 +638,25 @@ enum
 #endif
        NV_SECTION_UI_Not_Clear_DATA,                           // nv_watch_not_clean_data_t
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
-       NV_SECTION_UI_REMIND_WAKE_UP_DATA,                              // nv_watch_remind_wake_up_t
+       NV_SECTION_UI_REMIND_WAKE_UP_DATA,                              // nv_watch_remind_item_t
+#endif
+#ifdef __MMI_REMIND_SLEEP_SUPPORT__
+       NV_SECTION_UI_REMIND_SLEEP_DATA,                                // nv_watch_remind_item_t
+#endif
+#ifdef __MMI_REMIND_REST_SUPPORT__
+       NV_SECTION_UI_REMIND_REST_DATA,                         // nv_watch_remind_rest_t
+#endif
+#ifdef __MMI_REMIND_HOME_SUPPORT__
+       NV_SECTION_UI_REMIND_HOME_DATA,                         // nv_watch_remind_home_t
+#endif
+#ifdef __MMI_REMIND_MEDICINE_SUPPORT__
+       NV_SECTION_UI_REMIND_MEDICINE_DATA,                     // nv_watch_remind_medicine_t
+#endif
+#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__
+       NV_SECTION_UI_REMIND_CUSTOM_MEDICINE_DATA,                      // nv_watch_remind_custom_medicine_t
+#endif
+#ifdef __MMI_REMIND_DRINK_SUPPORT__
+       NV_SECTION_UI_REMIND_DRINK_DATA,                        // nv_watch_remind_drink_t
 #endif
 #ifdef __MMI_CUSTOM_HENG_AI__
        NV_SECTION_UI_HENG_AI_WAKE_RING_TYPE,                   // nv_watch_switch_t