#include "include.h" #include "func_menu.h" #include "m_rtc.h" #include "app_variable.h" #include "spirit_island_api.h" #include "tjd_watch_transmit.h" #if TRACE_EN #define TRACE(...) printf(__VA_ARGS__) #else #define TRACE(...) #endif #define FUNC_CREATE_CNT ((int)(sizeof(tbl_func_create) / sizeof(tbl_func_create[0]))) #define FUNC_ENTRY_CNT ((int)(sizeof(tbl_func_entry) / sizeof(tbl_func_entry[0]))) typedef enum { /* 普通界面:同级可覆盖 */ FUNC_SCREEN_PRIORITY_NORMAL = 0x00, // 常规功能界面 /* 通知界面:同级可覆盖 */ FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1, // 找手表、拍照、消息... FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2, // 久坐、喝水、低电、充电、闹钟... FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3, // BT通话 FUNC_SCREEN_PRIORITY_NOTICE_RESERVED, /* 最高优先级界面:同级不可覆盖-互相无冲突 */ FUNC_SCREEN_PRIORITY_LEVEL_MAX, // OTA、表盘推送、初始化、开机、关机、工厂模式 } func_priority_type; typedef struct func_t_ { int func_idx; void *func; func_priority_type level; } func_t; u32 func_duty; u32 func_vibrationtimes; u32 func_interval; u32 func_cnt; /** * @param[in] duty 占空比,0-100% * @param[in] vibrationtimes 震动时间,单位100ms * @param[in] interval 震动时间间隔,单位100ms * @param[in] cnt 震动次数 **/ void set_func_motor(u32 duty, u32 vibrationtimes, u32 interval, u32 cnt) { func_duty = duty; func_vibrationtimes = vibrationtimes; func_interval = interval; func_cnt = cnt; } extern void func_menu(void); extern void func_clock(void); // extern void func_clock_preview(void); extern void func_clock_sub_sidebar(void); extern void func_clock_sub_card(void); extern void func_heartrate(void); extern void func_compo_select(void); extern void func_compo_select_sub(void); extern void func_alarm_clock(void); extern void func_alarm_clock_sub_set(void); extern void func_alarm_clock_sub_repeat(void); extern void func_alarm_clock_sub_edit(void); extern void func_disturd_sub_set(void); extern void func_blood_oxygen(void); #if defined(TJD_GUI_Breathe_Show) extern void func_breathe(void); #endif extern void func_calculator(void); extern void func_camera(void); extern void func_light(void); extern void func_timer(void); extern void func_sleep(void); extern void func_stopwatch(void); extern void func_stopwatch_sub_record(void); extern void func_weather(void); extern void func_weather_detail(void); extern void func_sport(void); extern void func_sport_config(void); extern void func_sport_sub_run(void); extern void func_calendar(void); extern void func_call(void); extern void func_call_sub_record(void); extern void func_call_sub_dial(void); extern void func_game(void); extern void func_style(void); extern void func_findphone(void); // extern void func_altitude(void); // extern void func_map(void); extern void func_message_gengeral_info(void); extern void func_scan(void); extern void func_voice(void); extern void func_alipay(void); #if defined(TJD_GUI_COMPASS_SHOW) extern void func_compass(void); #endif extern void func_address_book(void); extern void func_set_sub_list(void); extern void func_set_sub_sav(void); extern void func_set_sub_dousing(void); extern void func_set_sub_disturd(void); extern void func_set_person_info(void); extern void func_set_general_list(void); extern void func_set_sub_language(void); extern void func_set_sub_wrist(void); extern void func_set_sub_time(void); extern void func_time_sub_setdate(void); extern void func_set_sub_password(void); extern void func_password_sub_disp(void); extern void func_password_sub_select(void); extern void func_set_sub_about(void); extern void func_set_sub_restart(void); extern void func_set_sub_rstfy(void); extern void func_set_sub_off(void); extern void func_switching_to_menu(void); //extern void func_volume(void); extern void func_activity(void); extern void func_sport_switching(void); #if defined(TJD_GUI_bloodsugar_Show) extern void func_bloodsugar(void); #endif extern void func_bloodpressure(void); extern void func_flashlight(void); extern void func_charge(void); extern void func_debug_info(void); extern void func_power_on_logo(void); extern void func_power_off_logo(void); extern void func_remind_sit(void); extern void func_remind_drink(void); extern void func_dial_push(void); extern void func_dial_push(void); extern void func_remind_disconnect(void); extern void func_remind_push(void); extern void func_factory_test_list(void); // extern void func_keytest(void); // extern void func_screentest(void); // extern void func_motortest(void); // extern void func_ringtest(void); extern void func_remind_alarm(void); extern void func_sport_pause(void); extern void func_sport_end_detail(void); extern void func_set_sub_key_definitions(void); extern void func_set_sub_notice_list(void); extern void func_music(void); extern void func_idle(void); extern void func_bt(void); extern void func_bt_ring(void); extern void func_bt_call(void); extern void func_bthid(void); extern void func_usbdev(void); extern void func_aux(void); extern void func_find_device(void); extern void func_message_push(void); extern void func_set_timetype(void); extern void func_set_time(void); #ifdef TJD_GUI_Remind_slip_wrist_Show extern void func_farway_hand(void); #endif //时钟表盘右滑菜单 extern void func_message_qq_info(void); extern void func_message_wechat_info(void); extern void func_message_facebook_info(void); extern void func_message_twitter_info(void); extern void func_message_whatapp_info(void); extern void func_bt_end(void); extern void func_factory_test_details(void); extern void func_drink(void); extern void func_sedentary(void); extern void func_world_clock(void); extern void func_world_clock_detail(void); extern void func_multiline(void); extern void func_breathe_mode(void); extern void func_breathe_end(void); #ifdef __SCREEN_DARK_CLOCK_SHOW__ extern void func_set_screen_dark(void); extern void func_screen_dark_clock(void); #endif extern void func_smartstack(void); #ifdef TJD_SETTING_AUDIO_SWITCH extern void func_set_sub_audio_swich(void); #endif #ifdef TJD_GUI_SOS_Show extern void func_sos(void); extern void func_sos_book(void); #endif // compo_form_t *func_logo_form_create(void); compo_form_t *func_menu_form_create(void); compo_form_t *func_clock_form_create(void); compo_form_t *func_clock_sub_sidebar_form_create(void); compo_form_t *func_clock_sub_card_form_create(void); compo_form_t *func_heartrate_form_create(void); compo_form_t *func_bt_form_create(void); compo_form_t *func_bt_ring_form_create(void); compo_form_t *func_bt_call_form_create(void); compo_form_t *func_alarm_clock_form_create(void); compo_form_t *func_alarm_clock_sub_set_form_create(void); compo_form_t *func_alarm_clock_sub_repeat_form_create(void); compo_form_t *func_alarm_clock_sub_edit_form_create(void); compo_form_t *func_blood_oxygen_form_create(void); #if defined(TJD_GUI_Breathe_Show) compo_form_t *func_breathe_form_create(void); #endif compo_form_t *func_calculator_form_create(void); compo_form_t *func_camera_form_create(void); compo_form_t *func_light_form_create(void); compo_form_t *func_timer_form_create(void); compo_form_t *func_sleep_form_create(void); compo_form_t *func_stopwatch_form_create(void); compo_form_t *func_stopwatch_sub_record_form_create(void); compo_form_t *func_weather_form_create(void); compo_form_t *func_weather_detail_form_create(void); compo_form_t *func_sport_form_create(void); compo_form_t *func_sport_config_form_create(void); compo_form_t *func_sport_sub_run_form_create(void); compo_form_t *func_sport_switching_form_create(void); compo_form_t *func_set_sub_disturd_form_create(void); compo_form_t *func_disturd_sub_set_form_create(void); compo_form_t *func_call_form_create(void); compo_form_t *func_call_sub_record_form_create(void); compo_form_t *func_call_sub_dial_form_create(void); compo_form_t *func_game_form_create(void); compo_form_t *func_style_form_create(void); compo_form_t *func_findphone_form_create(void); // compo_form_t *func_altitude_form_create(void); // compo_form_t *func_map_form_create(void); compo_form_t *func_message_gengeral_form_create(void); compo_form_t * func_message_qq_form_create(void); compo_form_t * func_message_wechat_form_create(void); compo_form_t * func_message_facebook_form_create(void); compo_form_t * func_message_twitter_form_create(void); compo_form_t * func_message_whatapp_form_create(void); compo_form_t *func_message_push_form_create(void); compo_form_t *func_scan_form_create(void); compo_form_t *func_voice_form_create(void); compo_form_t *func_alipay_form_create(void); #if defined(TJD_GUI_COMPASS_SHOW) compo_form_t *func_compass_form_create(void); #endif compo_form_t *func_address_book_form_create(void); compo_form_t *func_set_sub_list_form_create(void); compo_form_t *func_set_sub_wrist_form_create(void); compo_form_t *func_set_sub_sav_form_create(void); compo_form_t *func_set_sub_dousing_form_create(void); compo_form_t *func_set_person_info_form_create(void); compo_form_t *func_set_sub_general_form_create(void); compo_form_t *func_factory_sub_test_form_create(void); // compo_form_t *func_keytest_form_create(void); // compo_form_t *func_screentest_form_create(void); // compo_form_t *func_motortest_form_create(void); // compo_form_t *func_ringtest_form_create(void); compo_form_t *func_set_sub_language_form_create(void); compo_form_t *func_set_sub_time_form_create(void); compo_form_t *func_time_sub_setdate_form_create(void); compo_form_t *func_set_sub_password_form_create(void); compo_form_t *func_password_sub_disp_form_create(void); compo_form_t *func_password_sub_select_form_create(void); compo_form_t *func_set_sub_about_form_create(void); compo_form_t *func_set_sub_restart_form_create(void); compo_form_t *func_set_sub_rstfy_form_create(void); compo_form_t *func_set_sub_off_form_create(void); compo_form_t *func_calender_form_create(void); //compo_form_t *func_volume_form_create(void); compo_form_t *func_activity_form_create(void); #if defined(TJD_GUI_bloodsugar_Show) compo_form_t *func_bloodsugar_form_create(void); #endif compo_form_t *func_bloodpressure_form_create(void); compo_form_t *func_flashlight_form_create(void); compo_form_t *func_charge_form_create(void); // compo_form_t *func_clock_preview_form_create(void); compo_form_t *func_compo_select_form_create(void); compo_form_t *func_compo_select_sub_form_create(void); compo_form_t *func_debug_info_form_create(void); compo_form_t *func_find_device_form_create(void); compo_form_t *func_power_on_logo_create(void); compo_form_t *func_power_off_logo_create(void); compo_form_t *func_remind_sit_form_create(void); compo_form_t *func_remind_drink_form_create(void); compo_form_t *func_dial_push_form_create(void); compo_form_t *func_remind_disconnect_form_create(void); compo_form_t *func_remind_push_form_create(void); compo_form_t *func_remind_alarm_form_create(void); compo_form_t *func_sport_pause_form_create(void); compo_form_t *func_sport_end_detail_form_create(void); compo_form_t *func_set_timetype_form_create(void); compo_form_t *func_set_time_form_create(void); compo_form_t *func_set_sub_key_definitions_form_create(void); compo_form_t *func_set_sub_notice_list_form_create(void); compo_form_t *func_bt_end_form_create(void); #ifdef TJD_GUI_Remind_slip_wrist_Show compo_form_t *func_farway_hand_form_create(void); #endif compo_form_t *func_factory_test_details_form_create(void); compo_form_t *func_drink_form_create(void); compo_form_t *func_sedentary_form_create(void); compo_form_t *func_world_clock_form_create(void); compo_form_t *func_world_clock_detail_form_create(void); #ifdef TJD_GUI_Gesture_gaming_Show compo_form_t *func_gesture_form_create(void); void func_gesture_game(void); #endif compo_form_t *func_multiline_form_create(void); compo_form_t *func_breathe_mode_form_create(void); compo_form_t *func_breathe_end_form_create(void); compo_form_t *func_smartstack_form_create(void); #ifdef __SCREEN_DARK_CLOCK_SHOW__ compo_form_t *func_set_screen_dark_form_create(void); compo_form_t *func_screen_dark_clock_form_create(void); #endif void func_short_video(void); compo_form_t *func_short_video_form_create(void); void func_game_knife(void); compo_form_t *func_game_knife_form_create(void); #ifdef TJD_SETTING_AUDIO_SWITCH extern void func_set_sub_audio_swich_form_create(void); #endif #ifdef TJD_GUI_SOS_Show compo_form_t *func_sos_form_create(void); compo_form_t *func_sos_book_form_create(void); #endif func_cb_t func_cb AT(.buf.func_cb); const func_t tbl_func_create[] = { {FUNC_MENU, func_menu_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CLOCK, func_clock_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, // {FUNC_CLOCK_PREVIEW, func_clock_preview_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SIDEBAR, func_clock_sub_sidebar_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CARD, func_clock_sub_card_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_HEARTRATE, func_heartrate_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BT, func_bt_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BT_RING, func_bt_ring_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, {FUNC_BT_CALL, func_bt_call_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, {FUNC_COMPO_SELECT, func_compo_select_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_COMPO_SELECT_SUB, func_compo_select_sub_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_ALARM_CLOCK, func_alarm_clock_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_ALARM_CLOCK_SUB_SET, func_alarm_clock_sub_set_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_ALARM_CLOCK_SUB_REPEAT, func_alarm_clock_sub_repeat_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_ALARM_CLOCK_SUB_EDIT, func_alarm_clock_sub_edit_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BLOOD_OXYGEN, func_blood_oxygen_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #if defined(TJD_GUI_bloodsugar_Show) {FUNC_BLOODSUGAR, func_bloodsugar_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif {FUNC_BLOOD_PRESSURE, func_bloodpressure_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #if defined(TJD_GUI_Breathe_Show) {FUNC_BREATHE, func_breathe_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif {FUNC_CALCULATOR, func_calculator_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CAMERA, func_camera_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_TIMER, func_timer_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SLEEP, func_sleep_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_STOPWATCH, func_stopwatch_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, // {FUNC_STOPWATCH_SUB_RECORD, func_stopwatch_sub_record_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_WEATHER, func_weather_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_WEATHER_DETAIL, func_weather_detail_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SPORT, func_sport_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SPORT_CONFIG, func_sport_config_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SPORT_SUB_RUN, func_sport_sub_run_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUNC_SPORT_SWITCH, func_sport_switching_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUNC_GAME, func_game_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_STYLE, func_style_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_FINDPHONE, func_findphone_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, // {FUNC_ALTITUDE, func_altitude_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, // {FUNC_MAP, func_map_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_MESSAGE, func_message_gengeral_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_MESSAGE_PUSH, func_message_push_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_SCAN, func_scan_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_VOICE, func_voice_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #if SECURITY_PAY_EN {FUNC_ALIPAY, func_alipay_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif // SECURITY_PAY_EN #if defined(TJD_GUI_COMPASS_SHOW) {FUNC_COMPASS, func_compass_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif // defined(TJD_GUI_COMPASS_SHOW) {FUNC_ADDRESS_BOOK, func_address_book_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CALL, func_call_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CALL_SUB_RECORD, func_call_sub_record_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CALL_SUB_DIAL, func_call_sub_dial_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SETTING, func_set_sub_list_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_CALENDAER, func_calender_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, //{FUNC_VOLUME, func_volume_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_ACTIVITY, func_activity_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_FLASHLIGHT, func_flashlight_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_LIGHT, func_light_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_DOUSING, func_set_sub_dousing_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_WRIST, func_set_sub_wrist_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_DISTURD, func_set_sub_disturd_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_GENERAL, func_set_sub_general_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_PERSONALINFO, func_set_person_info_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_DISTURD_SUB_SET, func_disturd_sub_set_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_LANGUAGE, func_set_sub_language_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_TIME, func_set_sub_time_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_TIME_SUB_SETDATE, func_time_sub_setdate_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_PASSWORD, func_set_sub_password_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_PASSWORD_SUB_DISP, func_password_sub_disp_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_PASSWORD_SUB_SELECT, func_password_sub_select_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_SET_SUB_SAV, func_set_sub_sav_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_ABOUT, func_set_sub_about_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_RESTART, func_set_sub_restart_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_RSTFY, func_set_sub_rstfy_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_OFF, func_set_sub_off_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_CHARGE, func_charge_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUNC_DEBUG_INFO, func_debug_info_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_FIND_DEVICE, func_find_device_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUN_POWER_ON_LOGO, func_power_on_logo_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUN_POWER_OFF_LOGO, func_power_off_logo_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUN_REMIND_SIT, func_remind_sit_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUN_REMIND_DRINK, func_remind_drink_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUN_DIAL_PUSH, func_dial_push_form_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUN_REMIND_DISCONNECT, func_remind_disconnect_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUN_REMIND_PUSH, func_remind_push_form_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUNC_REMIND_ALARM, func_remind_alarm_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUNC_SPORT_PAUSE, func_sport_pause_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SPORT_END_DETAIL, func_sport_end_detail_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_TIMETYPE, func_set_timetype_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_TIME, func_set_time_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_QQ, func_message_qq_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_WECHAT, func_message_wechat_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_FACEBOOK, func_message_facebook_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_TWITTER, func_message_twitter_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_WHATSAPP, func_message_whatapp_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_KEY_DEFINITIONS, func_set_sub_key_definitions_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SET_SUB_NOTICE, func_set_sub_notice_list_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_FACTORY_TEST, func_factory_sub_test_form_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUNC_BT_END, func_bt_end_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, #ifdef TJD_GUI_Remind_slip_wrist_Show {FUNC_FARWAY_HAND, func_farway_hand_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, #endif {FUNC_FACTORY_TEST_DETAILS, func_factory_test_details_form_create, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, {FUNC_DRINK, func_drink_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SEDENTARY, func_sedentary_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #ifdef TJD_GUI_Gesture_gaming_Show {FUNC_GESTURE_GAME, func_gesture_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif {FUNC_WORLD_CLOCK, func_world_clock_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_WORLD_CLOCK_DETAIL, func_world_clock_detail_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SHORT_VIDEO, func_short_video_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_GAME_KNIFE, func_game_knife_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SMARTSTACK, func_smartstack_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_MULTILINE, func_multiline_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BREATHE_MODE, func_breathe_mode_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BREATHE_END, func_breathe_end_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #ifdef __SCREEN_DARK_CLOCK_SHOW__ {FUNC_SET_SCREEN_DARK, func_set_screen_dark_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SCREEN_DARK_CLOCK, func_screen_dark_clock_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif #ifdef TJD_SETTING_AUDIO_SWITCH {FUNC_SET_SUB_AUDIO_SWICH, func_set_sub_audio_swich_form_create, FUNC_SCREEN_PRIORITY_NORMAL}, #endif #ifdef TJD_GUI_SOS_Show {FUNC_SOS, func_sos_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_SOS_BOOK, func_sos_book_form_create, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, #endif }; const func_t tbl_func_entry[] = { {FUNC_MENU, func_menu, FUNC_SCREEN_PRIORITY_NORMAL}, //主菜单(蜂窝) {FUNC_CLOCK, func_clock, FUNC_SCREEN_PRIORITY_NORMAL}, //时钟表盘 // {FUNC_CLOCK_PREVIEW, func_clock_preview, FUNC_SCREEN_PRIORITY_NORMAL}, //时钟表盘预览 {FUNC_SIDEBAR, func_clock_sub_sidebar, FUNC_SCREEN_PRIORITY_NORMAL}, //表盘右滑 {FUNC_CARD, func_clock_sub_card, FUNC_SCREEN_PRIORITY_NORMAL}, //表盘上拉 {FUNC_HEARTRATE, func_heartrate, FUNC_SCREEN_PRIORITY_NORMAL}, //心率 {FUNC_ALARM_CLOCK, func_alarm_clock, FUNC_SCREEN_PRIORITY_NORMAL}, //闹钟 {FUNC_ALARM_CLOCK_SUB_SET, func_alarm_clock_sub_set, FUNC_SCREEN_PRIORITY_NORMAL}, //闹钟--设置 {FUNC_ALARM_CLOCK_SUB_REPEAT, func_alarm_clock_sub_repeat, FUNC_SCREEN_PRIORITY_NORMAL}, //闹钟--重复 {FUNC_ALARM_CLOCK_SUB_EDIT, func_alarm_clock_sub_edit, FUNC_SCREEN_PRIORITY_NORMAL}, //闹钟--编辑 {FUNC_BLOOD_OXYGEN, func_blood_oxygen, FUNC_SCREEN_PRIORITY_NORMAL}, //血氧 #if defined(TJD_GUI_bloodsugar_Show) {FUNC_BLOODSUGAR, func_bloodsugar, FUNC_SCREEN_PRIORITY_NORMAL}, //血糖 #endif {FUNC_BLOOD_PRESSURE, func_bloodpressure, FUNC_SCREEN_PRIORITY_NORMAL}, //血压 #if defined(TJD_GUI_Breathe_Show) {FUNC_BREATHE, func_breathe, FUNC_SCREEN_PRIORITY_NORMAL}, //呼吸 #endif {FUNC_COMPO_SELECT, func_compo_select, FUNC_SCREEN_PRIORITY_NORMAL}, //组件选择 {FUNC_COMPO_SELECT_SUB, func_compo_select_sub, FUNC_SCREEN_PRIORITY_NORMAL}, //组件选择子界面 {FUNC_CALCULATOR, func_calculator, FUNC_SCREEN_PRIORITY_NORMAL}, //计算器 {FUNC_CAMERA, func_camera, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //相机 {FUNC_LIGHT, func_light, FUNC_SCREEN_PRIORITY_NORMAL}, //亮度调节 {FUNC_TIMER, func_timer, FUNC_SCREEN_PRIORITY_NORMAL}, //定时器 {FUNC_SLEEP, func_sleep, FUNC_SCREEN_PRIORITY_NORMAL}, //睡眠 {FUNC_STOPWATCH, func_stopwatch, FUNC_SCREEN_PRIORITY_NORMAL}, //秒表 // {FUNC_STOPWATCH_SUB_RECORD, func_stopwatch_sub_record, FUNC_SCREEN_PRIORITY_NORMAL}, //秒表--秒表记录 {FUNC_WEATHER, func_weather, FUNC_SCREEN_PRIORITY_NORMAL}, //天气 {FUNC_WEATHER_DETAIL, func_weather_detail, FUNC_SCREEN_PRIORITY_NORMAL}, //天气详情 {FUNC_SPORT, func_sport, FUNC_SCREEN_PRIORITY_NORMAL}, //运动 {FUNC_SPORT_CONFIG, func_sport_config, FUNC_SCREEN_PRIORITY_NORMAL}, //运动配置 {FUNC_SPORT_SUB_RUN, func_sport_sub_run, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, //运动--室内跑步 {FUNC_SPORT_SWITCH, func_sport_switching, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, //运动开启动画 {FUNC_GAME, func_game, FUNC_SCREEN_PRIORITY_NORMAL}, //游戏 {FUNC_STYLE, func_style, FUNC_SCREEN_PRIORITY_NORMAL}, //菜单风格 // {FUNC_ALTITUDE, func_altitude, FUNC_SCREEN_PRIORITY_NORMAL}, //海拔 {FUNC_FINDPHONE, func_findphone, FUNC_SCREEN_PRIORITY_NORMAL}, //寻找手机 // {FUNC_MAP, func_map, FUNC_SCREEN_PRIORITY_NORMAL}, //地图 {FUNC_MESSAGE, func_message_gengeral_info, FUNC_SCREEN_PRIORITY_NORMAL}, //消息 {FUNC_MESSAGE_PUSH, func_message_push, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_SCAN, func_scan, FUNC_SCREEN_PRIORITY_NORMAL}, //扫一扫 {FUNC_VOICE, func_voice, FUNC_SCREEN_PRIORITY_NORMAL}, //语音助手 #if SECURITY_PAY_EN {FUNC_ALIPAY, func_alipay, FUNC_SCREEN_PRIORITY_NORMAL}, //支付宝 #endif // SECURITY_PAY_EN #if defined(TJD_GUI_COMPASS_SHOW) {FUNC_COMPASS, func_compass, FUNC_SCREEN_PRIORITY_NORMAL}, //指南针 #endif // TJD_GUI_COMPASS_SHOW {FUNC_ADDRESS_BOOK, func_address_book, FUNC_SCREEN_PRIORITY_NORMAL}, //电话簿 {FUNC_CALENDAER, func_calendar, FUNC_SCREEN_PRIORITY_NORMAL}, //日历 {FUNC_CALL, func_call, FUNC_SCREEN_PRIORITY_NORMAL}, //电话 {FUNC_CALL_SUB_RECORD, func_call_sub_record, FUNC_SCREEN_PRIORITY_NORMAL}, //电话--最近通话 {FUNC_CALL_SUB_DIAL, func_call_sub_dial, FUNC_SCREEN_PRIORITY_NORMAL}, //电话--拨号 //{FUNC_VOLUME, func_volume, FUNC_SCREEN_PRIORITY_NORMAL}, //音量调节 {FUNC_ACTIVITY, func_activity, FUNC_SCREEN_PRIORITY_NORMAL}, //活动记录 {FUNC_FLASHLIGHT, func_flashlight, FUNC_SCREEN_PRIORITY_NORMAL}, //手电筒 {FUNC_SETTING, func_set_sub_list, FUNC_SCREEN_PRIORITY_NORMAL}, //设置 {FUNC_SET_SUB_DOUSING, func_set_sub_dousing, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--熄屏 {FUNC_SET_SUB_WRIST, func_set_sub_wrist, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--抬腕 {FUNC_SET_SUB_DISTURD, func_set_sub_disturd, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--勿扰 {FUNC_PERSONALINFO, func_set_person_info, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--个人信息 {FUNC_SET_GENERAL, func_set_general_list, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--个人信息 {FUNC_DISTURD_SUB_SET, func_disturd_sub_set, FUNC_SCREEN_PRIORITY_NORMAL}, //勿扰--时间设置 {FUNC_SET_SUB_SAV, func_set_sub_sav, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--声音与振动 {FUNC_SET_SUB_LANGUAGE, func_set_sub_language, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--语言 {FUNC_SET_SUB_TIME, func_set_sub_time, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--时间 {FUNC_TIME_SUB_SETDATE, func_time_sub_setdate, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--自定义时间 {FUNC_SET_SUB_PASSWORD, func_set_sub_password, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--密码锁 {FUNC_PASSWORD_SUB_DISP, func_password_sub_disp, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //设置--新密码锁设置 {FUNC_PASSWORD_SUB_SELECT, func_password_sub_select, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //设置--密码锁确认 {FUNC_SET_SUB_ABOUT, func_set_sub_about, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--关于 {FUNC_SET_SUB_RESTART, func_set_sub_restart, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--重启 {FUNC_SET_SUB_RSTFY, func_set_sub_rstfy, FUNC_SCREEN_PRIORITY_NORMAL}, //设置--恢复出厂 {FUNC_SET_SUB_OFF, func_set_sub_off, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //设置--关机 {FUNC_CHARGE, func_charge, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, //充电 {FUNC_DEBUG_INFO, func_debug_info, FUNC_SCREEN_PRIORITY_NORMAL}, //DEBUG {FUN_POWER_ON_LOGO, func_power_on_logo, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, //开机logo {FUN_POWER_OFF_LOGO, func_power_off_logo, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, //关机logo {FUN_REMIND_SIT, func_remind_sit, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, //久坐提醒 {FUN_REMIND_DRINK, func_remind_drink, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, //喝水提醒 {FUN_DIAL_PUSH, func_dial_push, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, //ota界面 {FUN_REMIND_DISCONNECT, func_remind_disconnect, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //蓝牙未连接 {FUN_REMIND_PUSH, func_remind_push, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, //推送升级 {FUNC_FACTORY_TEST, func_factory_test_list, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, #if FUNC_BT_EN {FUNC_BT, func_bt, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BT_RING, func_bt_ring, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, {FUNC_BT_CALL, func_bt_call, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, #endif // FUNC_BT_EN #if FUNC_BT_DUT_EN {FUNC_BT_DUT, func_bt_dut, FUNC_SCREEN_PRIORITY_NORMAL}, #endif // FUNC_BT_DUT_EN #if FUNC_IDLE_EN {FUNC_IDLE, func_idle, FUNC_SCREEN_PRIORITY_NORMAL}, #endif // FUNC_IDLE_EN {FUNC_FIND_DEVICE, func_find_device, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, {FUNC_REMIND_ALARM, func_remind_alarm, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_2}, {FUNC_SPORT_PAUSE, func_sport_pause, FUNC_SCREEN_PRIORITY_NORMAL}, //运动暂停 {FUNC_SPORT_END_DETAIL, func_sport_end_detail, FUNC_SCREEN_PRIORITY_NORMAL}, //运动结束详情 {FUNC_SET_TIMETYPE, func_set_timetype, FUNC_SCREEN_PRIORITY_NORMAL}, //时制设置 {FUNC_SET_TIME, func_set_time, FUNC_SCREEN_PRIORITY_NORMAL}, //时间设置 {FUNC_SET_QQ, func_message_qq_info, FUNC_SCREEN_PRIORITY_NORMAL}, //qq {FUNC_SET_WECHAT, func_message_wechat_info, FUNC_SCREEN_PRIORITY_NORMAL}, //微信 {FUNC_SET_FACEBOOK, func_message_facebook_info, FUNC_SCREEN_PRIORITY_NORMAL}, //facebook {FUNC_SET_TWITTER, func_message_twitter_info, FUNC_SCREEN_PRIORITY_NORMAL}, //twitter {FUNC_SET_WHATSAPP, func_message_whatapp_info, FUNC_SCREEN_PRIORITY_NORMAL}, //whatsapp {FUNC_SET_SUB_KEY_DEFINITIONS, func_set_sub_key_definitions, FUNC_SCREEN_PRIORITY_NORMAL}, //设置-按键定义 {FUNC_SET_SUB_NOTICE, func_set_sub_notice_list, FUNC_SCREEN_PRIORITY_NORMAL}, //设置-通知 {FUNC_BT_END, func_bt_end, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_3}, #ifdef TJD_GUI_Remind_slip_wrist_Show {FUNC_FARWAY_HAND, func_farway_hand, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //脱腕检测 #endif {FUNC_FACTORY_TEST_DETAILS, func_factory_test_details, FUNC_SCREEN_PRIORITY_LEVEL_MAX}, //工厂模式 {FUNC_DRINK, func_drink, FUNC_SCREEN_PRIORITY_NORMAL}, //喝水 {FUNC_SEDENTARY, func_sedentary, FUNC_SCREEN_PRIORITY_NORMAL}, //久坐 #ifdef TJD_GUI_Gesture_gaming_Show {FUNC_GESTURE_GAME, func_gesture_game, FUNC_SCREEN_PRIORITY_NORMAL}, #endif {FUNC_WORLD_CLOCK, func_world_clock, FUNC_SCREEN_PRIORITY_NORMAL}, //世界时钟 {FUNC_WORLD_CLOCK_DETAIL, func_world_clock_detail, FUNC_SCREEN_PRIORITY_NORMAL}, //世界时钟详情 {FUNC_SHORT_VIDEO, func_short_video, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_GAME_KNIFE, func_game_knife, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SMARTSTACK, func_smartstack, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_MULTILINE, func_multiline, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BREATHE_MODE, func_breathe_mode, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_BREATHE_END, func_breathe_end, FUNC_SCREEN_PRIORITY_NORMAL}, #ifdef __SCREEN_DARK_CLOCK_SHOW__ {FUNC_SET_SCREEN_DARK, func_set_screen_dark, FUNC_SCREEN_PRIORITY_NORMAL}, {FUNC_SCREEN_DARK_CLOCK, func_screen_dark_clock, FUNC_SCREEN_PRIORITY_NORMAL}, #endif #ifdef TJD_SETTING_AUDIO_SWITCH {FUNC_SET_SUB_AUDIO_SWICH, func_set_sub_audio_swich, FUNC_SCREEN_PRIORITY_NORMAL}, #endif #ifdef TJD_GUI_SOS_Show {FUNC_SOS, func_sos, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, //SOS {FUNC_SOS_BOOK, func_sos_book, FUNC_SCREEN_PRIORITY_NOTICE_LEVEL_1}, #endif }; int func_binarySearch(int id) //判断系统是否支持该id显示,防止代码跑飞 { int left = 0; int right = FUNC_ENTRY_CNT - 1; while (left <= right) { if (tbl_func_entry[left].func_idx == id) return true; left++; } return false; } AT(.text.func.process) void func_watch_bt_process(void) { uint status = bt_get_disp_status(); bt_cb.disp_status = status; if (bt_cb.disp_status == BT_STA_OTA) { sfunc_bt_ota(); } #if BT_VOIP_REJECT_EN else if (bt_cb.disp_status == BT_STA_INCOMING && bt_cb.call_type == CALL_TYPE_PHONE) #else else if (bt_cb.disp_status == BT_STA_INCOMING) #endif { if (func_cb.sta != FUNC_BT_RING) { func_switch_to_assign_screen(FUNC_BT_RING, false); } } #if BT_VOIP_REJECT_EN else if (bt_cb.disp_status >= BT_STA_OUTGOING && bt_cb.call_type == CALL_TYPE_PHONE) #else else if (bt_cb.disp_status >= BT_STA_OUTGOING) #endif { if (func_cb.sta != FUNC_BT_CALL) { func_switch_to_assign_screen(FUNC_BT_CALL, false); } } } void print_info(void) { static u32 ticks = 0; if (tick_check_expire(ticks, 1000)) { ticks = tick_get(); // printf("func_cb.sta[%d]", func_cb.sta); } } /* !!!确保做好非本窗体时有效退出!!! */ static void func_form_private_process(void) { /* 自定义表盘任务 */ func_clock_custom_process(); } AT(.text.func.process) void func_process(void) { WDT_CLR(); // print_info(); tft_bglight_frist_set_check(); // gui 没有休眠才更新 防止客户乱改我们的唤醒流程导致卡主的问题 if (!sys_cb.gui_sleep_sta) { compo_update(); //更新组件 gui_process(); //刷新UI /* 窗体私有进程任务调用 - 仅对在窗体动画切换当中仍需要处理的任务进行特殊调用 */ func_form_private_process(); } if (sys_cb.stopwatch_sta) { /* 10ms刷新时间 */ sys_cb.stopwatch_total_msec = sys_cb.stopwatch_temp_msec + sys_cb.stopwatch_tick; } if(sys_cb.motor_flag) { bsp_motor_stop(MOTOR_PORT); bsp_motor_set(MOTOR_PORT,func_duty, func_vibrationtimes, func_interval, func_cnt); sys_cb.motor_flag = 0; } if(SysVariable.duty_flag == true) { user_cfg_info_write(); SysVariable.duty_flag = false; } co_timer_pro(false); // bsp_sensor_step_pro_isr(); mp3_res_process(); //提示音后台处理 if (sleep_process(bt_is_sleep)) { bt_cb.disp_status = 0xff; } #if VBAT_DETECT_EN bsp_vbat_lpwr_process(); #endif #if BT_BACKSTAGE_EN func_watch_bt_process(); #endif //PWRKEY模拟硬开关关机处理 if ((PWRKEY_2_HW_PWRON) && (sys_cb.pwrdwn_hw_flag)) { // printf("enter to power off by PWRKEY\n"); func_switch_to_assign_screen(FUNC_SET_SUB_OFF, false); sys_cb.pwrdwn_hw_flag = 0; } #if CHARGE_EN if (xcfg_cb.charge_en) { charge_detect(1); } #endif // CHARGE_EN #if LE_EN ble_app_process(); #endif if (sys_cb.rename_bt) { // printf("rename bt ~~~~~~ %s,%s\n",SysVariable.le_name,SysVariable.bt_name); sys_cb.rename_bt = false; memset(SysVariable.bt_name,0x00,32); sprintf(SysVariable.bt_name, "%s BT", SysVariable.le_name); // printf("rename bt2 ~~~~~~ %s,%s\n",SysVariable.le_name,SysVariable.bt_name); bt_set_local_name(SysVariable.bt_name,true);//更新蓝牙名 ble_set_local_name(SysVariable.le_name,true); //更新ble名字 } #if FOT_EN bsp_fot_process(); #endif if (sys_cb.password_show && func_cb.sta != FUNC_PASSWORD_SUB_SELECT && func_cb.sta != FUNC_PASSWORD_SUB_DISP && func_cb.sta != FUNC_SET_SUB_OFF && func_cb.sta != FUN_POWER_OFF_LOGO && func_cb.sta != FUNC_CLOCK ) { // printf("show password~~~~~~~\n"); if (func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false)) { sys_cb.password_show = false; } } { static u32 ticks_500ms = 0; static u8 idle_sta = 0; if(tick_check_expire(ticks_500ms, 200)){ ticks_500ms = tick_get(); if(sys_cb.tft_idle_count){ sys_cb.tft_idle_count--; if(sys_cb.tft_idle_count == 0){ idle_sta = 1; sys_clk_set(SYS_52M); // printf("idle mode lowsys\n"); } }else if((idle_sta == 1) && (sys_cb.tft_idle_count)){ idle_sta = 0; sys_clk_set(SYS_CLK_SEL); // printf("idle mode higsys\n"); } } } // app_once_connect_to_android(); } //根据任务名创建窗体。此处调用的创建窗体函数不要调用子任务的控制结构体 compo_form_t *func_create_form(u8 sta) { printf("func_create_form2 sta = %d\n",sta); compo_form_t *frm = NULL; compo_form_t *(*func_create)(void) = NULL; for (int i = 0; i < FUNC_CREATE_CNT; i++) { if (tbl_func_create[i].func_idx == sta) { func_create = tbl_func_create[i].func; frm = func_create(); break; } } if (frm == NULL) { halt(HALT_FUNC_SORT); } return frm; } //获取当前任务顺序 static int func_get_order(u8 sta) { int i; for (i=0; i= func_cb.sort_cnt - 1) { if (flag_loop) { sta = func_cb.tbl_sort[0]; } else { return ; } } else { sta = func_cb.tbl_sort[idx + 1]; } compo_form_t *frm = func_create_form(sta); //创建下一个任务的窗体 bool res = func_switching(switch_mode, NULL); //切换动画 compo_form_destroy(frm); //切换完成或取消,销毁窗体 if (res) { if (func_cb.sta != FUNC_CLOCK && func_cb.flag_sort) { task_stack_pop(); } if (sta == FUNC_CLOCK) { func_cb.flag_sort = false; } else { func_cb.flag_sort = true; } func_cb.sta = sta; } } //切换 void func_switch_to(u8 sta, u16 switch_mode) { func_popup_break(); printf("func_switch_to\n"); compo_form_t *frm = func_create_form(sta); //创建下一个任务的窗体 bool res = func_switching(switch_mode, NULL); //切换动画 compo_form_destroy(frm); //切换完成或取消,销毁窗体 if (res) { func_cb.sta = sta; } } //切换回主时钟 void func_switch_to_clock(void) { func_popup_break(); if (bsp_charge_sta_get()) { task_stack_push(FUNC_CLOCK); latest_task_add(FUNC_CLOCK); func_switch_to(FUNC_CHARGE, FUNC_SWITCH_LR_ZOOM_RIGHT | FUNC_SWITCH_AUTO); } else { func_switch_to(FUNC_CLOCK, FUNC_SWITCH_LR_ZOOM_RIGHT | FUNC_SWITCH_AUTO); } func_cb.flag_sort = false; } //退回到主菜单 void func_switch_to_menu(void) { func_popup_break(); printf("func_switch_to_menu\n"); u16 switch_mode; bool flag_frm_menu; //是否需要创建菜单窗体 flag_frm_menu = true; if (func_cb.sta != FUNC_CLOCK || SysVariable.menu_style == MENU_STYLE_HONEYCOMB) { switch_mode = FUNC_SWITCH_ZOOM_EXIT | FUNC_SWITCH_AUTO; } else if (SysVariable.menu_style == MENU_STYLE_WATERFALL) { switch_mode = FUNC_SWITCH_FADE_OUT | FUNC_SWITCH_AUTO; func_cb.flag_animation = true; //淡出后进入入场动画 flag_frm_menu = false; } else { switch_mode = FUNC_SWITCH_ZOOM_FADE_EXIT | FUNC_SWITCH_AUTO; } if (flag_frm_menu) { widget_icon_t *icon; compo_form_t *frm = func_create_form(FUNC_MENU); //创建下一个任务的窗体 component_t *compo = compo_get_next((component_t *)frm->title); printf("func_switch_to_menu compo->type = %d\n",compo->type); if (compo->type == COMPO_TYPE_ICONLIST) { compo_iconlist_t *iconlist = (compo_iconlist_t *)compo; icon = compo_iconlist_select_byidx(iconlist, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_LISTBOX) { compo_listbox_t *listbox = (compo_listbox_t *)compo; icon = compo_listbox_select_byidx(listbox, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_DISKLIST) { compo_disklist_t *disklist = (compo_disklist_t *)compo; icon = compo_disklist_select_byidx(disklist, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_KALEIDOSCOPE) { compo_kaleidoscope_t *kale = (compo_kaleidoscope_t *)compo; icon = compo_kale_select_byidx(kale, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_RINGS) { compo_rings_t *rings = (compo_rings_t *)compo; icon = compo_rings_select_byidx(rings, func_cb.menu_idx); } else { halt(HALT_GUI_COMPO_ICONLIST_TYPE); return; } func_switching(switch_mode, icon); //退出动画 compo_form_destroy(frm); //切换完成或取消,销毁窗体 } else { func_switching(switch_mode, NULL); //退出动画 } func_cb.sta = FUNC_MENU; } #ifdef __SCREEN_DARK_CLOCK_SHOW__ //页面按键回退功能 void func_back_to1(void) { func_popup_break(); u8 stack_top = task_stack_pop_three(); if (stack_top == FUNC_CHARGE && !bsp_charge_sta_get()) { /* 返回充电界面但是未在充电时重新出栈 */ stack_top = task_stack_pop(); } else if (stack_top != FUNC_CHARGE && bsp_charge_sta_get()) { /* 打断过程中接入充电器,返回时恢复 */ stack_top = FUNC_CHARGE; }else if (stack_top == FUNC_SCREEN_DARK_CLOCK) { stack_top = task_stack_pop_two(); if (stack_top == FUNC_SCREEN_DARK_CLOCK) { stack_top = task_stack_pop(); if (stack_top == FUNC_SCREEN_DARK_CLOCK) stack_top = FUNC_CLOCK; } } printf("func_back_to %d\n",stack_top); if (!stack_top) { stack_top = FUNC_CLOCK; //异常返回表盘 } if (stack_top == FUNC_MENU) { func_switch_to_menu(); //返回主菜单 } else { func_switch_to(stack_top, FUNC_SWITCH_LR_ZOOM_RIGHT | FUNC_SWITCH_AUTO); //返回上一个界面 } } #endif //手动退回到主菜单 void func_switching_to_menu(void) { func_popup_break(); widget_icon_t *icon; u16 switch_mode; compo_form_t *frm = func_create_form(FUNC_MENU); //创建下一个任务的窗体 component_t *compo = compo_get_next((component_t *)frm->title); printf("func_switching_to_menu %d\n",compo->type); if (compo->type == COMPO_TYPE_ICONLIST) { compo_iconlist_t *iconlist = (compo_iconlist_t *)compo; icon = compo_iconlist_select_byidx(iconlist, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_LISTBOX) { compo_listbox_t *listbox = (compo_listbox_t *)compo; icon = compo_listbox_select_byidx(listbox, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_DISKLIST) { compo_disklist_t *disklist = (compo_disklist_t *)compo; icon = compo_disklist_select_byidx(disklist, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_KALEIDOSCOPE) { compo_kaleidoscope_t *kale = (compo_kaleidoscope_t *)compo; icon = compo_kale_select_byidx(kale, func_cb.menu_idx); } else if (compo->type == COMPO_TYPE_RINGS) { compo_rings_t *rings = (compo_rings_t *)compo; icon = compo_rings_select_byidx(rings, func_cb.menu_idx); } else { halt(HALT_GUI_COMPO_ICONLIST_TYPE); return; } if (func_cb.sta != FUNC_CLOCK || SysVariable.menu_style == MENU_STYLE_HONEYCOMB) { switch_mode = FUNC_SWITCH_ZOOM_EXIT; } else { switch_mode = FUNC_SWITCH_ZOOM_FADE_EXIT; } bool res = func_switching(switch_mode, icon); //退出动画 compo_form_destroy(frm); //切换完成或取消,销毁窗体 if (res) { func_cb.sta = FUNC_MENU; } } //页面滑动回退功能 void func_backing_to(void) { func_popup_break(); u8 stack_top = task_stack_pop(); if (stack_top == FUNC_CHARGE && !bsp_charge_sta_get()) { /* 返回充电界面但是未在充电时重新出栈 */ stack_top = task_stack_pop(); } else if (stack_top != FUNC_CHARGE && bsp_charge_sta_get()) { /* 打断过程中接入充电器,返回时恢复 */ stack_top = FUNC_CHARGE; } #ifdef __SCREEN_DARK_CLOCK_SHOW__ else if (stack_top == FUNC_SCREEN_DARK_CLOCK) { stack_top = task_stack_pop_two(); if (stack_top == FUNC_SCREEN_DARK_CLOCK) { stack_top = task_stack_pop(); if (stack_top == FUNC_SCREEN_DARK_CLOCK) stack_top = FUNC_CLOCK; } } #endif printf("func_backing_to stack_top = %d func_cb.sta = %d\n",stack_top,func_cb.sta); if (!stack_top) { stack_top = FUNC_CLOCK; //异常返回表盘 } if (stack_top == FUNC_MENU) { func_switching_to_menu(); //右滑缓慢退出任务 } else { func_switch_to(stack_top, FUNC_SWITCH_LR_ZOOM_RIGHT); //返回上一个界面 } if (func_cb.sta != stack_top) { //如果页面没切换需要重新入栈 task_stack_push(func_cb.sta); } } //页面按键回退功能 void func_back_to(void) { #if defined(TJD_MENU_ADD_BACKGROUND) sys_cb.switch_flag = TRUE; #endif func_popup_break(); u8 stack_top = task_stack_pop(); printf("func_back_to stack_top = %d func_cb.sta = %d\n",stack_top,func_cb.sta); if (stack_top == FUNC_CHARGE && !bsp_charge_sta_get()) { /* 返回充电界面但是未在充电时重新出栈 */ stack_top = task_stack_pop(); } else if (stack_top != FUNC_CHARGE && bsp_charge_sta_get()) { /* 打断过程中接入充电器,返回时恢复 */ stack_top = FUNC_CHARGE; } else if (stack_top == FUNC_SMARTSTACK) { /* 从程序坞进入的功能,返回时进入表盘*/ stack_top = FUNC_CLOCK; } printf("func_back_to %d\n",stack_top); if (!stack_top) { stack_top = FUNC_CLOCK; //异常返回表盘 } if (stack_top == FUNC_MENU) { func_switch_to_menu(); //返回主菜单 } else { func_switch_to(stack_top, FUNC_SWITCH_LR_ZOOM_RIGHT | FUNC_SWITCH_AUTO); //返回上一个界面 } } //页面直接回退,无动画效果 u8 func_directly_back_to(void) { func_popup_break(); u8 stack_top = task_stack_pop(); printf("func_directly_back_to stack_top = %d func_cb.sta = %d\n",stack_top,func_cb.sta); if (stack_top == FUNC_CHARGE && !bsp_charge_sta_get()) { /* 返回充电界面但是未在充电时重新出栈 */ stack_top = task_stack_pop(); } else if (stack_top != FUNC_CHARGE && bsp_charge_sta_get()) { /* 打断过程中接入充电器,返回时恢复 */ stack_top = FUNC_CHARGE; } if (!stack_top) { stack_top = FUNC_CLOCK; // 异常返回表盘 } func_cb.sta = stack_top; return stack_top; } #ifdef __SCREEN_DARK_CLOCK_SHOW__ //返回除熄屏表盘界面的上一级界面,无动画效果 u8 func_screen_clock_back(void) { func_popup_break(); u8 stack_top = task_stack_pop_three(); if (stack_top == FUNC_CHARGE && !bsp_charge_sta_get()) { /* 返回充电界面但是未在充电时重新出栈 */ stack_top = task_stack_pop(); } else if (stack_top != FUNC_CHARGE && bsp_charge_sta_get()) { /* 打断过程中接入充电器,返回时恢复 */ stack_top = FUNC_CHARGE; }else if(stack_top == FUNC_ALIPAY) { stack_top = FUNC_CLOCK; } if (!stack_top || stack_top == FUNC_SCREEN_DARK_CLOCK) { stack_top = FUNC_CLOCK; // 异常返回表盘 } return stack_top; } #endif /** * @description: 进入指定界面 * @param select_sta: 屏幕ID * @param is_destroy_cur: 是否销毁当前界面 * @return true:符合条件进屏,false:优先级错误 */ bool func_switch_to_assign_screen(int select_sta, bool is_destroy_cur) { bool ret = false; int cur_idx = -1, change_idx = -1; /* Already existed */ if (func_cb.sta == select_sta) { return ret; } /* Check ID */ for (int i = 0; i < FUNC_ENTRY_CNT; i++) { if (tbl_func_entry[i].func_idx == func_cb.sta) cur_idx = i; if (tbl_func_entry[i].func_idx == select_sta) change_idx = i; if (cur_idx != -1 && change_idx != -1) break; } if (cur_idx == -1 || change_idx == -1) { printf("%s(%d):ID ERROR!\n", __func__, __LINE__); return ret; } // /* Init not complete */ // if (!SysVariable.bootGuideFlag && !is_destroy_cur && select_sta != FUNC_CHARGE) { // printf("%s(%d):Init not complete!\n", __func__, __LINE__); // return ret; // } /* Max level: Not overwritable */ if (!is_destroy_cur && tbl_func_entry[change_idx].func_idx != FUNC_CLOCK && tbl_func_entry[cur_idx].level == FUNC_SCREEN_PRIORITY_LEVEL_MAX) { printf("%s(%d %d %d):Not overwritable!\n", __func__, select_sta,tbl_func_entry[change_idx].func_idx,tbl_func_entry[cur_idx].level); return ret; } /* Check priority */ if (is_destroy_cur || tbl_func_entry[change_idx].func_idx == FUNC_CLOCK || tbl_func_entry[change_idx].level >= tbl_func_entry[cur_idx].level) { if (is_destroy_cur) { task_stack_del(task_stack_find(func_cb.sta)); } msgbox_break(); func_popup_break(); func_cb.sta = tbl_func_entry[change_idx].func_idx; ret = true; } return ret; } void evt_message(size_msg_t msg) { switch (msg) { case EVT_READY_EXCHANGE_MTU: ble_exchange_mtu_request(); break; #if BT_CONNECT_REQ_FROM_WATCH_EN case EVT_BT_CONNECT_ONCE: bt_connect(1); break; #endif case EVT_HFP_SET_VOL: if(sys_cb.incall_flag & INCALL_FLAG_SCO){ bsp_change_volume(bsp_bt_get_hfp_vol(SysVariable.hfp_vol)); dac_fade_in(); printf("HFP SET VOL: %d\n", SysVariable.hfp_vol); } break; case EVT_A2DP_SET_VOL: if ((sys_cb.incall_flag & INCALL_FLAG_SCO) == 0) { printf("A2DP SET VOL: %d\n", SysVariable.vol); bsp_change_volume(SysVariable.vol); // gui_box_show_vol(); // param_sys_vol_write(); sys_cb.cm_times = 0; sys_cb.cm_vol_change = 1; if (bt_cb.music_playing) { dac_fade_in(); } } break; case EVT_A2DP_MUSIC_PLAY: if (!sbc_is_bypass()) { printf("EVT_A2DP_MUSIC_PLAY\n"); dac_fade_in(); //淡入前会先解MUTE } break; case EVT_A2DP_MUSIC_STOP: if (!sbc_is_bypass()) { printf("EVT_A2DP_MUSIC_STOP\n"); dac_fade_out(); //淡出完成会自动MUTE功放 } break; case EVT_UDE_SET_VOL: bsp_change_volume(SysVariable.vol); // gui_box_show_vol(); // param_sys_vol_write(); sys_cb.cm_times = 0; sys_cb.cm_vol_change = 1; break; case EVT_BT_SCAN_START: if (bt_get_status() < BT_STA_SCANNING && SysVariable.bt_state_set == false) { bt_scan_enable(); } break; case EVT_POPUP: func_popup(); break; #if EQ_DBG_IN_UART || EQ_DBG_IN_SPP case EVT_ONLINE_SET_EQ: eq_parse_cmd(); break; #endif #if EQ_MODE_EN case EVT_BT_SET_EQ: music_set_eq_by_num(sys_cb.eq_mode); break; #endif } } //func common message process void func_message(size_msg_t msg) { switch (msg) { case MSG_CTP_SHORT_LEFT: if (func_cb.sta == FUNC_CLOCK || func_cb.flag_sort) { func_switch_next(false, true); //切到下一个任务 } break; case MSG_CTP_SHORT_RIGHT: if ((func_cb.flag_sort)&&(func_get_order(func_cb.sta) > 0 )){ func_switch_prev(false); //切到上一个任务 } else /*if (ctp_get_sxy().x <= 32)*/ { func_backing_to(); //右滑缓慢退出任务 } break; case MSG_CTP_COVER: case EVT_SENSOR_PALMING: SysVariable.sleep_delay = 1; // 100ms后进入休眠 break; case MSG_QDEC_FORWARD: if (func_cb.sta == FUNC_CLOCK || func_cb.flag_sort) { msg_queue_detach(MSG_QDEC_FORWARD, 0); //防止不停滚动 func_switch_next(true, true); //切到下一个任务 } break; case MSG_QDEC_BACKWARD: if (func_cb.sta == FUNC_CLOCK || func_cb.flag_sort) { msg_queue_detach(MSG_QDEC_BACKWARD, 0); func_switch_prev(true); //切到下一个任务 } break; case KU_BACK: // printf("KU_BACK\n"); if (func_cb.flag_sort) { func_switch_to_clock(); //切换回主时钟 } else if (func_cb.sta == FUNC_CLOCK) { func_cb.menu_idx = 0; func_switch_to_menu(); //退回到主菜单 } else { func_back_to(); //直接退出任务 } break; case KU_LEFT: if (func_cb.flag_sort) { func_switch_to_clock(); //切换回主时钟 } else if ((func_cb.sta == FUNC_CLOCK) && !sys_cb.gui_sleep_sta) { func_clock_sub_dropdown(KU_LEFT); } else { func_switch_to_clock(); //直接退出任务 } break; case KU_RIGHT: // printf("KU_RIGHT\n"); /* if (func_cb.sta == FUNC_CLOCK) { if (SysVariable.key_definition_id == 0) func_switch_to_assign_screen(FUNC_SPORT, false); else if (SysVariable.key_definition_id == 1) func_switch_to_assign_screen(FUNC_HEARTRATE, false); else if (SysVariable.key_definition_id == 2) func_switch_to_assign_screen(FUNC_WEATHER, false); else if (SysVariable.key_definition_id == 3) func_switch_to_assign_screen(FUNC_ALARM_CLOCK, false); else if (SysVariable.key_definition_id == 4) func_switch_to_assign_screen(FUNC_FLASHLIGHT, false); else if (SysVariable.key_definition_id == 5) func_switch_to_assign_screen(FUNC_STOPWATCH, false); else func_switch_to_assign_screen(FUNC_SPORT, false); } else if (func_cb.last == FUNC_CLOCK && (func_cb.sta == FUNC_SPORT || func_cb.sta == FUNC_HEARTRATE || func_cb.sta == FUNC_WEATHER || func_cb.sta == FUNC_ALARM_CLOCK || func_cb.sta == FUNC_FLASHLIGHT || func_cb.sta == FUNC_STOPWATCH)) { func_switch_to_clock(); // 切换回主时钟 }*/ break; #if SOFT_POWER_ON_OFF case KLH_LEFT: if(bt_get_call_indicate() != BT_CALL_ACTIVE) { func_switch_to_assign_screen(FUNC_SET_SUB_OFF, false); sys_cb.motor_flag = 1; set_func_motor(80,2,2,1); } break; case KLH_BACK: case KLH_RIGHT: // printf("enter to power off by key back,left or right \n"); break; #endif case KU_MODE: func_cb.sta = FUNC_NULL; break; // case KU_LEFT: // ble_bt_connect(); //ios一键双连测试 // printf("send sm req\n"); // break; //#if EQ_MODE_EN // case KU_EQ: // sys_set_eq(); // break; //#endif // EQ_MODE_EN // // case KU_MUTE: // if (sys_cb.mute) { // bsp_sys_unmute(); // } else { // bsp_sys_mute(); // } // break; // case MSG_SYS_500MS: break; case MSG_SYS_1S: #if BT_HFP_BAT_REPORT_EN bt_hfp_report_bat(); #endif break; default: evt_message(msg); break; } //调节音量,3秒后写入flash if ((sys_cb.cm_vol_change) && (sys_cb.cm_times >= 6)) { sys_cb.cm_vol_change = 0; cm_sync(); } } ///进入一个功能的总入口 AT(.text.func) void func_enter(void) { //检查Func Heap u32 heap_size = func_heap_get_free_size(); if (heap_size <= HEAP_FUNC_SIZE/2) { TRACE("Func heap leak (%d -> %d): %d\n", func_cb.last, func_cb.sta, heap_size); halt(HALT_FUNC_HEAP); } // gui_box_clear(); param_sync(); reset_sleep_delay_all(); reset_pwroff_delay(); func_cb.mp3_res_play = NULL; func_cb.set_vol_callback = NULL; // bsp_clr_mute_sta(); // sys_cb.voice_evt_brk_en = 1; //播放提示音时,快速响应事件。 AMPLIFIER_SEL_D(); } #if SECURITY_PAY_EN static u8 alipay_buf_restore[HEAP_FUNC_ALIPAY_RESTORE_SIZE] AT(.alipay_restore.buf); #endif AT(.text.func) void func_exit(void) { //销毁窗体 if (func_cb.frm_main != NULL) { compo_form_destroy(func_cb.frm_main); } //释放FUNC控制结构体 if (func_cb.f_cb != NULL) { func_free(func_cb.f_cb); } func_cb.frm_main = NULL; func_cb.f_cb = NULL; #if SECURITY_PAY_EN if (func_cb.last == FUNC_ALIPAY) { //检查Heap //u32 heap_size = func_heap_get_free_size(); //if (heap_size != HEAP_FUNC_ALIPAY_SIZE) { // printf("ALIPAY HEAP FUNC (%d -> %d): %d\n", func_cb.last, func_cb.sta, heap_size); // halt(HALT_FUNC_HEAP); //} printf("restore func heap\n"); func_heap_init(alipay_buf_restore, HEAP_FUNC_ALIPAY_RESTORE_SIZE); } #endif // SECURITY_PAY_EN } AT(.text.func) void func_run(void) { void (*func_entry)(void) = NULL; printf("restore func heap %d\n",(int)(acos(-1)*10000)); if (func_cb.sort_cnt <= 0 || func_cb.sort_cnt > MAX_FUNC_SORT_CNT) { memset(func_cb.tbl_sort, 0, sizeof(func_cb.tbl_sort)); func_cb.tbl_sort[0] = FUNC_CLOCK; func_cb.tbl_sort[1] = FUNC_ACTIVITY; func_cb.tbl_sort[2] = FUNC_HEARTRATE; func_cb.tbl_sort[3] = FUNC_BLOOD_PRESSURE; func_cb.tbl_sort[4] = FUNC_BLOOD_OXYGEN; func_cb.tbl_sort[5] = FUNC_SLEEP; func_cb.tbl_sort[6] = FUNC_COMPO_SELECT; func_cb.sort_cnt = 7; } // func_cb.sta = FUN_DIAL_PUSH; // func_cb.sta = FUNC_BT_RING; sys_cb.tft_idle_count = 10; task_stack_init(); //任务堆栈 latest_task_init(); //最近任务 for (;;) { func_enter(); for (int i = 0; i < FUNC_ENTRY_CNT; i++) { if (tbl_func_entry[i].func_idx == func_cb.sta) { task_stack_push(func_cb.sta); latest_task_add(func_cb.sta); func_entry = tbl_func_entry[i].func; func_entry(); break; } } if (func_cb.sta == FUNC_PWROFF) { func_pwroff(1); } func_exit(); } }