k18 sleep ui
author@CHENG <2393524978@qq.com>
Wed, 4 Dec 2024 10:37:35 +0000 (18:37 +0800)
committer@CHENG <2393524978@qq.com>
Wed, 4 Dec 2024 10:37:35 +0000 (18:37 +0800)
16 files changed:
2.sdk/sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c
2.sdk/sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.h
2.sdk/sdk/gui/lv_watch/framework/language/lang_ch.c
2.sdk/sdk/gui/lv_watch/framework/language/lang_en.c
2.sdk/sdk/gui/lv_watch/framework/message/watch_msg_handle.c
2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h
2.sdk/sdk/gui/lv_watch/include/ui_textid.h
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.h
2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c
2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c
2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.h
2.sdk/sdk/gui/lv_watch/lv_theme_watch_night.c
2.sdk/sdk/gui/lv_watch/lv_theme_watch_night.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h
2.sdk/sdk/product/craneg_modem/lv_gui_main.c

index 296cd59..07ea017 100644 (file)
@@ -122,7 +122,7 @@ void mmi_gui_timing_task_create(void)
                                                                                        MMI_GUI_TIMING_MSG_QUEUE_SIZE,
                                                                                        MMI_GUI_TIMING_TASK_STACK_SIZE,
                                                                                        MMI_GUI_TIMING_TASK_PRIORITY,
-                                                                                       "mmi_gui_timing_task");
+                                                                                       "timing_task");
 
        TIMING_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n", __FUNCTION__, __LINE__, s_gui_timing_task_id);
 }
index 4bfe551..709b84b 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
 #define MMI_GUI_TIMING_TIMER_INTERVAL  (3 * 1000) // ms
 
 #define MMI_GUI_TIMING_TASK_PRIORITY 219
-#define MMI_GUI_TIMING_TASK_STACK_SIZE (1 * 1024)
+#define MMI_GUI_TIMING_TASK_STACK_SIZE (1024 * 8) // (1 * 1024)
 #define MMI_GUI_TIMING_MSG_QUEUE_SIZE (16)
 
 
