From: CCC <2393524978@qq.com> Date: Wed, 15 Nov 2023 08:01:26 +0000 (+0800) Subject: gengxin X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=a9d6ac54bb5d7369630733f6599018f5a0e1a035;p=mirrors%2FASR3603_Z5.git gengxin --- diff --git a/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h b/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h index 3c395146..4b344b6b 100644 --- a/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h +++ b/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h @@ -38,7 +38,9 @@ extern "C" { #ifdef __MMI_WECHAT_SUPPORT__ #define NV_SECTION_UI_WEHAT_MSG_LEN (sizeof(nv_watch_wechat_msg_info_t)) #endif +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ #define NV_SECTION_UI_HEALTH_MEASURE_LEN (sizeof(nv_watch_health_measure_timed_t)) +#endif #define NV_SECTION_UI_PROTOCOL_DATA_LEN (sizeof(nv_watch_protocol_data_t)) #define NV_SECTION_UI_HEALTH_INFO_LEN (sizeof(nv_watch_health_info_t)) #define NV_SECTION_UI_SOS_NUMBER_LEN (sizeof(nv_watch_sos_number_t)) @@ -147,7 +149,9 @@ typedef lv_fs_dir_t ui_dir_t; #ifdef __MMI_WECHAT_SUPPORT__ #define NV_SECTION_UI_WEHAT_MSG_FILE "ui_wechat_msg.nv" #endif +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ #define NV_SECTION_UI_HEALTH_MEASURE_FILE "ui_health_measure.nv" +#endif #define NV_SECTION_UI_PROTOCOL_DATA_FILE "ui_protocol_data.nv" #define NV_SECTION_UI_HEALTH_INFO_FILE "ui_health_info.nv" #define NV_SECTION_UI_SOS_NUMBER_FILE "ui_sos_number.nv" diff --git a/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c b/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c index 2e8f4abc..cb4c3fbf 100644 --- a/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c +++ b/2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c @@ -76,8 +76,10 @@ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId) case NV_SECTION_UI_WEHAT_MSG: return (NV_SECTION_LEN(NV_SECTION_UI_WEHAT_MSG)); #endif + #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ case NV_SECTION_UI_HEALTH_MEASURE: return (NV_SECTION_LEN(NV_SECTION_UI_HEALTH_MEASURE)); + #endif case NV_SECTION_UI_PROTOCOL_DATA: return (NV_SECTION_LEN(NV_SECTION_UI_PROTOCOL_DATA)); case NV_SECTION_UI_HEALTH_INFO: @@ -193,8 +195,10 @@ char * UI_NV_Get_Section_path(NV_UI_SECTION_ID SectionId) case NV_SECTION_UI_WEHAT_MSG: return (NV_SECTION_FILE_PATH(NV_SECTION_UI_WEHAT_MSG)); #endif + #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ case NV_SECTION_UI_HEALTH_MEASURE: return (NV_SECTION_FILE_PATH(NV_SECTION_UI_HEALTH_MEASURE)); + #endif case NV_SECTION_UI_PROTOCOL_DATA: return (NV_SECTION_FILE_PATH(NV_SECTION_UI_PROTOCOL_DATA)); case NV_SECTION_UI_HEALTH_INFO: @@ -276,7 +280,9 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) #ifdef __MMI_WECHAT_SUPPORT__ nv_watch_wechat_msg_info_t * wechat_msg; #endif +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ nv_watch_health_measure_timed_t * health_measure; +#endif nv_watch_protocol_data_t * protocol_data; nv_watch_health_info_t * health_info; nv_watch_sos_number_t * sos_number; @@ -457,12 +463,14 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) break; #endif + #ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ case NV_SECTION_UI_HEALTH_MEASURE: health_measure = lv_mem_alloc(SectionLen); memset(health_measure, 0x0, SectionLen); mmi_health_measure_timed_info_nv_default(health_measure); TempData = (char *)health_measure; break; + #endif case NV_SECTION_UI_PROTOCOL_DATA: protocol_data = lv_mem_alloc(SectionLen); diff --git a/2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h b/2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h index 0e120edc..72bb08e0 100644 --- a/2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h +++ b/2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h @@ -193,7 +193,7 @@ typedef struct } __packed nv_watch_wechat_msg_info_t; #endif - +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ typedef struct { uint8_t heart_timed_flag; // 0-close; 1-open @@ -205,6 +205,7 @@ typedef struct uint8_t spo2_timed_flag; // 0-close; 1-open uint32_t spo2_timed_interval; // unit-second } __packed nv_watch_health_measure_timed_t; +#endif #define NV_WATCH_HOST_NAME_LEN_MAX (128 - 32) #define NV_PROTOCOL_MD5_KEY_LEN_MAX (64) @@ -488,7 +489,9 @@ enum #ifdef __MMI_WECHAT_SUPPORT__ NV_SECTION_UI_WEHAT_MSG, // nv_watch_wechat_msg_info_t #endif +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ NV_SECTION_UI_HEALTH_MEASURE, // nv_watch_health_measure_timed_t +#endif NV_SECTION_UI_PROTOCOL_DATA, // nv_watch_protocol_data_t NV_SECTION_UI_HEALTH_INFO, // nv_watch_health_info_t NV_SECTION_UI_SOS_NUMBER, // nv_watch_sos_number_t diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c index d11fa02b..064a28ef 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c @@ -106,7 +106,7 @@ static void health_heart_rate_measure_cycle_timeout(void * para) } else { - if(MMI_HEALTH_MEASURE_STATE_UI == mmi_health_measure_state_get()) + if(true == mmi_health_measure_state_is_ui_measure()) { uint16_t value = 0; @@ -287,5 +287,16 @@ void health_heart_rate_create_event_cb(lv_obj_t * btn, lv_event_t e) } } +void mmi_health_heart_rate_screen_clean(void) +{ + lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HEALTH_MEASURE_HEART); + if(NULL != activity_obj) + { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + health_heart_rate_prepare_destory(NULL); + lv_obj_del(activity_obj); + } +} + #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h index c78c7e99..874d910a 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h @@ -98,9 +98,8 @@ typedef struct } lv_heart_rate_obj_ext_t; - void health_heart_rate_create_event_cb(lv_obj_t * btn, lv_event_t e); - +void mmi_health_heart_rate_screen_clean(void); #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c index b3a57410..f48dfc17 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c @@ -3,7 +3,7 @@ #include "lv_watch.h" -#ifdef __MMI_ZHSX_SUPPORT__ +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ static nv_watch_health_measure_timed_t s_health_measure_timed_data = {0}; @@ -11,10 +11,10 @@ static lv_ll_t s_health_measure_timed_ll = {0}; static lv_health_measure_run_t s_health_measure_run_data = {0}; static void * s_health_measure_process_timer_id = NULL; static uint8_t s_measure_time_total = 0, s_measure_time_count = 0; -static uint32_t s_health_measure_heart_timed_time_stamp = 0, s_health_measure_temperature_timed_time_stamp = 0, - s_health_measure_blood_timed_time_stamp = 0, s_health_measure_spo2_timed_time_stamp = 0; - -static void mmi_health_measure_process_timer_handle(uint32_t para); +static uint32_t s_health_measure_heart_timed_time_stamp = 0; +static uint32_t s_health_measure_temperature_timed_time_stamp = 0; +static uint32_t s_health_measure_blood_timed_time_stamp = 0; +static uint32_t s_health_measure_spo2_timed_time_stamp = 0; void mmi_hsensor_close(void) @@ -46,17 +46,17 @@ bool mmi_hsensor_is_open(void) return true; } -static void mmi_hsensor_heart_value_get(uint16_t * heart_value) +void mmi_hsensor_heart_value_get(uint16_t * heart_value) { mmi_hsensor_measure_value_get(heart_value, NULL, NULL, NULL); } -static void mmi_hsensor_blood_value_get(uint16_t * blood_high_value, uint16_t * blood_low_value) +void mmi_hsensor_blood_value_get(uint16_t * blood_high_value, uint16_t * blood_low_value) { mmi_hsensor_measure_value_get(NULL, blood_high_value, blood_low_value, NULL); } -static void mmi_hsensor_spo2_value_get(uint16_t * spo2_value) +void mmi_hsensor_spo2_value_get(uint16_t * spo2_value) { mmi_hsensor_measure_value_get(NULL, NULL, NULL, spo2_value); } @@ -78,12 +78,12 @@ bool mmi_tsensor_is_open(void) return true; } -static void mmi_tsensor_wrist_value_get(float * wrist_value) +void mmi_tsensor_wrist_value_get(float * wrist_value) { // } -static void mmi_tsensor_body_value_get(float * body_value) +void mmi_tsensor_body_value_get(float * body_value) { * body_value = mmi_tsensor_body_temperature_get(); } @@ -98,14 +98,19 @@ bool mmi_health_measure_wear_state_get(void) return is_wear; } -MMI_HEALTH_MEASURE_STATE_E mmi_health_measure_state_get(void) +bool mmi_health_measure_state_is_ui_measure(void) { - return s_health_measure_run_data.measure_state; + if(MMI_HEALTH_MEASURE_STATE_UI == s_health_measure_run_data.measure_state) + return true; + + return false; } -bool mmi_health_measure_state_is_ui_measure(void) +bool mmi_health_measure_state_is_back_measure(void) { - if(MMI_HEALTH_MEASURE_STATE_UI == s_health_measure_run_data.measure_state) + if(MMI_HEALTH_MEASURE_STATE_APP == s_health_measure_run_data.measure_state + || MMI_HEALTH_MEASURE_STATE_TIMED == s_health_measure_run_data.measure_state + ) return true; return false; @@ -284,6 +289,8 @@ void mmi_health_measure_timed_list_node_add(MMI_HEALTH_MEASURE_TYPE_E measure_ty static bool mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_TYPE_E measure_type) { + bool result = false; + if(true == _lv_ll_is_empty(&s_health_measure_timed_ll)) return false; @@ -291,17 +298,13 @@ static bool mmi_health_measure_timed_list_trigger(MMI_HEALTH_MEASURE_TYPE_E meas if(NULL == node) return false; - lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_TEST); - if(NULL != activity_obj) - return false; - HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d,%d\n", __FUNCTION__, __LINE__, measure_type, * node); if(measure_type != * node) return false; - mmi_health_measure_timed_measure_start(* node); - return true; + result = mmi_health_measure_timed_measure_start(* node); + return result; } void mmi_health_measure_timed_time_stamp_set(MMI_HEALTH_MEASURE_TYPE_E measure_type, uint32_t time_stamp) @@ -649,7 +652,10 @@ void mmi_health_measure_process_finish(void) static void mmi_health_measure_process_timer_handle(uint32_t para) { - if(false == mmi_health_measure_wear_state_get()) + if(false == mmi_health_measure_wear_state_get() + || (NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_MAIN)) + || (NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_TEST)) + ) { HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: should not run to here\n", __FUNCTION__, __LINE__); mmi_health_measure_interrupt(); @@ -765,8 +771,14 @@ static void mmi_health_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type, uin uos_timer_start(s_health_measure_process_timer_id, MS_TO_TICKS(MMI_HEALTH_MEASURE_CYCLE_DURATION), 0, mmi_health_measure_process_timer_handle, NULL); } -void mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type) +bool mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type) { + if(NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_MAIN)) + return false; + + if(NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_TEST)) + return false; + if(MMI_HEALTH_MEASURE_STATE_UI == s_health_measure_run_data.measure_state || MMI_HEALTH_MEASURE_STATE_APP == s_health_measure_run_data.measure_state || MMI_HEALTH_MEASURE_STATE_TIMED == s_health_measure_run_data.measure_state @@ -779,20 +791,23 @@ void mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_ty HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: type=%d\n", __FUNCTION__, __LINE__, measure_type); - return; + return false; } _lv_memset_00(&s_health_measure_run_data, sizeof(s_health_measure_run_data)); s_health_measure_run_data.measure_state = MMI_HEALTH_MEASURE_STATE_TIMED; mmi_health_measure_start(measure_type, 0); + return true; } void mmi_health_measure_app_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type) { HEALTH_MEASURE_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_TEST); - if(NULL != activity_obj) + if(NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_MAIN)) + return; + + if(NULL != lv_watch_get_activity_obj(ACT_ID_FACTORY_MODE_TEST)) return; if(MMI_HEALTH_MEASURE_STATE_UI == s_health_measure_run_data.measure_state) @@ -831,5 +846,12 @@ void mmi_health_measure_ui_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type) mmi_health_measure_start(measure_type, 0); } +void mmi_health_measure_factory_mode_clean(void) +{ + if(true == mmi_health_measure_state_is_back_measure()) + { + mmi_health_measure_interrupt(); + } +} #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h index 3119625c..103d19f5 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h @@ -16,7 +16,7 @@ extern "C" { #include "../../../lv_ex_conf.h" #endif -#ifdef __MMI_ZHSX_SUPPORT__ +#ifdef __MMI_ZHSX_SUPPORT_HEALTH_SENSOR__ #define __HEALTH_MEASURE_DEBUG__ #ifdef __HEALTH_MEASURE_DEBUG__ @@ -67,8 +67,22 @@ typedef struct }lv_health_measure_run_t; +void mmi_hsensor_close(void); +void mmi_hsensor_heart_open(void); +void mmi_hsensor_blood_open(void); +void mmi_hsensor_spo2_open(void); +//bool mmi_hsensor_is_open(void); +void mmi_hsensor_heart_value_get(uint16_t * heart_value); +void mmi_hsensor_blood_value_get(uint16_t * blood_high_value, uint16_t * blood_low_value); +void mmi_hsensor_spo2_value_get(uint16_t * spo2_value); +void mmi_tsensor_close(void); +void mmi_tsensor_open(void); +//bool mmi_tsensor_is_open(void); +//void mmi_tsensor_wrist_value_get(float * wrist_value); +void mmi_tsensor_body_value_get(float * body_value); + bool mmi_health_measure_wear_state_get(void); -MMI_HEALTH_MEASURE_STATE_E mmi_health_measure_state_get(void); +//MMI_HEALTH_MEASURE_STATE_E mmi_health_measure_state_get(void); bool mmi_health_measure_state_is_ui_measure(void); bool mmi_health_measure_heart_data_ui_get(uint16_t * heart_value); @@ -77,8 +91,9 @@ bool mmi_health_measure_blood_data_ui_get(uint16_t * blood_high_value, uint16_t bool mmi_health_measure_spo2_data_ui_get(uint16_t * spo2_value); void mmi_health_measure_interrupt(void); +void mmi_health_measure_factory_mode_clean(void); -void mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type); +bool mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type); void mmi_health_measure_app_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type); void mmi_health_measure_ui_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type); diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c index 1865876f..33850d52 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c @@ -108,7 +108,7 @@ static void health_spo2_measure_cycle_timeout(void * para) } else { - if(MMI_HEALTH_MEASURE_STATE_UI == mmi_health_measure_state_get()) + if(true == mmi_health_measure_state_is_ui_measure()) { uint16_t value = 0; @@ -287,5 +287,15 @@ void health_spo2_create_event_cb(lv_obj_t * btn, lv_event_t e) } } +void mmi_health_spo2_screen_clean(void) +{ + lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HEALTH_MEASURE_SPO2); + if(NULL != activity_obj) + { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + health_spo2_prepare_destory(NULL); + lv_obj_del(activity_obj); + } +} #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h index 652b7d41..19958b99 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h @@ -98,9 +98,8 @@ typedef struct } lv_spo2_obj_ext_t; - void health_spo2_create_event_cb(lv_obj_t * btn, lv_event_t e); - +void mmi_health_spo2_screen_clean(void); #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c index 847c2990..4c689ad7 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c @@ -108,7 +108,7 @@ static void health_temperature_measure_cycle_timeout(void * para) } else { - if(MMI_HEALTH_MEASURE_STATE_UI == mmi_health_measure_state_get()) + if(true == mmi_health_measure_state_is_ui_measure()) { float value = 0.0; @@ -290,6 +290,17 @@ void health_temperature_create_event_cb(lv_obj_t * btn, lv_event_t e) } } +void mmi_health_temperature_screen_clean(void) +{ + lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HEALTH_MEASURE_TEMPERATURE); + if(NULL != activity_obj) + { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + health_temperature_prepare_destory(NULL); + lv_obj_del(activity_obj); + } +} + #else lv_temperature_obj_ext_t * health_temperature_get_ext(void) diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h index c65c2f17..8d0ad741 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h @@ -141,7 +141,7 @@ typedef struct { void health_temperature_create_event_cb(lv_obj_t * btn, lv_event_t e); - +void mmi_health_temperature_screen_clean(void); #endif