From 686802b6c15edd999f37c7bbedf131dd977f4a8a Mon Sep 17 00:00:00 2001 From: CCC <2393524978@qq.com> Date: Fri, 5 May 2023 14:25:32 +0800 Subject: [PATCH] xiugai --- 2.sdk/gui/lv_watch/CMakeLists.txt | 4 +- 2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c | 15 +-- .../app_adaptor_sensor_interface.c | 63 ++++++++++ .../app_adaptor/app_adaptor_timing_control.c | 44 +++++++ .../gui/lv_watch/framework/language/lang_ch.c | 2 +- .../lv_watch/include/app_adaptor_interface.h | 11 +- .../lv_apps/factory_mode/factory_mode_reset.c | 50 ++++++++ .../lv_apps/health_measure/health_measure.c | 1 + .../gui/lv_watch/lv_apps/launcher/launcher.c | 6 +- .../restart_and_reset/restart_and_reset.c | 62 ++++++++++ 2.sdk/gui/lv_watch/lv_apps/weather/weather.c | 109 +++++++++--------- .../lv_objx/lv_watch_list/lv_watch_list.c | 2 +- 2.sdk/gui/lv_watch/lv_watch_res.h | 6 +- .../gui/lv_watch/mmi_location/mmi_location.c | 1 + .../lv_watch/mmi_protocol/mmi_protocol_api.c | 2 + .../lv_watch/mmi_protocol/mmi_protocol_fzd.c | 4 +- 2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c | 51 ++++++++ 2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h | 1 + .../resource/png/pedometer/icon_cancel.png | Bin 729 -> 0 bytes .../resource/png/pedometer/icon_ok.png | Bin 847 -> 0 bytes 20 files changed, 356 insertions(+), 78 deletions(-) delete mode 100644 2.sdk/gui/lv_watch/resource/png/pedometer/icon_cancel.png delete mode 100644 2.sdk/gui/lv_watch/resource/png/pedometer/icon_ok.png diff --git a/2.sdk/gui/lv_watch/CMakeLists.txt b/2.sdk/gui/lv_watch/CMakeLists.txt index 93de9eac..16868624 100644 --- a/2.sdk/gui/lv_watch/CMakeLists.txt +++ b/2.sdk/gui/lv_watch/CMakeLists.txt @@ -378,8 +378,8 @@ set(lv_watch_raw_alpha_resources png/pedometer/icon_goal.png png/pedometer/icon_bodyweight.png png/pedometer/icon_bodyheight.png - png/pedometer/icon_cancel.png - png/pedometer/icon_ok.png + #png/pedometer/icon_cancel.png + #png/pedometer/icon_ok.png png/pedometer/icon_cal.png png/pedometer/icon_step.png png/pedometer/icon_distance.png diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c index 44b06266..02023186 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c @@ -34,16 +34,14 @@ * GLOBAL FUNCTION **********************/ #ifdef __MMI_ZHSX_SUPPORT__ -static char city_buff[MMI_WEATHER_CITY_NAME_LEN_MAX] = {0}; static app_adaptor_weather_t s_weather_info = {0}; void mmi_weather_info_set(app_adaptor_weather_t * weather) { - s_weather_info.weather_id = weather->weather_id; - s_weather_info.current_temperature = weather->current_temperature; - s_weather_info.lowest_temperature = weather->lowest_temperature; - s_weather_info.highest_temperature = weather->highest_temperature; - _lv_memcpy(s_weather_info.city, weather->city, MMI_WEATHER_CITY_NAME_LEN_MAX); + if(0 != strlen(weather->city)) + { + _lv_memcpy(&s_weather_info, weather, sizeof(app_adaptor_weather_t)); + } } @@ -89,11 +87,14 @@ void mmi_health_info_set(nv_watch_health_info_t * health_info) void app_adaptor_get_weather_req(app_adaptor_weather_t * weather) { #ifdef __MMI_ZHSX_SUPPORT__ - s_weather_info.city = city_buff; if(0 != strlen(s_weather_info.city)) { _lv_memcpy(weather, &s_weather_info, sizeof(app_adaptor_weather_t)); } + else + { + _lv_memset_00(weather, sizeof(app_adaptor_weather_t)); + } #else static uint8_t dummy_read_count = 1; diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c index 6ceb441c..624c8f1e 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c @@ -56,6 +56,66 @@ void asl_sensor_id_check(void) /**************************Pedometer ********************/ +#ifdef __MMI_ZHSX_SUPPORT__ +static nv_watch_pedometer_step_t s_pedometer_data = {0}; +uint32_t s_sensor_last_steps = 0; + +uint8_t asl_pedometer_sensor_id_get(void) +{ + return 0; +} + +void asl_pedometer_poweron_on_init(void) +{ + hal_rtc_t today; + Hal_Rtc_Gettime(&today); + + nv_pedometer_step_data_get(&s_pedometer_data); + if (today.tm_mday != s_pedometer_data.date.tm_mday) + { + memset(&s_pedometer_data, 0x0, sizeof(nv_watch_pedometer_step_t)); + memcpy(&(s_pedometer_data.date), &today, sizeof(hal_rtc_t)); + nv_pedometer_step_data_save(&s_pedometer_data); + } +} + +uint32_t asl_pedometer_steps_get(void) +{ + return s_pedometer_data.step; +} + +void asl_pedometer_steps_save(void) +{ + hal_rtc_t date = {0}; + uint32_t steps = get_xmotion_steps(); + + Hal_Rtc_Gettime(&date); + memcpy(&(s_pedometer_data.date), &date, sizeof(hal_rtc_t)); + + printf("[@CHENG_DEBUG][%s][%d]: %d,%d,%d\n", __FUNCTION__, __LINE__, s_pedometer_data.step, steps, s_sensor_last_steps); + + s_pedometer_data.step += steps - s_sensor_last_steps; + s_sensor_last_steps = steps; + + nv_pedometer_step_data_save(&s_pedometer_data); +} + +void asl_pedometer_steps_clear(void) +{ + s_sensor_last_steps = 0; + memset(&s_pedometer_data, 0x0, sizeof(nv_watch_pedometer_step_t)); + nv_pedometer_step_data_save(&s_pedometer_data); + + hal_xmotion_steps_clear(); +} + +void asl_pedometer_xyz_get(int16_t *x, int16_t *y, int16_t *z) +{ + return ; +} + +#else + uint8_t asl_pedometer_sensor_id_get(void) { #if USE_BT_SENSOR_HUB @@ -131,6 +191,9 @@ void asl_pedometer_xyz_get(int16_t *x, int16_t *y, int16_t *z) #endif } +#endif + + /********************************hr_bp_bo **********************/ #if 0 uint16_t asl_HeartRate_hr_value_get(void) diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c index 930046ed..6438f46a 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c @@ -11,6 +11,47 @@ #include #include "app_adaptor_timing_control.h" +#ifdef __MMI_ZHSX_SUPPORT__ + +static void * timing_control_timer = NULL; +static uint8_t s_step_clear_flag = 0; + +#define TIMING_TIMER_INTERVAL (20 * 1000) // ms + +static void timing_timer_callback(uint32_t param) +{ + hal_rtc_t time; + + Hal_Rtc_Gettime(&time); + + printf("[@CHENG_DEBUG][%s][%d]: %d,%d,%d\n", __FUNCTION__, __LINE__, time.tm_hour, time.tm_min, time.tm_sec); + + if(0 == time.tm_min && 0 == time.tm_hour) + { + if(0 == s_step_clear_flag) + { + s_step_clear_flag = 1; + asl_pedometer_steps_clear(); + } + } + else + { + s_step_clear_flag = 0; + } + + asl_pedometer_steps_save(); + + uos_timer_stop(timing_control_timer); + uos_timer_start(timing_control_timer, MS_TO_TICKS(TIMING_TIMER_INTERVAL), 0, timing_timer_callback, NULL); +} + +void app_adaptor_timing_control_init(void) +{ + uos_timer_create(&timing_control_timer); + uos_timer_start(timing_control_timer, MS_TO_TICKS(TIMING_TIMER_INTERVAL), 0, timing_timer_callback, NULL); +} + +#else /********************** * TYPEDEFS @@ -108,3 +149,6 @@ void app_adaptor_timing_control_init(void) return; } + +#endif + diff --git a/2.sdk/gui/lv_watch/framework/language/lang_ch.c b/2.sdk/gui/lv_watch/framework/language/lang_ch.c index 0b080e01..eec95d59 100644 --- a/2.sdk/gui/lv_watch/framework/language/lang_ch.c +++ b/2.sdk/gui/lv_watch/framework/language/lang_ch.c @@ -63,7 +63,7 @@ const void * lang_text_ch[] = { "VoLTE业务未开通,请检查SIM卡并且当前网络已支持VoLTE", /*weather.c*/ - "无法获取数据, 请稍侯", + "暂无数据, 请稍侯", "晴", "多云", "小雨", diff --git a/2.sdk/gui/lv_watch/include/app_adaptor_interface.h b/2.sdk/gui/lv_watch/include/app_adaptor_interface.h index e5e7d14d..7b342e53 100644 --- a/2.sdk/gui/lv_watch/include/app_adaptor_interface.h +++ b/2.sdk/gui/lv_watch/include/app_adaptor_interface.h @@ -21,6 +21,10 @@ extern "C" { #if USE_LV_WATCH_APP_ADAPTOR != 0 +#ifdef __MMI_ZHSX_SUPPORT__ +#define MMI_WEATHER_CITY_NAME_LEN_MAX (64) +#endif + enum { WATCH_WEATHER_ID_SUNNY = 0, @@ -52,7 +56,11 @@ typedef struct int8_t highest_temperature; uint8_t uv; uint16_t aqi; +#ifdef __MMI_ZHSX_SUPPORT__ + char city[MMI_WEATHER_CITY_NAME_LEN_MAX]; +#else char *city; +#endif } app_adaptor_weather_t; enum { @@ -384,11 +392,8 @@ typedef struct #ifdef __MMI_ZHSX_SUPPORT__ #include "ui_nvm_interface.h" -#define MMI_WEATHER_CITY_NAME_LEN_MAX (64) - void mmi_weather_info_set(app_adaptor_weather_t * weather); - void mmi_health_info_get(nv_watch_health_info_t * health_info); void mmi_health_info_set(nv_watch_health_info_t * health_info); #endif diff --git a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c index b9053b5d..e29eb684 100644 --- a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c +++ b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c @@ -41,6 +41,55 @@ static void factoryreset_no_btn_event_cb(lv_obj_t * btn, lv_event_t e); /********************** * GLOBAL FUNCTIONS ***********************/ +#ifdef __MMI_ZHSX_SUPPORT__ +lv_obj_t * factorymode_reset_create(lv_obj_t * activity_obj) +{ + if(NULL == activity_obj) + { + lv_watch_activity_ext_t activity_ext; + memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t)); + activity_ext.actId = ACT_ID_FACTORY_MODE_RESET; + activity_ext.create = factorymode_reset_create; + activity_ext.prepare_destory = factorymode_reset_prepare_destory; + activity_obj = lv_watch_creat_activity_obj(&activity_ext); + if(NULL == activity_obj) + return NULL; + } + + lv_obj_t * obj = lv_watch_obj_create(activity_obj); + if(NULL == obj) + return NULL; + + lv_obj_t * label = lv_label_create(obj, NULL); + lv_obj_set_size(label, LV_HOR_RES, LV_VER_RES / 6); + lv_label_set_text_id(label, WATCH_TEXT_ID_FACTORY_RESET); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 25); + + lv_obj_t * label_tip = lv_label_create(obj, NULL); + lv_label_set_text_id(label_tip, WATCH_TEXT_ID_FACTORY_RESET_Q); + lv_label_set_long_mode(label_tip, LV_LABEL_LONG_BREAK); + lv_obj_set_width(label_tip, LV_HOR_RES * 3 / 4); + lv_obj_align(label_tip, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); + lv_obj_add_style(label_tip, LV_LABEL_PART_MAIN, &lv_watch_font26); + + lv_obj_t * btn_yes = lv_imgbtn_create(obj, NULL); + lv_imgbtn_set_src(btn_yes, LV_BTN_STATE_RELEASED, ICON_OK); + lv_imgbtn_set_src(btn_yes, LV_BTN_STATE_PRESSED, ICON_OK); + lv_obj_align(btn_yes, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 20, -20); + lv_obj_set_event_cb(btn_yes, factoryreset_yes_btn_event_cb); + lv_watch_obj_add_element(btn_yes); + + lv_obj_t * btn_no = lv_imgbtn_create(obj, NULL); + lv_imgbtn_set_src(btn_no, LV_BTN_STATE_RELEASED, ICON_CANCEL); + lv_imgbtn_set_src(btn_no, LV_BTN_STATE_PRESSED, ICON_CANCEL); + lv_obj_align(btn_no, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -20, -20); + lv_obj_set_event_cb(btn_no, factoryreset_no_btn_event_cb); + lv_watch_obj_add_element(btn_no); + + return obj; +} +#else lv_obj_t * factorymode_reset_create(lv_obj_t * activity_obj) { lv_obj_t * obj; @@ -92,6 +141,7 @@ lv_obj_t * factorymode_reset_create(lv_obj_t * activity_obj) return obj; } +#endif /********************** * STATIC FUNCTIONS diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c index b7e96ebf..683e35a0 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c @@ -641,6 +641,7 @@ static void mmi_health_measure_process_timer_handle(uint32_t para) break; } + uos_timer_stop(s_health_measure_process_timer_id); 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); } } diff --git a/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c b/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c index 4e355ad1..58752713 100644 --- a/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c +++ b/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c @@ -49,7 +49,7 @@ static void launcher_drop_pull_prepare_destory(lv_obj_t * activity_obj); **********************/ static lv_signal_cb_t ancestor_launcher_tileview_scrl_signal; static lv_point_t * menu_valid_pos = NULL; -static const lv_point_t dp_valid_pos[] = {{0, 0}, {1, 0}, {2, 0}}; +//static const lv_point_t dp_valid_pos[] = {{0, 0}, {1, 0}, {2, 0}}; /********************** * MACROS **********************/ @@ -599,7 +599,7 @@ static void launcher_drop_down_bar_create(lv_obj_t * activity_obj) ext->leds[1] = NULL; ext->leds[2] = NULL; - lv_tileview_set_valid_positions(tileview, dp_valid_pos, 3); + //lv_tileview_set_valid_positions(tileview, dp_valid_pos, 3); lv_tileview_set_edge_flash(tileview, true); lv_tileview_set_anim_time(tileview, 50); lv_tileview_set_tab_switch_limit(tileview, 60); @@ -799,7 +799,7 @@ static lv_obj_t * sport_create(lv_obj_t * activity_obj) ext->leds[2] = NULL; ext->pedometer_dot = NULL; ext->pull_up_start = 0; - lv_tileview_set_valid_positions(tileview, dp_valid_pos, 3); + //lv_tileview_set_valid_positions(tileview, dp_valid_pos, 3); lv_tileview_set_edge_flash(tileview, true); lv_tileview_set_anim_time(tileview, 60); lv_page_set_scrollbar_mode(tileview, LV_SCROLLBAR_MODE_OFF); diff --git a/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c b/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c index df9b8c34..fa45ce0a 100644 --- a/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c +++ b/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c @@ -126,6 +126,67 @@ void restart_and_reset_create_btn_action(lv_obj_t * btn, lv_event_t event) if(obj == NULL) return; } +#ifdef __MMI_ZHSX_SUPPORT__ +lv_obj_t * restart_create(lv_obj_t * activity_obj) +{ + lv_obj_t * obj; + lv_obj_t * label; + lv_obj_t * label_tip; + lv_obj_t * content; + lv_obj_t * btn_no; + lv_obj_t * btn_yes; + + if(NULL == activity_obj) + { + lv_watch_activity_ext_t activity_ext; + memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t)); + activity_ext.actId = ACT_ID_RESTART; + activity_ext.create = restart_create; + activity_ext.prepare_destory = restart_prepare_destory; + activity_obj = lv_watch_creat_activity_obj(&activity_ext); + if(NULL == activity_obj) + return NULL; + } + + obj = lv_watch_obj_create(activity_obj); + if(NULL == obj) + return NULL; + + label = lv_label_create(obj, NULL); + lv_obj_set_size(label, LV_HOR_RES, LV_VER_RES / 6); + lv_label_set_text_id(label, WATCH_TEXT_ID_RESTART); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_align(label, obj, LV_ALIGN_IN_TOP_MID, 0, 25); + + content = lv_cont_create(obj, NULL); + lv_obj_add_style(content, LV_CONT_PART_MAIN, &lv_watch_style_transp); + lv_cont_set_fit(content, LV_FIT_TIGHT); + lv_cont_set_layout(content, LV_LAYOUT_CENTER); + lv_obj_align(content, label, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); + lv_obj_set_click(content, false); + lv_watch_obj_add_element(content); + + label_tip = lv_label_create(content, NULL); + lv_label_set_text_id(label_tip, WATCH_TEXT_ID_RESTART_Q); + lv_obj_add_style(label_tip, LV_LABEL_PART_MAIN, &lv_watch_font26); + + btn_yes = lv_imgbtn_create(obj, NULL); + lv_imgbtn_set_src(btn_yes, LV_BTN_STATE_RELEASED, ICON_OK); + lv_imgbtn_set_src(btn_yes, LV_BTN_STATE_PRESSED, ICON_OK); + lv_obj_align(btn_yes, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 20, -20); + lv_obj_set_event_cb(btn_yes, restart_yes_btn_action); + lv_watch_obj_add_element(btn_yes); + + btn_no = lv_imgbtn_create(obj, NULL); + lv_imgbtn_set_src(btn_no, LV_BTN_STATE_RELEASED, ICON_CANCEL); + lv_imgbtn_set_src(btn_no, LV_BTN_STATE_PRESSED, ICON_CANCEL); + lv_obj_align(btn_no, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -20, -20); + lv_obj_set_event_cb(btn_no, restart_no_btn_action); + lv_watch_obj_add_element(btn_no); + + return obj; +} +#else lv_obj_t * restart_create(lv_obj_t * activity_obj) { lv_obj_t * obj; @@ -192,6 +253,7 @@ lv_obj_t * restart_create(lv_obj_t * activity_obj) return obj; } +#endif void restart_btn_action(lv_obj_t * btn, lv_event_t event) { diff --git a/2.sdk/gui/lv_watch/lv_apps/weather/weather.c b/2.sdk/gui/lv_watch/lv_apps/weather/weather.c index 763e9a08..51c65eb0 100644 --- a/2.sdk/gui/lv_watch/lv_apps/weather/weather.c +++ b/2.sdk/gui/lv_watch/lv_apps/weather/weather.c @@ -38,14 +38,14 @@ static lv_obj_t * weather_content_no_info_create(lv_obj_t * par) lv_img_set_src(img, weather_list[9].img_src); lv_obj_t * label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); lv_label_set_text_id(label, weather_list[9].txtId); lv_obj_set_click(label, false); return(content); } -static lv_obj_t * weather_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +static lv_obj_t * weather_image_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) { lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_style_transp_fit, lv_obj_get_width(par)); lv_obj_t * img = lv_img_create(content, NULL); @@ -63,7 +63,7 @@ static lv_obj_t * weather_content_create(lv_obj_t * par, app_adaptor_weather_t * lv_img_set_src(img, weather_list[index].img_src); lv_obj_t * label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); lv_label_set_text_id(label, weather_list[index].txtId); @@ -72,67 +72,61 @@ static lv_obj_t * weather_content_create(lv_obj_t * par, app_adaptor_weather_t * return(content); } -static lv_obj_t * temperature_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +static lv_obj_t * weather_temperature_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) { - char str[10] = ""; - - lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_LEFT, &lv_watch_style_transp, lv_obj_get_width(par) / 2); + char str[16] = ""; + //uint16_t w_temp_unit[4] = {0x2103}; + + //lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_ROW_MID, &lv_watch_style_transp, lv_obj_get_width(par) / 2); + lv_obj_t * content = lv_cont_create(par, NULL); + lv_cont_set_fit2(content, LV_FIT_NONE, LV_FIT_TIGHT); + lv_obj_set_width(content, lv_obj_get_width(par)); + lv_obj_add_style(content, LV_OBJ_PART_MAIN, &lv_watch_style_transp); + //lv_cont_set_layout(content, cont_layout); + lv_obj_set_click(content, false); lv_obj_set_base_dir(content, LV_BIDI_DIR_LTR); + lv_cont_set_layout(content, LV_LAYOUT_OFF); - lv_obj_t * label = lv_label_create(content, NULL); - lv_obj_set_style_local_pad_inner(content, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font40_yellow); - snprintf(str, 10, "%d", weather->current_temperature); - lv_label_set_text(label, str); - lv_obj_set_click(label, false); - - label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font10); - lv_label_set_text(label, "o"); - lv_obj_set_click(label, false); - lv_obj_set_style_local_pad_top(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -2); - - label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font40_yellow); - lv_label_set_text(label, "C"); - lv_obj_set_click(label, false); - - - lv_obj_t * content1 = lv_watch_cont_create(content, LV_LAYOUT_ROW_TOP, &lv_watch_style_transp, lv_obj_get_width(par) / 2); - lv_obj_align(content1, label, LV_ALIGN_OUT_RIGHT_MID, 0, 0); - lv_obj_set_style_local_pad_inner(content1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); - label = lv_label_create(content1, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); - snprintf(str, 10, "%d-%d", weather->lowest_temperature, weather->highest_temperature); - lv_label_set_text(label, str); - lv_obj_set_click(label, false); - - label = lv_label_create(content1, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font10); - lv_obj_set_style_local_pad_top(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -2); - lv_label_set_text(label, "o"); - lv_obj_set_click(label, false); - - label = lv_label_create(content1, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); - lv_label_set_text(label, "C"); - lv_obj_set_click(label, false); + lv_obj_t * label1 = lv_label_create(content, NULL); + lv_obj_add_style(label1, LV_LABEL_PART_MAIN, &lv_watch_font30_yellow); + sprintf(str, "%d %s", weather->current_temperature, lang_get_text_by_id(WATCH_TEXT_ID_TEMPERATURE_UNIT)); // temp_unit); + //sprintf(str, "%d %s", 28, lang_get_text_by_id(WATCH_TEXT_ID_TEMPERATURE_UNIT)); + lv_label_set_text(label1, str); + lv_obj_set_click(label1, false); + lv_obj_align(label1, content, LV_ALIGN_IN_LEFT_MID, 30, 0); + + lv_obj_t * label2 = lv_label_create(content, NULL); + lv_obj_add_style(label2, LV_LABEL_PART_MAIN, &lv_watch_font20); + sprintf(str, "%d--%d %s", weather->lowest_temperature, weather->highest_temperature, lang_get_text_by_id(WATCH_TEXT_ID_TEMPERATURE_UNIT)); + //sprintf(str, "%d-%d %s", 23, 32, lang_get_text_by_id(WATCH_TEXT_ID_TEMPERATURE_UNIT)); + lv_label_set_text(label2, str); + lv_obj_set_click(label2, false); + lv_obj_align(label2, content, LV_ALIGN_IN_RIGHT_MID, -20, 0); return(content); } -static lv_obj_t * detail_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +static lv_obj_t * weather_city_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) { - lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_watch_style_transp, lv_obj_get_width(par)); + //lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_watch_style_transp, lv_obj_get_width(par)); + lv_obj_t * content = lv_cont_create(par, NULL); + lv_cont_set_fit2(content, LV_FIT_NONE, LV_FIT_TIGHT); + lv_obj_set_width(content, lv_obj_get_width(par)); + lv_obj_add_style(content, LV_OBJ_PART_MAIN, &lv_watch_style_transp); + //lv_cont_set_layout(content, cont_layout); + lv_obj_set_click(content, false); lv_obj_set_base_dir(content, LV_BIDI_DIR_LTR); lv_cont_set_layout(content, LV_LAYOUT_OFF); lv_obj_t * label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); if(0 != strlen(weather->city)) lv_label_set_text(label, weather->city); else lv_label_set_text(label, ""); + //lv_label_set_text_id(label, WATCH_TEXT_ID_SUNDAY); + lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL_CIRC); + lv_obj_align(label, content, LV_ALIGN_CENTER, 0, 0); lv_obj_set_click(label, false); @@ -141,7 +135,8 @@ static lv_obj_t * detail_content_create(lv_obj_t * par, app_adaptor_weather_t * void weather_update(lv_obj_t * cont) { - app_adaptor_weather_t weather_info = {}; + app_adaptor_weather_t weather_info = {0}; + app_adaptor_get_weather_req(&weather_info); lv_watch_png_cache_all_free(); @@ -162,21 +157,23 @@ void weather_update(lv_obj_t * cont) weather_ext->content3 = NULL; } + printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, weather_info.city); + if(0 == strlen(weather_info.city)) - { + { weather_ext->content1 = weather_content_no_info_create(cont); lv_obj_align(weather_ext->content1, cont, LV_ALIGN_IN_TOP_MID, 0, 20); } else - { - weather_ext->content1 = weather_content_create(cont, &weather_info); + { + weather_ext->content1 = weather_image_content_create(cont, &weather_info); lv_obj_align(weather_ext->content1, cont, LV_ALIGN_IN_TOP_MID, 0, 20); - weather_ext->content2 = temperature_content_create(cont, &weather_info); - lv_obj_align(weather_ext->content2, weather_ext->content1, LV_ALIGN_OUT_BOTTOM_LEFT, 20, 10); + weather_ext->content2 = weather_temperature_content_create(cont, &weather_info); + lv_obj_align(weather_ext->content2, weather_ext->content1, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - weather_ext->content3 = detail_content_create(cont, &weather_info); - lv_obj_align(weather_ext->content3, weather_ext->content2, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); + weather_ext->content3 = weather_city_content_create(cont, &weather_info); + lv_obj_align(weather_ext->content3, weather_ext->content2, LV_ALIGN_OUT_BOTTOM_MID, 0, 15); } } diff --git a/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c b/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c index e8bd2761..47760800 100644 --- a/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c +++ b/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c @@ -164,7 +164,7 @@ lv_obj_t * lv_watch_list_add(lv_obj_t * obj, const void * img_src, watchLangTxtI //set text id of btn label, it will update language when language changed lv_label_set_text_id(label, txtId); #ifdef __MMI_ZHSX_SUPPORT__ - //lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); #endif return btn; diff --git a/2.sdk/gui/lv_watch/lv_watch_res.h b/2.sdk/gui/lv_watch/lv_watch_res.h index e7d61e0d..d11b6ee2 100644 --- a/2.sdk/gui/lv_watch/lv_watch_res.h +++ b/2.sdk/gui/lv_watch/lv_watch_res.h @@ -131,6 +131,8 @@ LV_IMG_DECLARE(img_poweron_logo); #define ICON_SETTING_RESTORE "R:/png/setting/icon_setting_restore.png" #define ICON_CANCEL_BIG "R:/png/dialog_selection/icon_cancel_big.png" #define ICON_CONFIRM_BIG "R:/png/dialog_selection/icon_confirm_big.png" +#define ICON_CANCEL ICON_CANCEL_BIG +#define ICON_OK ICON_CONFIRM_BIG #define ICON_SETTING_BLUETOOTH "R:/png/setting/icon_setting_bluetooth.png" #define ICON_SETTING_WLAN "R:/png/setting/icon_setting_wlan.png" #define ICON_SETTING_WIFI_FULL "R:/png/setting/icon_setting_wifi_full.png" @@ -304,8 +306,8 @@ LV_IMG_DECLARE(img_poweron_logo); #define ICON_BODYHEIGHT "R:/png/pedometer/icon_bodyheight.png" #define ICON_BODYWEIGHT "R:/png/pedometer/icon_bodyweight.png" #define ICON_GOAL "R:/png/pedometer/icon_goal.png" -#define ICON_OK "R:/png/pedometer/icon_ok.png" -#define ICON_CANCEL "R:/png/pedometer/icon_cancel.png" +//#define ICON_OK "R:/png/pedometer/icon_ok.png" +//#define ICON_CANCEL "R:/png/pedometer/icon_cancel.png" #define ICON_STEP "R:/png/pedometer/icon_step.png" #define ICON_CAL "R:/png/pedometer/icon_cal.png" #define ICON_DISTANCE "R:/png/pedometer/icon_distance.png" diff --git a/2.sdk/gui/lv_watch/mmi_location/mmi_location.c b/2.sdk/gui/lv_watch/mmi_location/mmi_location.c index afa10b1b..68a38c95 100644 --- a/2.sdk/gui/lv_watch/mmi_location/mmi_location.c +++ b/2.sdk/gui/lv_watch/mmi_location/mmi_location.c @@ -356,6 +356,7 @@ static void mmi_watch_location_mission_timer_cb(uint32_t para) { LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + uos_timer_stop(s_watch_location_timer_id); uos_timer_start(s_watch_location_timer_id, MS_TO_TICKS(MMI_WATCH_LOCATION_PROCESS_DURATION), 0, mmi_watch_location_mission_timer_cb, NULL); } } diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c index 998540f9..9a68830c 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c @@ -180,6 +180,7 @@ static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para) mmi_health_measure_blood_timed_action(false, cur_time_stamp); mmi_health_measure_spo2_timed_action(false, cur_time_stamp); + uos_timer_stop(s_watch_timed_mission_timer_id); uos_timer_start(s_watch_timed_mission_timer_id, MS_TO_TICKS(1000 * 20), 0, mmi_protocol_watch_timed_mission_timer_cb, NULL); } @@ -232,6 +233,7 @@ static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para) s_watch_heartbeat_action_time_stamp = cur_time_stamp; } + uos_timer_stop(s_watch_heartbeat_action_timer_id); uos_timer_start(s_watch_heartbeat_action_timer_id, MS_TO_TICKS(1000 * 20), 0, mmi_protocol_watch_heartbeat_timer_cb, NULL); } diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c index 4f3b9576..53705eb1 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c @@ -1744,7 +1744,6 @@ bool mmi_protocol_fzd_parse_ACTION_GET_WEATHER(unsigned char * next_buff, unsign unsigned char * temp_ptr = NULL; app_adaptor_weather_t weather_info = {0}; - char city_name[MMI_WEATHER_CITY_NAME_LEN_MAX] = {0}; uint8_t i = 0; //date @@ -1790,9 +1789,8 @@ bool mmi_protocol_fzd_parse_ACTION_GET_WEATHER(unsigned char * next_buff, unsign //city for(i = 0; i*4 < strlen(next_buff); i++) { - city_name[i] = mmi_hex_string_to_number(next_buff + i*4, 4); + weather_info.city[i] = mmi_hex_string_to_number(next_buff + i*4, 4); } - weather_info.city = city_name; mmi_weather_info_set(&weather_info); diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c index 95b8b322..3ce677cf 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c @@ -73,9 +73,60 @@ signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_ } +void mmi_wstr_to_str(const uint16_t * src, uint8 * dst) +{ + return ; + +#if 0 + uint8 *return_str = dst; + if(NULL == src || NULL == dst) + { + return ; + } + while( !(*src & 0xFF00) && '\0' != (*dst++ = *src++) ) + { + ; + } + +#elif 0 + + uint8 index = 0; + uint16_t * ptr = src; + + if(NULL == src || NULL == dst) + { + return ; + } + + while(*ptr) + { + if(256 > *src) + { + if(*ptr == 162) // € + { + dst[index++] = 0xac; + dst[index] = 0x20; + } + else + { + dst[index++] = *((uint8 *)(ptr)); + dst[index] = 0; + } + } + else + { + dst[index++] = *((uint8 *)(ptr)); + dst[index] = *(((uint8 *)(ptr)) + 1); + } + + ptr++; + } + +#endif +} diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h index 0916a2a2..a6bc79ed 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h @@ -27,6 +27,7 @@ void mmi_str_to_upper(signed char *str, signed int len); signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_len); +void mmi_wstr_to_str(const uint16_t * src, uint8 * dst); #endif diff --git a/2.sdk/gui/lv_watch/resource/png/pedometer/icon_cancel.png b/2.sdk/gui/lv_watch/resource/png/pedometer/icon_cancel.png deleted file mode 100644 index 012f327291d6579723e184b6b4f782eab136fefc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 729 zcmeAS@N?(olHy`uVBq!ia0vp^P9V&}3?v1sWN!m0=3*z$5DpHG+YkL80J#PMJ|V9E zNd$iDcQ^p`3X}x-1v3aL8M}n0m3PcswfoH7cmK<#GKvD_I14-?iy0WWg+Q3`(%rg0 zKtcHu*NBqf{Irtt#G+IN-^Api{M^)(%tQsZ%%art{G#k)1&gg2mns+-7=L=YIEHw1 z_D<6dW;PT!Ud+Sa%^Z371FJxV%S3Yyhol)Rb0lY6EBm$MZESQ-=tj{q3659841%NE zS$%Z-FHP{)JNc~YdW!GmC*}Wh$|n1AI6jk|8@{lrc9VC}n+0r#nl_&)T+eYU&p2fd z_kptQT_Oj!+%_rT$lPt%xK@Oh24sby8-$;FuU`C-}VQCP#Ur=ZB@Qwye$i(jtG_QP0r#+NVST)xYYK zK1L`l>Qy!iGpxNnS6Ad~z;o74lfY+kk2bo_5XxM#*&%Z!7 zXp{u`1v3aL8M}mb%v^Qm?mM7eIKixa)(3%lI14-?iy0WWg+Q3`(%rg0KtcHu*NBqf z{Irtt#G+IN-^Api{M^)(%tQsZ%%art{G#k)1&gg2mns+-nD{+i977^n*UosE)U3eM zFm;v2t*q_qV&5l6SN=Dbk<(Cc4EW?PwcklksF^`XL_O23$g6nLQqLX-R|h4Z6-q4b z-`+1y`BLZZ`Q}^GhJSyK~+o}&ft4#6om1vSnxbgwCj zX6l}LHK=LcL$?ct6I!)X6uWGlvc35xovb_fj^$bOM1k{)0a`~QUgUIyohX=ca!-TG z%e{uv9W=jl&Fep~*{o1=_2gZ==H7F-)OMTK=d67wa+9~w@JDf+@FK~UMK8_^SxS9A z!RdN*dRDVl%T)&ruYGQF{wNA`W$*8jx%4>NJE3#Yt}nlS7M3d-Y+ttNQQXxTN*7Ef zWS@;&eEEcXDTf z4DKm8KGsz|>Ebq>?fu-D6IOq;P4Z|tKI4E=%w7kVV;7qa%$c>yJAI;|Z^A;;b&=wY z8$~(%bsJfCsGW5=rqZ}{rryo<$%me?3cO-kqiw0o=A#hsaQ982S%;SE?-xq`%q%qP z6L$>L_ELWh-j+KhqIa*0wY<}6;`*>Sb;^D=rv1}5b|$KQaAV)YKJWIc59vx@&NjA- z9d%#)WMS;*izdG^Vws=ZXxh9(hF9eD?F#wBEw>F8^fB5de@sYyA6>DB+lFUmV}GFe s2ZI9h2}_gfmA&olN~$;hW%FVdQ&MBb@0RK6e+5i9m -- 2.17.1