index 35787d4..d5f96cf 100644 (file)
@@ -987,7 +987,8 @@ const void * lang_text_ch[] = {
     "设备温度过高\n请暂缓使用", // WATCH_TEXT_ID_CHIP_HIGH_TEMPERATURE,
     "Voice chat", // WATCH_TEXT_ID_VOICECHAT,
     "请在APP上开启睡眠设置", // WATCH_TEXT_ID_SLEEP_SET_PROMPT,
-    "睡眠时段", // WATCH_TEXT_ID_SLEEP_PERIOD,
+    "设置时段", // WATCH_TEXT_ID_SLEEP_SETTING,
+    "睡眠时长", // WATCH_TEXT_ID_SLEEP_PERIOD,
     "入睡时间", // WATCH_TEXT_ID_FALL_ASLEEP_TIME,
     "醒来时间", // WATCH_TEXT_ID_WAKE_UP_TIME,
     "最新数据", // WATCH_TEXT_ID_LATEST_SLEEP_INFO,
@@ -999,6 +1000,7 @@ const void * lang_text_ch[] = {
     "测试时请保持静止", // WATCH_TEXT_ID_PULSE_WAVE_PROMPT,
     "深睡", // WATCH_TEXT_ID_DEEP_SLEEP,
     "浅睡", // WATCH_TEXT_ID_LIGHT_SLEEP,
+    "快速眼动", // WATCH_TEXT_ID_REM_SLEEP,
 
     //CHENG_MODIFY
     "确认是否跌倒?", // WATCH_TEXT_ID_falldown,
index 650c6d1..9391023 100644 (file)
@@ -988,6 +988,7 @@ const void * lang_text_en[] = {
     "Temperature too high\nPlease suspended use", // WATCH_TEXT_ID_CHIP_HIGH_TEMPERATURE,
     "Voice chat", // WATCH_TEXT_ID_VOICECHAT,
     "Please enable sleep settings in APP", // WATCH_TEXT_ID_SLEEP_SET_PROMPT,
+    "Sleep setting", // WATCH_TEXT_ID_SLEEP_SETTING,
     "Sleep period", // WATCH_TEXT_ID_SLEEP_PERIOD,
     "Sleep time", // WATCH_TEXT_ID_FALL_ASLEEP_TIME,
     "Wake up time", // WATCH_TEXT_ID_WAKE_UP_TIME,
@@ -1000,6 +1001,7 @@ const void * lang_text_en[] = {
     "Keep still", // WATCH_TEXT_ID_PULSE_WAVE_PROMPT,
     "Deep sleep", // WATCH_TEXT_ID_DEEP_SLEEP,
     "Light sleep", // WATCH_TEXT_ID_LIGHT_SLEEP,
+    "REM", // WATCH_TEXT_ID_REM_SLEEP,
 
     //CHENG_MODIFY
     "Confirm a fall",
index 88e0d05..820001f 100644 (file)
@@ -175,8 +175,11 @@ void watch_ui_message_handle(uint16_t msgid, void * msg)
             break;
 #if USE_LV_WATCH_SMS_MSG != 0
         case MMI_MODEM_RECV_SMS_NOTIFY_UI_CMD:
-        sms_msg_list_update();
-        break;
+                       #ifdef __MMI_ZHSX_SUPPORT__
+                       mmi_sms_new_msg_prompt();
+                       #endif
+               sms_msg_list_update();
+               break;
 #endif
 
         case MMI_HAL_LOW_POWER_IND:
index f291872..2375238 100644 (file)
@@ -487,14 +487,15 @@ typedef struct
 
 
 #ifdef __MMI_CUSTOM_HENGAI_SLEEP_K18__
-#define NV_MAX_SLEEP_STATE 50
 
-//typedef enum
-//{
-//     NV_LS_STATE = 11,                               // light sleep
-//     NV_DS_STATE = 12,                               // deep sleep
-//     NV_REM_STATE = 2,                               // rapid eye movement
-//} NV_SLEEP_STATE_E;
+#if 1
+
+typedef enum
+{
+       NV_LS_STATE = 11,                               // light sleep
+       NV_DS_STATE = 12,                               // deep sleep
+       NV_REM_STATE = 2,                               // rapid eye movement
+} NV_SLEEP_STATE_E;
 
 typedef struct
 {
@@ -505,11 +506,24 @@ typedef struct
        uint8_t minute;
 } nv_sleep_time_t;
 
-//typedef struct
-//{
-//     uint32_t duration;                      // the duration of corresponding state
-//     NV_SLEEP_STATE_E state;         // state
-//} nv_sleep_detail_data_t;
+typedef struct
+{
+       uint32_t total_sleep_time;                      // minutes
+       nv_sleep_time_t begin_sleep_time;               // sleep_time_t
+       nv_sleep_time_t end_sleep_time;
+       uint32_t state_duration[3]; //0-NV_LS_STATE; 1-NV_DS_STATE; 2-NV_REM_STATE
+} __packed nv_watch_hengai_sleep_data_t;
+
+#else
+
+typedef struct
+{
+       uint16_t year;
+       uint8_t month;
+       uint8_t day;
+       uint8_t hour;
+       uint8_t minute;
+} nv_sleep_time_t;
 
 typedef struct
 {
@@ -520,6 +534,7 @@ typedef struct
 //     nv_sleep_detail_data_t data[NV_MAX_SLEEP_STATE];
 } __packed nv_watch_hengai_sleep_data_t;
 #endif
+#endif
 
 #endif
 
index c4ec565..7245348 100644 (file)
@@ -995,9 +995,10 @@ enum
     WATCH_TEXT_ID_CHIP_HIGH_TEMPERATURE,                /* "设备温度过高\n请暂缓使用"        "Temperature too high\nPlease suspended use" */
     WATCH_TEXT_ID_VOICECHAT,                            /* "Voice chat"                 "Voice chat" */
     WATCH_TEXT_ID_SLEEP_SET_PROMPT,                     /* "请在APP上开启睡眠设置"               "Please enable sleep settings in APP"*/
-    WATCH_TEXT_ID_SLEEP_PERIOD,                            /* "睡眠时段"                 "Sleep period" */
-    WATCH_TEXT_ID_FALL_ASLEEP_TIME,                            /* "入睡时间"                 "Sleep time" */
-    WATCH_TEXT_ID_WAKE_UP_TIME,                            /* "醒来时间"                 "Wake up time" */
+    WATCH_TEXT_ID_SLEEP_SETTING,                        /* "设置时段"                 "Sleep setting" */
+    WATCH_TEXT_ID_SLEEP_PERIOD,                         /* "睡眠时长"                 "Sleep period" */
+    WATCH_TEXT_ID_FALL_ASLEEP_TIME,                     /* "入睡时间"                 "Sleep time" */
+    WATCH_TEXT_ID_WAKE_UP_TIME,                         /* "醒来时间"                 "Wake up time" */
     WATCH_TEXT_ID_LATEST_SLEEP_INFO,                    /* "最新数据"                 "Latest data" */
     WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME,               /* "数据更新于"                 "Update on" */
     WATCH_TEXT_ID_NO_DATA_NOW,                          /* "暂无数据"                 "No data" */
@@ -1007,6 +1008,7 @@ enum
     WATCH_TEXT_ID_PULSE_WAVE_PROMPT,                    /* "测试时请保持静止"                  "Keep still" */
     WATCH_TEXT_ID_DEEP_SLEEP,                           /* "深睡"                     "Deep sleep" */
     WATCH_TEXT_ID_LIGHT_SLEEP,                          /* "浅睡"                     "Light sleep" */
+    WATCH_TEXT_ID_REM_SLEEP,                            /* "快速眼动"                     "REM" */
 
     //CHENG_MODIFY
     WATCH_TEXT_ID_FALLDWON,                            /*确认是否跌倒*/
index bb260da..75514e0 100644 (file)
@@ -606,6 +606,481 @@ void mmi_hengai_health_sleep_lib_active(void)
 
 
 #if 1 // ui
+
+static uint8_t s_hengai_sleep_data_init = 0;
+static nv_watch_hengai_sleep_data_t s_hengai_sleep_data = {0};
+
+void mmi_hengai_sleep_data_nv_write(void)
+{
+       uint32_t nv_data_length = sizeof(nv_watch_hengai_sleep_data_t);
+       
+       if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
+       {
+               printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
+       }
+}
+
+void mmi_hengai_sleep_data_nv_read(void)
+{
+       uint32_t nv_data_length = sizeof(nv_watch_hengai_sleep_data_t);
+       
+       if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
+       {
+               printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
+               _lv_memset_00(&s_hengai_sleep_data, sizeof(nv_watch_hengai_sleep_data_t));
+       }
+}
+
+void mmi_hengai_sleep_data_set(sleep_data_t * data) // (nv_watch_hengai_sleep_data_t * data)
+{
+       unsigned char i = 0;
+       
+       if(NULL == data)
+               return;
+
+       if(false == s_sleep_data_in_same_cycle)
+       {
+               HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+               s_sleep_data_in_same_cycle = true;
+
+               s_hengai_sleep_data.total_sleep_time = data->total_sleep_time;
+
+               s_hengai_sleep_data.begin_sleep_time.year = data->begin_sleep_time.year;
+               s_hengai_sleep_data.begin_sleep_time.month = data->begin_sleep_time.month;
+               s_hengai_sleep_data.begin_sleep_time.day = data->begin_sleep_time.day;
+               s_hengai_sleep_data.begin_sleep_time.hour = data->begin_sleep_time.hour;
+               s_hengai_sleep_data.begin_sleep_time.minute = data->begin_sleep_time.minute;
+
+               s_hengai_sleep_data.end_sleep_time.year = data->end_sleep_time.year;
+               s_hengai_sleep_data.end_sleep_time.month = data->end_sleep_time.month;
+               s_hengai_sleep_data.end_sleep_time.day = data->end_sleep_time.day;
+               s_hengai_sleep_data.end_sleep_time.hour = data->end_sleep_time.hour;
+               s_hengai_sleep_data.end_sleep_time.minute = data->end_sleep_time.minute;
+
+               for(i = 0; i < data->state_count; i++)
+               {
+                       if(NV_LS_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[0] = data->data[i].duration;
+                       else if(NV_DS_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[1] = data->data[i].duration;
+                       else if(NV_REM_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[2] = data->data[i].duration;
+               }
+       }
+       else
+       {
+               HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+               s_hengai_sleep_data.total_sleep_time += data->total_sleep_time;
+
+               s_hengai_sleep_data.end_sleep_time.year = data->end_sleep_time.year;
+               s_hengai_sleep_data.end_sleep_time.month = data->end_sleep_time.month;
+               s_hengai_sleep_data.end_sleep_time.day = data->end_sleep_time.day;
+               s_hengai_sleep_data.end_sleep_time.hour = data->end_sleep_time.hour;
+               s_hengai_sleep_data.end_sleep_time.minute = data->end_sleep_time.minute;
+
+               for(i = 0; i < data->state_count; i++)
+               {
+                       if(NV_LS_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[0] += data->data[i].duration;
+                       else if(NV_DS_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[1] += data->data[i].duration;
+                       else if(NV_REM_STATE == data->data[i].state)
+                               s_hengai_sleep_data.state_duration[2] += data->data[i].duration;
+               }
+       }
+       mmi_hengai_sleep_data_nv_write();
+}
+
+
+static const lv_point_t s_sleep_valid_pos[] = {{0, 0}, {0, 1}};
+
+lv_obj_t * mmi_sleep_tileview_add_tile(lv_obj_t * tileview, uint16_t id)
+{
+    lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
+    lv_obj_t * cont = lv_cont_create(tileview, NULL);
+    lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp_tight);
+    lv_obj_set_size(cont, LV_HOR_RES, LV_VER_RES);
+    lv_obj_set_y(cont, LV_HOR_RES * ext->valid_pos[id].y);
+    lv_tileview_add_element(tileview, cont);
+    lv_obj_set_click(cont, false);
+    return cont;
+}
+
+static void mmi_sleep_period_str_get(char * str_buf, unsigned int buf_len, unsigned int total_value)
+{
+       unsigned int hour_value = 0;
+       unsigned int minute_value = 0;
+
+       if(NULL == str_buf || 32 > buf_len)
+               return;
+       
+       hour_value = total_value / 60;
+       minute_value = total_value % 60;
+       if(0 == hour_value && 0== minute_value)
+       {
+               sprintf(str_buf, "--");
+       }
+       else if(0 == hour_value)
+       {
+               sprintf(str_buf, "%d%s", 
+                                       minute_value, 
+                                       lv_lang_get_text(WATCH_TEXT_ID_ACT_MIN));
+       }
+       else if(0 == minute_value)
+       {
+               sprintf(str_buf, "%d%s", 
+                                       hour_value, 
+                                       lv_lang_get_text(WATCH_TEXT_ID_ACT_HOUR));
+       }
+       else
+       {
+               sprintf(str_buf, "%d%s %d%s", 
+                                       hour_value, 
+                                       lv_lang_get_text(WATCH_TEXT_ID_ACT_HOUR), 
+                                       minute_value, 
+                                       lv_lang_get_text(WATCH_TEXT_ID_ACT_MIN));
+       }
+}
+
+lv_obj_t * mmi_sleep_second_tab_create(lv_obj_t * tileview, uint16_t id)
+{
+       char temp_buf[128 + 1] = {0};
+    lv_obj_t * tab = mmi_sleep_tileview_add_tile(tileview, id);
+    LV_ASSERT_MEM(tab);
+    if(tab == NULL) 
+               return NULL;
+
+       lv_obj_t * cont = lv_cont_create(tab, NULL);
+       lv_obj_set_size(cont, lv_obj_get_width(tab), lv_obj_get_height(tab));
+       lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+       lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+       lv_watch_obj_add_element(cont);
+    lv_tileview_add_element(tileview, cont);
+       
+       // deep sleep period
+    lv_obj_t * img_deep_sleep = lv_img_create(cont, NULL);
+    lv_img_set_src(img_deep_sleep, ICON_SLEEP_PROMPT);
+    lv_obj_align(img_deep_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55);
+
+       lv_obj_t * label_deep_sleep = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_deep_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+       lv_label_set_text_id(label_deep_sleep, WATCH_TEXT_ID_DEEP_SLEEP);
+       lv_label_set_long_mode(label_deep_sleep, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_deep_sleep, LV_HOR_RES / 2);
+       lv_label_set_align(label_deep_sleep, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_deep_sleep, NULL, LV_ALIGN_IN_TOP_MID, 0, 40);
+       lv_obj_align(label_deep_sleep, img_deep_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+       lv_obj_t * label_ds_value = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_ds_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+       mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[1]);
+       lv_label_set_text(label_ds_value, temp_buf);
+       lv_label_set_long_mode(label_ds_value, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_ds_value, LV_HOR_RES / 2);
+       lv_label_set_align(label_ds_value, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_ds_value, label_deep_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+       lv_obj_align(label_ds_value, img_deep_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+
+       // light sleep period
+    lv_obj_t * img_light_sleep = lv_img_create(cont, NULL);
+    lv_img_set_src(img_light_sleep, ICON_SLEEP_PROMPT);
+    lv_obj_align(img_light_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55 + 140);
+
+       lv_obj_t * label_light_sleep = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_light_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+       lv_label_set_text_id(label_light_sleep, WATCH_TEXT_ID_LIGHT_SLEEP);
+       lv_label_set_long_mode(label_light_sleep, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_light_sleep, LV_HOR_RES / 2);
+       lv_label_set_align(label_light_sleep, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_light_sleep, NULL, LV_ALIGN_CENTER, 0, -25);
+       lv_obj_align(label_light_sleep, img_light_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+       lv_obj_t * label_ls_value = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_ls_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+       mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[0]);
+       lv_label_set_text(label_ls_value, temp_buf);
+       lv_label_set_long_mode(label_ls_value, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_ls_value, LV_HOR_RES / 2);
+       lv_label_set_align(label_ls_value, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_ls_value, label_light_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+       lv_obj_align(label_ls_value, img_light_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+
+       // rem sleep period
+    lv_obj_t * img_rem_sleep = lv_img_create(cont, NULL);
+    lv_img_set_src(img_rem_sleep, ICON_SLEEP_PROMPT);
+    lv_obj_align(img_rem_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55 + 140 + 140);
+
+       lv_obj_t * label_rem_sleep = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_rem_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+       lv_label_set_text_id(label_rem_sleep, WATCH_TEXT_ID_REM_SLEEP);
+       lv_label_set_long_mode(label_rem_sleep, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_rem_sleep, LV_HOR_RES / 2);
+       lv_label_set_align(label_rem_sleep, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_rem_sleep, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -95);
+       lv_obj_align(label_rem_sleep, img_rem_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+       lv_obj_t * label_rem_value = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_rem_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+       mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[2]);
+       lv_label_set_text(label_rem_value, temp_buf);
+       lv_label_set_long_mode(label_rem_value, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_rem_value, LV_HOR_RES / 2);
+       lv_label_set_align(label_rem_value, LV_LABEL_ALIGN_LEFT);
+       //lv_obj_align(label_rem_value, label_rem_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+       lv_obj_align(label_rem_value, img_rem_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+    return tab;
+}
+
+static lv_obj_t * mmi_sleep_first_tab_create(lv_obj_t * tileview, uint16_t id)
+{
+       char temp_buf[128 + 1] = {0};
+    lv_obj_t * tab = mmi_sleep_tileview_add_tile(tileview, id);
+    LV_ASSERT_MEM(tab);
+    if(tab == NULL) 
+               return NULL;
+
+       lv_obj_t * cont = lv_cont_create(tab, NULL);
+       lv_obj_set_size(cont, lv_obj_get_width(tab), lv_obj_get_height(tab));
+       lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+       lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+       lv_watch_obj_add_element(cont);
+    lv_tileview_add_element(tileview, cont);
+
+       // setting period
+       lv_obj_t * label_sleep_period = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_sleep_period, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+       lv_label_set_text_id(label_sleep_period, WATCH_TEXT_ID_SLEEP_SETTING);
+       lv_label_set_long_mode(label_sleep_period, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_sleep_period, LV_HOR_RES * 2 / 3);
+       lv_label_set_align(label_sleep_period, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label_sleep_period, NULL, LV_ALIGN_IN_TOP_MID, 0, 40);
+
+       nv_watch_sleep_time_t sleep_setting_data = {0};
+       mmi_watch_sleep_time_data_get(&sleep_setting_data);
+    sprintf(temp_buf, "%02d:%02d-%02d:%02d",
+                               sleep_setting_data.begin_hour,
+                               sleep_setting_data.begin_min,
+                               sleep_setting_data.end_hour,
+                               sleep_setting_data.end_min);
+
+       lv_obj_t * label_sleep_period_value = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_sleep_period_value, LV_LABEL_PART_MAIN, &lv_watch_font40);
+       lv_label_set_text(label_sleep_period_value, temp_buf);
+       lv_label_set_long_mode(label_sleep_period_value, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_sleep_period_value, LV_HOR_RES * 2 / 3);
+       lv_label_set_align(label_sleep_period_value, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label_sleep_period_value, label_sleep_period, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+
+
+       // total period
+       lv_obj_t * label_total_period = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_total_period, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+       lv_label_set_text_id(label_total_period, WATCH_TEXT_ID_SLEEP_PERIOD);
+       lv_label_set_long_mode(label_total_period, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_total_period, LV_HOR_RES * 2 / 3);
+       lv_label_set_align(label_total_period, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label_total_period, NULL, LV_ALIGN_CENTER, 0, -20);
+
+       lv_obj_t * label_total_value = lv_label_create(cont, NULL);
+       lv_obj_add_style(label_total_value, LV_LABEL_PART_MAIN, &lv_watch_font40);
+       mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.total_sleep_time);
+       lv_label_set_text(label_total_value, temp_buf);
+       lv_label_set_long_mode(label_total_value, LV_LABEL_LONG_SROLL);
+       lv_obj_set_width(label_total_value, LV_HOR_RES * 2 / 3);
+       lv_label_set_align(label_total_value, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label_total_value, label_total_period, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+
+
+       // update time
+       if(0 != s_hengai_sleep_data.total_sleep_time
+               //&& (0 != s_hengai_sleep_data.end_sleep_time.hour 
+               //      || 0 != s_hengai_sleep_data.end_sleep_time.minute
+               //      )
+               )
+       {
+               lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+               lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26);
+               lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME);
+               lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_SROLL);
+               lv_obj_set_width(label_prompt, LV_HOR_RES / 2);
+               lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+               lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -70);
+       
+               snprintf(temp_buf, 128, "%04d.%02d.%02d %02d:%02d",
+                                       s_hengai_sleep_data.end_sleep_time.year,
+                                       s_hengai_sleep_data.end_sleep_time.month,
+                                       s_hengai_sleep_data.end_sleep_time.day,
+                                       s_hengai_sleep_data.end_sleep_time.hour,
+                                       s_hengai_sleep_data.end_sleep_time.minute);
+               
+               lv_obj_t * label_info = lv_label_create(cont, NULL);
+               lv_obj_add_style(label_info, LV_LABEL_PART_MAIN, &lv_watch_font26);
+               lv_label_set_text(label_info, temp_buf);
+               lv_label_set_long_mode(label_info, LV_LABEL_LONG_SROLL);
+               lv_obj_set_width(label_info, LV_HOR_RES * 2 / 3);
+               lv_label_set_align(label_info, LV_LABEL_ALIGN_CENTER);
+               lv_obj_align(label_info, label_prompt, LV_ALIGN_OUT_BOTTOM_MID, 0, 8);
+       }
+       else
+       {
+               lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+               lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_gray);
+               lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_NO_DATA_NOW);
+               lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_SROLL);
+               lv_obj_set_width(label_prompt, LV_HOR_RES / 2);
+               lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+               lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -30);
+       }
+
+       //
+    lv_obj_t * label_up = lv_label_create(cont, NULL);
+    lv_label_set_text(label_up, LV_SYMBOL_UP);
+    lv_obj_align(label_up, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5);
+
+    return tab;
+}
+
+void mmi_sleep_display_create(lv_obj_t * obj)
+{
+    lv_obj_t  * tileview = lv_tileview_create(obj, NULL);
+    //lv_sleep_drop_pull_obj_ext_t * ext_drop = lv_obj_allocate_ext_attr(tileview, sizeof(lv_sleep_drop_pull_obj_ext_t));
+    //(void)ext_drop;
+    LV_ASSERT_MEM(tileview);
+    lv_tileview_set_valid_positions(tileview, s_sleep_valid_pos, sizeof(s_sleep_valid_pos) / sizeof(s_sleep_valid_pos[0]));
+    lv_tileview_set_edge_flash(tileview, true);
+    lv_tileview_set_anim_time(tileview, 60);
+    lv_page_set_scrollbar_mode(tileview, LV_SCROLLBAR_MODE_OFF);
+    lv_obj_add_style(tileview, LV_TILEVIEW_PART_EDGE_FLASH, &lv_watch_cont_opa1);
+
+    lv_obj_t * tab;
+    tab = mmi_sleep_first_tab_create(tileview, 0);
+    LV_ASSERT_MEM(tab);
+    if(tab == NULL) 
+               return NULL;
+
+    tab = mmi_sleep_second_tab_create(tileview, 1);
+    LV_ASSERT_MEM(tab);
+    if(tab == NULL) 
+               return NULL;
+
+    lv_tileview_set_tile_act(tileview, 0, 0, false);
+    lv_watch_obj_add_element(tileview);
+    lv_watch_obj_add_element(lv_page_get_scrl(tileview));
+}
+
+void mmi_sleep_no_setting_create(lv_obj_t * obj)
+{
+       lv_obj_t * cont = lv_cont_create(obj, NULL);
+       lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj));
+       lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+       lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+       lv_watch_obj_add_element(cont);
+
+       lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+#ifdef USE_LV_WATCH_UI_466_466
+       lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font40);
+#else
+       lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+#endif
+       lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_SLEEP_SET_PROMPT);
+       lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_BREAK);
+       lv_obj_set_width(label_prompt, LV_HOR_RES * 4 / 5);
+       lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(label_prompt, cont, LV_ALIGN_CENTER, 0, -10);
+
+    //lv_obj_set_hidden(label_no, true);
+}
+
+void mmi_sleep_prepare_destory(lv_obj_t * activity_obj)
+{
+       printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+    lv_watch_png_cache_all_free();
+
+       //lv_hengai_sleep_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+       //if(NULL == ext) 
+               return ;
+}
+
+lv_obj_t * mmi_sleep_create(lv_obj_t * activity_obj)
+{
+       printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+    if(activity_obj == NULL) 
+       {
+        lv_watch_activity_ext_t activity_ext;
+               
+               _lv_memset_00(&activity_ext, sizeof(lv_watch_activity_ext_t));
+        activity_ext.actId = ACT_ID_SLEEP;
+        activity_ext.create = (lv_watch_activity_create_f_t)mmi_sleep_create;
+        activity_ext.prepare_destory = mmi_sleep_prepare_destory;
+        activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+        LV_ASSERT_MEM(activity_obj);
+    }
+
+    lv_obj_t * obj = lv_watch_obj_create(activity_obj);
+       if(NULL == obj)
+               return NULL;
+    /*Allocate the tab type specific extended data*/
+       //lv_hengai_sleep_ext_t * ext = lv_obj_allocate_ext_attr(obj, sizeof(lv_hengai_sleep_ext_t));
+       //if(NULL == ext)
+       //      return NULL;
+
+    if(false == mmi_watch_sleep_switch_is_on())
+       {
+               mmi_sleep_no_setting_create(obj);
+       }
+       else
+       {
+               mmi_sleep_display_create(obj);
+       }
+       
+       return obj;
+}
+
+void mmi_sleep_create_event_cb(lv_obj_t * btn, lv_event_t e)
+{
+    if(LV_EVENT_CLICKED == e) 
+       {
+               if(0 == s_hengai_sleep_data_init)
+               {
+                       mmi_hengai_sleep_data_nv_read();
+                       s_hengai_sleep_data_init = 1;
+               }
+
+       #if 0 // for debug
+               s_hengai_sleep_data.total_sleep_time = 631;
+
+               s_hengai_sleep_data.begin_sleep_time.year = 2024,
+               s_hengai_sleep_data.begin_sleep_time.month = 10,
+               s_hengai_sleep_data.begin_sleep_time.day = 12,
+               s_hengai_sleep_data.begin_sleep_time.hour = 22,
+               s_hengai_sleep_data.begin_sleep_time.minute = 36;
+
+               s_hengai_sleep_data.end_sleep_time.year = 2024,
+               s_hengai_sleep_data.end_sleep_time.month = 10,
+               s_hengai_sleep_data.end_sleep_time.day = 13,
+               s_hengai_sleep_data.end_sleep_time.hour = 8,
+               s_hengai_sleep_data.end_sleep_time.minute = 12;
+
+               s_hengai_sleep_data.state_duration[0] = 180;
+               //s_hengai_sleep_data.state_duration[1] = 59;
+               s_hengai_sleep_data.state_duration[2] = 392;
+       #endif
+               
+        lv_watch_png_cache_all_free();
+        lv_obj_t * obj = mmi_sleep_create(NULL);
+        LV_ASSERT_MEM(obj);
+    }
+}
+
+#else
+
 static uint8_t s_hengai_sleep_data_init = 0;
 static nv_watch_hengai_sleep_data_t s_hengai_sleep_data = {0};
 
