From: @CHENG <2393524978@qq.com> Date: Tue, 26 Nov 2024 06:59:45 +0000 (+0800) Subject: k18 blood pressure measurement ui X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=fb3d02da716eaf0cd0fa2a88f005d140d927804b;p=mirrors%2FASR3603_Z5.git k18 blood pressure measurement ui --- diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c index 5bb9bba3..78168ca9 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.c @@ -148,6 +148,315 @@ void __hengai_data_send_per_5s_action(void) #endif +#ifdef __BP_MEASURING_REAL_TIME_UI__ +#ifdef __CHART_DEBUG__ +#define __TEST_ABS(x) (((x) < 0) ? (-(x)) : (x)) +#define __TEST_POINT_NUM_MAX (MMI_HENGAI_BP_RAW_DATA_SAMPLE_RATE) + +static int s_chart_y_array[__TEST_POINT_NUM_MAX] = {0}; +static int __test_last_raw_data_len = 0; +static int * __test_current_raw_data_ptr = 0; +static int __test_current_raw_data_len = 0; + +static void __test_bp_measure_chart_update(lv_obj_t * chart, lv_chart_series_t * ser) +{ + int buff_len = sizeof(int) * __TEST_POINT_NUM_MAX; + int * temp_ptr = NULL; + int temp_len = 0; + unsigned char i = 0; + int temp_value = 0; + int step_value = 0; + + if(NULL == chart || NULL == ser) + return; + +// lv_chart_clear_series(chart, ser); + + if(NULL != __test_current_raw_data_ptr) + { + lv_mem_free(__test_current_raw_data_ptr); + __test_current_raw_data_ptr = NULL; + } + __test_current_raw_data_ptr = (int *)lv_mem_alloc(buff_len); + _lv_memset_00(__test_current_raw_data_ptr, buff_len); + + temp_ptr = fr8012haq_blood_data_get(&__test_current_raw_data_len); + temp_len = __test_current_raw_data_len - __test_last_raw_data_len; + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: total=%d,last=%d\n", __FUNCTION__, __LINE__, __test_current_raw_data_len, __test_last_raw_data_len); + if(0 >= temp_len) + return; + if(__TEST_POINT_NUM_MAX < temp_len) + temp_len = __TEST_POINT_NUM_MAX; + _lv_memcpy(__test_current_raw_data_ptr, temp_ptr + __test_last_raw_data_len, sizeof(int) * temp_len); + __test_last_raw_data_len = __test_current_raw_data_len; + _lv_memset_00(s_chart_y_array, sizeof(int) * __TEST_POINT_NUM_MAX); + _lv_memcpy(s_chart_y_array, __test_current_raw_data_ptr, sizeof(int) * temp_len); + + //for(i = 0; i < temp_len; i++) + //{ + // s_chart_y_array[i] = __test_current_raw_data_ptr[i]; + //} + if(NULL != __test_current_raw_data_ptr) + { + lv_mem_free(__test_current_raw_data_ptr); + __test_current_raw_data_ptr = NULL; + } + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%d]: %d,%d,%d,%d,%d,%d,%d,%d,%d\n", __LINE__, + s_chart_y_array[0], + s_chart_y_array[5], + s_chart_y_array[10], + s_chart_y_array[20], + s_chart_y_array[30], + s_chart_y_array[40], + s_chart_y_array[50], + s_chart_y_array[60], + s_chart_y_array[70] + ); + temp_value = s_chart_y_array[0]; + for(i = 1; i < temp_len; i++) + { + if(__TEST_ABS(temp_value) < __TEST_ABS(s_chart_y_array[i])) + { + temp_value = s_chart_y_array[i]; + } + } + step_value = __TEST_ABS(temp_value) / 200; + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: max=%d,step=%d,temp_len=%d\n", __FUNCTION__, __LINE__, temp_value, step_value, temp_len); + for(i = 0; i < temp_len; i++) + { + s_chart_y_array[i] = s_chart_y_array[i] / step_value; // 200; // 500; // 100000; + } + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%d]: %d,%d,%d,%d,%d,%d,%d,%d,%d\n", __LINE__, + s_chart_y_array[0], + s_chart_y_array[5], + s_chart_y_array[10], + s_chart_y_array[20], + s_chart_y_array[30], + s_chart_y_array[40], + s_chart_y_array[50], + s_chart_y_array[60], + s_chart_y_array[70] + ); + + lv_chart_set_points(chart, ser, s_chart_y_array); +} + +static lv_obj_t * __test_bp_measure_chart_create(lv_obj_t * par) +{ + lv_obj_t * chart = lv_chart_create(par, NULL); + lv_obj_set_style_local_bg_color(chart, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); // LV_COLOR_WHITE); + lv_obj_set_style_local_bg_opa(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 255); //LV_OPA_0); + lv_obj_set_style_local_pad_top(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_pad_bottom(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_pad_left(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_pad_right(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_border_opa(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_obj_set_style_local_border_color(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_border_width(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_border_side(chart, LV_CHART_PART_BG, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM); + + lv_obj_set_style_local_line_opa(chart, LV_CHART_PART_SERIES_BG, LV_STATE_DEFAULT, LV_OPA_0); + lv_obj_set_style_local_size(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_line_opa(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_obj_set_style_local_bg_opa(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, 0); // LV_OPA_COVER); + lv_obj_set_style_local_bg_main_stop(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, 255); //220); + lv_obj_set_style_local_bg_grad_stop(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, 255); //60); + lv_obj_set_style_local_bg_grad_dir(chart, LV_CHART_PART_SERIES, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); + + lv_obj_set_size(chart, 360, 400); + lv_obj_set_click(chart, false); + lv_obj_align(chart, NULL, LV_ALIGN_CENTER, 0, 0); + + lv_chart_set_point_count(chart, __TEST_POINT_NUM_MAX); + lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, -200, 200); + + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + if(NULL != __test_current_raw_data_ptr) + { + lv_mem_free(__test_current_raw_data_ptr); + __test_current_raw_data_ptr = NULL; + } + __test_current_raw_data_len = 0; + __test_last_raw_data_len = 0; + _lv_memset_00(s_chart_y_array, sizeof(int) * __TEST_POINT_NUM_MAX); + + return chart; +} +#endif + + +#define BP_ABS(x) (((x) < 0) ? (-(x)) : (x)) +#define BP_DATA_SECOND_NUM (2) +#define BP_POINT_NUM_MAX (MMI_HENGAI_BP_RAW_DATA_SAMPLE_RATE * BP_DATA_SECOND_NUM) +#define BP_OBJ_LINE_CONT_W (340) +#define BP_OBJ_LINE_CONT_H (360) // (400) + +static lv_point_t s_line_point_array[BP_POINT_NUM_MAX] = {0}; +static int s_last_raw_data_len = 0; +static int * s_line_y_array_ptr = NULL; +static int s_current_raw_data_len = 0; +static unsigned char s_update_counter = 0; + +static void mmi_hengai_bp_measure_ui_data_init(void) +{ + _lv_memset_00(s_line_point_array, sizeof(lv_point_t) * BP_POINT_NUM_MAX); + + s_last_raw_data_len = 0; + s_current_raw_data_len = 0; + s_update_counter = 0; + + if(NULL != s_line_y_array_ptr) + { + lv_mem_free(s_line_y_array_ptr); + s_line_y_array_ptr = NULL; + } + s_line_y_array_ptr = (int *)lv_mem_alloc(sizeof(int) * BP_POINT_NUM_MAX); + _lv_memset_00(s_line_y_array_ptr, sizeof(int) * BP_POINT_NUM_MAX); +} + +static void mmi_hengai_bp_measure_ui_data_deinit(void) +{ + if(NULL != s_line_y_array_ptr) + { + lv_mem_free(s_line_y_array_ptr); + s_line_y_array_ptr = NULL; + } +} + +static int mmi_hengai_bp_measure_line_update(lv_obj_t * line) +{ + int * temp_ptr = NULL; + int temp_len = 0; + unsigned int i = 0; + int temp_value = 0; + unsigned int x_step_value = 0; + unsigned int y_step_value = 0; + + if(NULL == line) + { + return -1; + } + + if(NULL == s_line_y_array_ptr) + { + s_line_y_array_ptr = (int *)lv_mem_alloc(sizeof(int) * BP_POINT_NUM_MAX); + } + _lv_memset_00(s_line_y_array_ptr, sizeof(int) * BP_POINT_NUM_MAX); + + temp_ptr = fr8012haq_blood_data_get(&s_current_raw_data_len); + temp_len = s_current_raw_data_len - s_last_raw_data_len; + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: total=%d,last=%d\n", __FUNCTION__, __LINE__, s_current_raw_data_len, s_last_raw_data_len); + if(0 >= temp_len) + return -2; + if(BP_POINT_NUM_MAX < temp_len) + temp_len = BP_POINT_NUM_MAX; + _lv_memcpy(s_line_y_array_ptr, temp_ptr + s_last_raw_data_len, sizeof(int) * temp_len); + s_last_raw_data_len = s_current_raw_data_len; + + temp_value = s_line_y_array_ptr[0]; + for(i = 0; i < temp_len; i++) + { + if(BP_ABS(temp_value) < BP_ABS(s_line_y_array_ptr[i])) + { + temp_value = s_line_y_array_ptr[i]; + } + } + y_step_value = BP_ABS(temp_value) / (BP_OBJ_LINE_CONT_H / 2 - 10); + x_step_value = BP_OBJ_LINE_CONT_W / temp_len; + for(i = 0; i < temp_len; i++) + { + if(0 < i) + s_line_point_array[i].x = s_line_point_array[i-1].x + x_step_value; + else + s_line_point_array[i].x = 5; + + //s_line_point_array[i].y = s_line_y_array_ptr[i] / y_step_value + BP_OBJ_LINE_CONT_H / 2; + if(0 > s_line_y_array_ptr[i]) + { + s_line_point_array[i].y = (BP_OBJ_LINE_CONT_H / 2) - (lv_coord_t)(BP_ABS(s_line_y_array_ptr[i]) / y_step_value); + } + else + { + //s_line_point_array[i].y = (BP_OBJ_LINE_CONT_H / 4) + (s_line_y_array_ptr[i] / y_step_value); + s_line_point_array[i].y = (BP_OBJ_LINE_CONT_H / 2) + (s_line_y_array_ptr[i] / y_step_value); + } + } + lv_line_set_points(line, s_line_point_array, temp_len); + + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: max=%d,len=%d,x_step=%d,y_step=%d\n", __FUNCTION__, __LINE__, + temp_value, temp_len, x_step_value, y_step_value); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%d]: %d,%d,%d,%d,%d,%d,%d,%d,%d\n", __LINE__, + s_line_y_array_ptr[0], + s_line_y_array_ptr[5], + s_line_y_array_ptr[10], + s_line_y_array_ptr[20], + s_line_y_array_ptr[30], + s_line_y_array_ptr[40], + s_line_y_array_ptr[50], + s_line_y_array_ptr[60], + s_line_y_array_ptr[70] + ); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%d]: %d,%d,%d,%d,%d,%d,%d,%d,%d\n", __LINE__, + s_line_point_array[0].y, + s_line_point_array[5].y, + s_line_point_array[10].y, + s_line_point_array[20].y, + s_line_point_array[30].y, + s_line_point_array[40].y, + s_line_point_array[50].y, + s_line_point_array[60].y, + s_line_point_array[70].y + ); + + return 0; +} + +static lv_obj_t * mmi_hengai_bp_measure_line_create(lv_obj_t * par) +{ + lv_obj_t * cont = lv_chart_create(par, NULL); + lv_obj_set_style_local_bg_color(cont, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); // LV_COLOR_WHITE); + + lv_obj_set_size(cont, BP_OBJ_LINE_CONT_W, BP_OBJ_LINE_CONT_H); + lv_obj_set_click(cont, false); + + lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0); + + lv_obj_t * line = lv_line_create(cont, NULL); + lv_obj_set_style_local_line_color(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_set_style_local_line_width(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 2); // 1); + lv_obj_set_style_local_line_opa(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); // LV_OPA_50); + lv_line_set_points(line, s_line_point_array, BP_POINT_NUM_MAX); + + #if 0 + lv_obj_t * line_hor = lv_line_create(cont, NULL); + lv_obj_set_style_local_line_color(line_hor, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); + lv_obj_set_style_local_line_width(line_hor, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 1); + lv_obj_set_style_local_line_opa(line_hor, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + //lv_point_t line_hor_point[2] = {0}; + line_hor_point[0].x = 0; + line_hor_point[0].y = BP_OBJ_LINE_CONT_H >> 1; + line_hor_point[1].x = BP_OBJ_LINE_CONT_W; + line_hor_point[1].y = BP_OBJ_LINE_CONT_H >> 1; + lv_line_set_points(line_hor, line_hor_point, 2); + + lv_obj_t * line_ver = lv_line_create(cont, NULL); + lv_obj_set_style_local_line_color(line_ver, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); + lv_obj_set_style_local_line_width(line_ver, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 1); + lv_obj_set_style_local_line_opa(line_ver, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + //lv_point_t line_ver_point[2] = {0}; + line_ver_point[0].x = 0; + line_ver_point[0].y = 0; + line_ver_point[1].x = 0; + line_ver_point[1].y = BP_OBJ_LINE_CONT_H; + lv_line_set_points(line_ver, line_ver_point, 2); + #endif + + return line; +} +#endif + + bool mmi_hengai_bp_measuring_flag_get(void) { return (s_hengai_bp_measuring); @@ -322,6 +631,10 @@ static void mmi_heng_ai_bp_screen_prepare_destory(lv_obj_t * activity_obj) HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); mmi_hengai_bp_raw_data_free(); + +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif mmi_heng_ai_bp_measure_screen_clean(); mmi_heng_ai_bp_calibrate_screen_clean(); @@ -411,6 +724,10 @@ void mmi_heng_ai_bp_measure_screen_prepare_destory(lv_obj_t * activity_obj) watch_ext->gif_info = NULL; } } + +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif } void mmi_heng_ai_bp_measure_screen_clean(void) @@ -659,6 +976,10 @@ void mmi_hengai_bp_measure_finish_screen(void) lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292); #endif +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif + HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); watch_ext->result_timer_id = Hal_Timer_Start(MMI_BP_WAIT_RESULT_TIMEOUT, mmi_hengai_bp_measure_result_timeout, NULL, false); @@ -698,6 +1019,27 @@ void mmi_hengai_bp_measure_cycle_timeout(void * para) } else { + #ifdef __BP_MEASURING_REAL_TIME_UI__ + s_update_counter++; + if(BP_DATA_SECOND_NUM <= s_update_counter) + { + s_update_counter = 0; + + lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get(); + if(NULL == watch_ext) + return; + + int ret = mmi_hengai_bp_measure_line_update(watch_ext->line); + if(0 == ret && NULL != watch_ext->label_prompt) + { + lv_obj_del(watch_ext->label_prompt); + watch_ext->label_prompt = NULL; + //lv_obj_set_hidden(watch_ext->label_prompt, true); + } + } + + #else + lv_heng_ai_bp_measure_ext_t * watch_ext = (lv_heng_ai_bp_measure_ext_t *)mmi_heng_ai_bp_measure_screen_ext_get(); if(NULL == watch_ext) return; @@ -710,6 +1052,7 @@ void mmi_hengai_bp_measure_cycle_timeout(void * para) MMI_BP_MEASURE_TOTAL_COUNT % 60); lv_label_set_text(watch_ext->label_time, time_str); lv_obj_align(watch_ext->label_time, NULL, LV_ALIGN_IN_TOP_MID, 0, 292); + #endif } } @@ -756,6 +1099,21 @@ void mmi_hengai_bp_measure_start_btn_event_cb(lv_obj_t * obj, lv_event_t e) __hengai_data_send_per_5s_action(); #endif + #ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_init(); + + lv_obj_t * line = mmi_hengai_bp_measure_line_create(cont); + watch_ext->line = line; + + lv_obj_t * label_prompt = lv_label_create(cont, NULL); + lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font36); + lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER); + lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_IN_MEASURE_PROMPT); + lv_obj_align(label_prompt, NULL, LV_ALIGN_CENTER, 0, -10); + lv_obj_set_click(label_prompt, false); + watch_ext->label_prompt = label_prompt; + + #else lv_obj_t * label_title = lv_label_create(watch_ext->cont, NULL); lv_obj_add_style(label_title, LV_LABEL_PART_MAIN, &lv_watch_font32); @@ -790,6 +1148,7 @@ void mmi_hengai_bp_measure_start_btn_event_cb(lv_obj_t * obj, lv_event_t e) lv_label_set_text_id(label, WATCH_TEXT_ID_IN_MEASURE_PROMPT); lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 324 + 30); lv_obj_set_click(label, false); + #endif /* start timer (1 min) */ watch_ext->measure_timer_id = Hal_Timer_Start(1000, mmi_hengai_bp_measure_cycle_timeout, NULL, true); @@ -1026,6 +1385,10 @@ void mmi_heng_ai_bp_calibrate_screen_prepare_destory(lv_obj_t * activity_obj) Hal_Timer_Stop(watch_ext->result_timer_id); watch_ext->result_timer_id = NULL; } + +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif } void mmi_heng_ai_bp_calibrate_screen_clean(void) @@ -1177,6 +1540,10 @@ void mmi_hengai_bp_calibrate_finish_screen(void) lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292); #endif +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif + HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); watch_ext->result_timer_id = Hal_Timer_Start(MMI_BP_WAIT_RESULT_TIMEOUT, mmi_hengai_bp_calibrate_result_timeout, NULL, false); @@ -1514,6 +1881,10 @@ void mmi_hengai_bp_calibrate_end_screen(void) lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_CALIBRATE_PROMPT_3); lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_TOP_MID, 0, 292); // 104); +#ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_deinit(); +#endif + // s_hengai_bp_calibrate_times++; mmi_hengai_bp_raw_data_fill(); @@ -1549,6 +1920,27 @@ void mmi_hengai_bp_calibrate_cycle_timeout(void * para) { mmi_hengai_bp_calibrate_end_screen(); } + else + { + #ifdef __BP_MEASURING_REAL_TIME_UI__ + s_update_counter++; + if(BP_DATA_SECOND_NUM <= s_update_counter) + { + s_update_counter = 0; + + lv_heng_ai_bp_calibrate_ext_t * watch_ext = (lv_heng_ai_bp_calibrate_ext_t *)mmi_heng_ai_bp_calibrate_screen_ext_get(); + if(NULL == watch_ext) + return; + + int ret = mmi_hengai_bp_measure_line_update(watch_ext->line); + if(0 == ret && NULL != watch_ext->label_prompt) + { + lv_obj_del(watch_ext->label_prompt); + watch_ext->label_prompt = NULL; + } + } + #endif + } } void mmi_heng_ai_bp_calibrate_start_screen(void) @@ -1580,6 +1972,24 @@ void mmi_heng_ai_bp_calibrate_start_screen(void) mmi_hengai_bp_measuring_flag_set(true); s_hengai_bp_measure_count = 0; + #ifdef __BP_MEASURING_REAL_TIME_UI__ + mmi_hengai_bp_measure_ui_data_init(); + + mmi_hengai_bp_measure_ui_data_init(); + + lv_obj_t * line = mmi_hengai_bp_measure_line_create(watch_ext->cont); + watch_ext->line = line; + + lv_obj_t * label_prompt = lv_label_create(watch_ext->cont, NULL); + lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font36); + lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER); + lv_label_set_text_id(label_prompt, (0 == s_hengai_bp_calibrate_times) ? WATCH_TEXT_ID_IN_CALIBRATE_PROMPT_FIRST : WATCH_TEXT_ID_IN_CALIBRATE_PROMPT_SECOND); + lv_obj_align(label_prompt, NULL, LV_ALIGN_CENTER, 0, -10); + lv_obj_set_click(label_prompt, false); + watch_ext->label_prompt = label_prompt; + + #else + lv_obj_t * label_title = lv_label_create(watch_ext->cont, NULL); lv_obj_add_style(label_title, LV_LABEL_PART_MAIN, &lv_watch_font32); lv_label_set_align(label_title, LV_LABEL_ALIGN_CENTER); @@ -1607,6 +2017,7 @@ void mmi_heng_ai_bp_calibrate_start_screen(void) lv_label_set_text_id(label, WATCH_TEXT_ID_NEED_ONE_MINUTE); lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 348); lv_obj_set_click(label, false); + #endif /* start timer (1 min) */ watch_ext->measure_timer_id = Hal_Timer_Start(1000, mmi_hengai_bp_calibrate_cycle_timeout, NULL, true); @@ -2349,7 +2760,7 @@ static void mmi_hengai_micro_health_checkup_data_send(void) } data_len += sprintf(data_ptr + data_len, "%d", s_hengai_ppg_data_ptr[i]); - cplog_printf("[@CHENG_DEBUG][%s][%d]: s_hengai_ppg_data_len=%d,data_len=%d\n", __FUNCTION__, __LINE__, s_hengai_ppg_data_len, data_len); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: s_hengai_ppg_data_len=%d,data_len=%d\n", __FUNCTION__, __LINE__, s_hengai_ppg_data_len, data_len); mmi_protocol_fzd_action_ppg_data(data_ptr, data_len); if(NULL != data_ptr) @@ -2393,7 +2804,7 @@ void mmi_hengai_micro_health_checkup_process(void) void mmi_hengai_micro_health_checkup_stop(void) { - cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); if(NULL != s_hengai_ppg_data_ptr) { @@ -2407,7 +2818,7 @@ void mmi_hengai_micro_health_checkup_stop(void) void mmi_hengai_micro_health_checkup_start(void) { - cplog_printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); if(NULL != s_hengai_ppg_data_ptr) { diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.h b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.h index 5fd34fcd..a4e58f89 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_blood_pressure.h @@ -18,6 +18,8 @@ extern "C" { #ifdef __MMI_CUSTOM_HENGAI_HEALTH__ +// measuring ui real time display +#define __BP_MEASURING_REAL_TIME_UI__ ///#define __PPG_DATA_TEST_SEND__ // just for hengai test #ifdef __PPG_DATA_TEST_SEND__ @@ -71,6 +73,15 @@ typedef struct TIMER_ID measure_timer_id; TIMER_ID result_timer_id; bool is_watting_result; + +#ifdef __BP_MEASURING_REAL_TIME_UI__ +#ifdef __CHART_DEBUG__ + lv_obj_t * chart; + lv_chart_series_t * ser; +#endif + lv_obj_t * line; + lv_obj_t * label_prompt; +#endif } lv_heng_ai_bp_measure_ext_t; @@ -88,6 +99,11 @@ typedef struct TIMER_ID measure_timer_id; TIMER_ID result_timer_id; bool is_watting_result; + +#ifdef __BP_MEASURING_REAL_TIME_UI__ + lv_obj_t * line; + lv_obj_t * label_prompt; +#endif } lv_heng_ai_bp_calibrate_ext_t; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c index 3253ec29..1a973512 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.c @@ -1100,7 +1100,7 @@ FREE_AND_EXIT: void mmi_hengai_tcp_health_lib_activation_check_action(void) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); if(0 == mmi_hengai_health_lib_activated_flag_get()) { @@ -1198,14 +1198,14 @@ void mmi_hengai_tcp_health_lib_activation_check_action(void) else { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); } } void mmi_hengai_tcp_algorithm_interface_login_action(void) { HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); char * token = mmi_hengai_health_token_get(); if(0 == strlen(token)) @@ -1375,7 +1375,7 @@ bool mmi_hengai_health_data_parse(unsigned char * next_buff, unsigned int next_b //HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", t_decode_str + 180); //HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG]: %s\n", t_decode_str + 270); //mmi_debug_info_write_to_file("C:/data_parse.txt", t_decode_str, strlen(t_decode_str)); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, t_decode_str); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%d]: %s\n", __LINE__, t_decode_str); cJSON * json_recv = cJSON_Parse(t_decode_str); if(NULL != json_recv) @@ -2452,7 +2452,7 @@ void mmi_hengai_health_lib_act_code_set(char * act_code) */ int ret = HA_lib_activate(act_code); HENGAI_HEALTH_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); if(ret) { #ifdef __MMI_CUSTOM_HENGAI_HEALTH_UPLOAD_USE_TCP__ diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h index 01547f5d..b81fda8f 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_http_protocol.h @@ -25,10 +25,10 @@ extern "C" { #define HENGAI_HEALTH_DEBUG_PRINTF(fmt, ...) #endif -#if 10 -#define UART_DEBUG_PRINTF(fmt, ...) cplog_printf(fmt, ##__VA_ARGS__) +#if 0 +#define HENGAI_HEALTH_UART_LOG(fmt, ...) cplog_printf(fmt, ##__VA_ARGS__) #else -#define UART_DEBUG_PRINTF(fmt, ...) +#define HENGAI_HEALTH_UART_LOG(fmt, ...) #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c index b8ff214d..b86973f4 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c @@ -385,7 +385,7 @@ static bool mmi_hengai_k18_sleep_data_send(void) } temp_len = strlen(temp_buff); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: buff_size=%d,temp_len=%d\n", __FUNCTION__, __LINE__, buff_size, temp_len); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: buff_size=%d,temp_len=%d\n", __FUNCTION__, __LINE__, buff_size, temp_len); mmi_protocol_fzd_action_sleep_data(temp_buff, temp_len); if(NULL != temp_buff) @@ -412,7 +412,7 @@ static void mmi_hengai_k18_sleep_data_get(void) int result = 0; result = get_sleep_time(s_hengai_sleep_gsensor_data, HENGAI_SLEEP_GSENSOR_DATA_MAX, curtime, &s_hengai_sdata); printf("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result); if(1 == result) { mmi_hengai_k18_sleep_data_send(); @@ -474,7 +474,7 @@ void mmi_hengai_k18_get_sleep_data_cb(uint32_t para) void mmi_hengai_get_sleep_data_start(void) { printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); mmi_hengai_k18_sleep_task_create(); @@ -517,19 +517,19 @@ void mmi_hengai_health_sleep_lib_active(void) { char * req_code = mmi_hengai_health_lib_req_code_get(); printf("[@CHENG_DEBUG][%s][%d]: req_code=%s\n", __FUNCTION__, __LINE__, req_code); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: req_code=%s\n", __FUNCTION__, __LINE__, req_code); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: req_code=%s\n", __FUNCTION__, __LINE__, req_code); if(NULL == req_code) return; char * act_code = mmi_hengai_health_lib_act_code_get(); printf("[@CHENG_DEBUG][%s][%d]: act_code=%s\n", __FUNCTION__, __LINE__, act_code); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: act_code=%s\n", __FUNCTION__, __LINE__, act_code); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: act_code=%s\n", __FUNCTION__, __LINE__, act_code); if(NULL == act_code) return; int ret = activate_algorithm((unsigned char *)req_code, strlen(req_code), (unsigned char *)act_code, strlen(act_code)); printf("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); if(ret) { mmi_hengai_health_sleep_activated_flag_set(1); @@ -569,7 +569,7 @@ void mmi_hengai_sleep_data_set(sleep_data_t * data) // (nv_watch_hengai_sleep_da if(false == s_sleep_data_in_same_cycle) { - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); s_sleep_data_in_same_cycle = true; @@ -590,7 +590,7 @@ void mmi_hengai_sleep_data_set(sleep_data_t * data) // (nv_watch_hengai_sleep_da } else { - UART_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); s_hengai_sleep_data.total_sleep_time += data->total_sleep_time; //_lv_memcpy(&(s_hengai_sleep_data.end_sleep_time), &(data->end_sleep_time), sizeof(nv_sleep_time_t)); diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c b/2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c index 86df89df..8ed326c7 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c @@ -309,6 +309,11 @@ static void sms_msg_write_nvm_for_test(void) #ifdef __MMI_ZHSX_SUPPORT__ +static void mmi_sms_vib_prompt_task_cb(lv_task_t * task) +{ + Hal_Vibrator_Play_End(); +} + void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info) { if(sms_info == NULL) @@ -407,6 +412,8 @@ void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info) if(true == mmi_watch_vibrate_is_permitted()) { Hal_Vibrator_Play_Onetime(NULL, 800); + lv_task_t * task_ptr = lv_task_create(mmi_sms_vib_prompt_task_cb, 900, LV_TASK_PRIO_MID, NULL); + lv_task_once(task_ptr); } #endif