index 5c1c103..b853e19 100644 (file)
@@ -19,7 +19,7 @@ extern "C" {
 #ifdef __MMI_CUSTOM_HENGAI_SLEEP_K18__
 
 #define MMI_WATCH_SLEEP_TASK_PRIORITY 221
-#define MMI_WATCH_SLEEP_TASK_STACK_SIZE (1 * 1024)
+#define MMI_WATCH_SLEEP_TASK_STACK_SIZE (1024 * 16) // (1 * 1024)
 #define MMI_WATCH_SLEEP_MSG_QUEUE_SIZE (32) // (16)
 
 
index 5d58d63..f56d530 100644 (file)
@@ -1136,7 +1136,7 @@ void mmi_health_measure_factory_mode_clean(void)
 
 
 #define MMI_HEALTH_MEASURE_TASK_PRIORITY 221
-#define MMI_HEALTH_MEASURE_TASK_STACK_SIZE (8 * 1024)
+#define MMI_HEALTH_MEASURE_TASK_STACK_SIZE (1024 * 16) // (8 * 1024)
 #define MMI_HEALTH_MEASURE_MSG_QUEUE_SIZE (16)
 
 TASK_HANDLE * s_health_measure_task_id = NULL;
@@ -1267,7 +1267,7 @@ void mmi_health_measure_task_init(void)
                                                                                                MMI_HEALTH_MEASURE_MSG_QUEUE_SIZE,
                                                                                                MMI_HEALTH_MEASURE_TASK_STACK_SIZE,
                                                                                                MMI_HEALTH_MEASURE_TASK_PRIORITY,
-                                                                                               "mmi_health_measure_task");
+                                                                                               "health_measure");
 
        HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: task_id=0x%x\n",__FUNCTION__,__LINE__, s_health_measure_task_id);
 }
index 8ed326c..9e93695 100644 (file)
@@ -314,6 +314,31 @@ static void mmi_sms_vib_prompt_task_cb(lv_task_t * task)
        Hal_Vibrator_Play_End();\r
 }\r
 \r
+void mmi_sms_new_msg_prompt(void)\r
+{\r
+       uint8_t volume = 0;\r
+       \r
+#ifdef __MMI_USER_PROFILE_SUPPORT__\r
+       volume = mmi_user_profile_current_mode_new_sms_volume_get();\r
+#else\r
+       volume = query_current_volume();\r
+#endif\r
+#ifdef __MMI_NEW_SMS_SILENT_SUPPORT__\r
+       if(0 != mmi_new_sms_silent_swtich_get())\r
+               volume = 0;\r
+#endif\r
+       if(0 != volume)\r
+       {\r
+               Hal_NFFS_File_Play_Onetime(AUDIO_SETTING_AUDIO_MSG, volume, NULL, 0);\r
+       }\r
+       if(true == mmi_watch_vibrate_is_permitted())\r
+       {\r
+               Hal_Vibrator_Play_Onetime(NULL, 800);\r
+               lv_task_t * task_ptr = lv_task_create(mmi_sms_vib_prompt_task_cb, 900, LV_TASK_PRIO_MID, NULL);\r
+               lv_task_once(task_ptr);\r
+       }\r
+}\r
+\r
 void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info)\r
 {\r
        if(sms_info == NULL)\r
@@ -379,7 +404,7 @@ void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info)
                {\r
                        if(0 == Hal_Pm_Get_State())\r
                        {\r
-                               printf("sms_msg_list_update -----> onkey_wakeup\n");\r
+                               printf("new_sms -----> onkey_wakeup\n");\r
                                extern void onkey_wakeup(void) __attribute__((weak));\r
                                if (onkey_wakeup != NULL)\r
                                {\r
@@ -388,52 +413,17 @@ void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info)
                        }\r
                        else\r
                        {\r
-                               printf("sms_msg_list_update -----> watch_set_lcd_status\n");\r
+                               printf("new_sms -----> watch_set_lcd_status\n");\r
                                watch_set_lcd_status(true);\r
                                watch_wakeup_time_reset();\r
                        }\r
 \r
-               #ifdef __MMI_ZHSX_SUPPORT__\r
-                       uint8_t volume = 0;\r
-                       \r
-                       #ifdef __MMI_USER_PROFILE_SUPPORT__\r
-                       volume = mmi_user_profile_current_mode_new_sms_volume_get();\r
-                       #else\r
-                       volume = query_current_volume();\r
-                       #endif\r
-                       #ifdef __MMI_NEW_SMS_SILENT_SUPPORT__\r
-                       if(0 != mmi_new_sms_silent_swtich_get())\r
-                               volume = 0;\r
-                       #endif\r
-                       if(0 != volume)\r
-                       {\r
-                               Hal_NFFS_File_Play_Onetime(AUDIO_SETTING_AUDIO_MSG, volume, NULL, 0);\r
-                       }\r
-                       if(true == mmi_watch_vibrate_is_permitted())\r
-                       {\r
-                               Hal_Vibrator_Play_Onetime(NULL, 800);\r
-                               lv_task_t * task_ptr = lv_task_create(mmi_sms_vib_prompt_task_cb, 900, LV_TASK_PRIO_MID, NULL);\r
-                               lv_task_once(task_ptr);\r
-                       }\r
-               #endif\r
-\r
                        //notify ui \r
                        app_adaptor_recv_sms_notsify_update_ui();\r
                }\r
        }\r
-\r
-#if SMS_MSG_TEST != 0\r
-       nv_watch_sms_msg_t * list = sms_msg_read_nvm();\r
-       if(list){\r
-               for(uint8_t i = 0; i < NV_WATCH_MAX_SMS_MSG_NUM; i++) {\r
-                       if('\0' == list->info[i].number[0]) {\r
-                               break;\r
-                       }\r
-                       printf("%s   yzmin --> name = %s\n",__FUNCTION__,list->info[i].number);\r
-               }\r
-       }\r
-#endif \r
 }\r
+\r
 #else\r
 void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info)\r
 {\r
index 1e71fca..c99f05c 100644 (file)
@@ -70,6 +70,9 @@ typedef struct
  */
 void sms_msg_list_update(void);
 void  sms_msg_create_event_cb(lv_obj_t * btn,lv_event_t e);
+#ifdef __MMI_ZHSX_SUPPORT__
+void mmi_sms_new_msg_prompt(void);
+#endif
 void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info);
 lv_obj_t * sms_msg_create(lv_obj_t * tileview,uint16_t id);
 
index 56fbd97..ad05475 100644 (file)
@@ -220,6 +220,7 @@ lv_style_t lv_watch_font30_gray;
 lv_style_t lv_watch_font30_yellow;
 lv_style_t lv_watch_font40;
 lv_style_t lv_watch_font40_black;
+lv_style_t lv_watch_font40_gray;
 lv_style_t lv_watch_font40_yellow;
 lv_style_t lv_watch_cont_opa1;
 lv_style_t lv_watch_cont_opa2;
@@ -1066,6 +1067,10 @@ static void lv_theme_watch_set_private_style(void)
        lv_style_set_text_color(&lv_watch_font40_black, LV_STATE_DEFAULT, LV_COLOR_BLACK);
        lv_style_set_text_font(&lv_watch_font40_black, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_40);
 
+       style_init_reset(&lv_watch_font40_gray);
+       lv_style_set_text_color(&lv_watch_font40_gray, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+       lv_style_set_text_font(&lv_watch_font40_gray, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_40);
+
     /*font 40 yellow*/
     style_init_reset(&lv_watch_font40_yellow);
     lv_style_set_text_color(&lv_watch_font40_yellow, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
index 33960f2..fb8a959 100644 (file)
@@ -130,6 +130,7 @@ extern lv_style_t lv_watch_font30_gray;
 extern lv_style_t lv_watch_font30_yellow;
 extern lv_style_t lv_watch_font40;
 extern lv_style_t lv_watch_font40_black;
+extern lv_style_t lv_watch_font40_gray;
 extern lv_style_t lv_watch_font40_yellow;
 extern lv_style_t lv_watch_cont_opa1;
 extern lv_style_t lv_watch_cont_opa2;
index f676156..a64536a 100644 (file)
@@ -31,7 +31,7 @@ extern "C"
 #define PROTOCOL_TIMING_TIMER_INTERVAL (20 * 1000) // ms
 
 #define PROTOCOL_TIMING_TASK_PRIORITY 220
-#define PROTOCOL_TIMING_TASK_STACK_SIZE (10 * 1024)
+#define PROTOCOL_TIMING_TASK_STACK_SIZE (1024 * 16) // (10 * 1024)
 #define PROTOCOL_TIMING_MSG_QUEUE_SIZE (64)
 
 
index c1f79ba..b1c2528 100644 (file)
@@ -1573,7 +1573,8 @@ int ui_init_phase2(void)
 #if USE_LV_ROM_FS
     lv_romfs_init(1);
 #endif
-    gui_task_id = uos_create_task(gui_main, NULL, 64, 0x4000, GUI_TASK_PRIORITY, "gui_task");
+    //gui_task_id = uos_create_task(gui_main, NULL, 64, 0x4000, GUI_TASK_PRIORITY, "gui_task");
+    gui_task_id = uos_create_task(gui_main, NULL, 64, 0x8000, GUI_TASK_PRIORITY, "gui_task");
     printf("gui task %d,  queue id %d\n", gui_task_id, gui_task_id->nMailBoxId);
     return 0;
 }