952 lines
34 KiB
C
952 lines
34 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
#include "func_clock.h"
|
|
#include "app_variable.h"
|
|
#include "spirit_island_api.h"
|
|
#include "func_special_clock.h"
|
|
|
|
#if TRACE_EN
|
|
#define TRACE(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define TRACE(...)
|
|
#endif
|
|
|
|
#define LOCAL_CONTENT_LOCATION_NUM (2)
|
|
#define LOCAL_ALL_ICON_START_X (45)//(57)
|
|
|
|
#define LOCAL_ALL_ICON_START_UP_Y (40)
|
|
#define LOCAL_ALL_ICON_START_DOWN_Y (GUI_SCREEN_HEIGHT - LOCAL_ALL_ICON_START_UP_Y)
|
|
#define LOCAL_ALL_ICON_INTERVAL (20)
|
|
#define LOCAL_DATA_INTERVAK (10)
|
|
|
|
|
|
#define WALLPAPER_TIME_CNT 11 // 图片时间切图数量
|
|
#define WALLPAPER_DATE_CNT 11 // 图片日期切图数量
|
|
#define WALLPAPER_WEEK_CNT 7 // 星期图片切图数量
|
|
|
|
#define DIALPLATE_NUM (sizeof(dialplate_info) / sizeof(u32))
|
|
|
|
#define DIALPLATE_DYNAMIC_IDX (1) //动态数字表盘下标序号
|
|
|
|
const u32 dialplate_info[] = {
|
|
#ifdef __SPECIAL_CLOCK_0002_240X296__
|
|
SPECIAL_CLOCK2,
|
|
#endif
|
|
// UI_BUF_DIALPLATE_5_BIN,
|
|
#ifdef __SPECIAL_CLOCK_0001_240X296__
|
|
SPECIAL_CLOCK1,
|
|
#endif
|
|
UI_BUF_DIALPLATE_2_BIN,
|
|
#ifdef CLOCK_DYNAMIC_NUMBER
|
|
1,//代表动态数字表盘给它在这里占一个位置
|
|
#endif
|
|
// UI_BUF_DIALPLATE_3_BIN,
|
|
UI_BUF_DIALPLATE_4_BIN,
|
|
UI_BUF_DIALPLATE_5_BIN,
|
|
UI_BUF_DIALPLATE_6_BIN,
|
|
UI_BUF_DIALPLATE_7_BIN,
|
|
|
|
PUSH_DIAL_BASE,
|
|
};
|
|
//表盘快捷按钮编号表(前面的接口注意尽量和表盘工具文本保持一致)
|
|
const u8 quick_btn_tbl[] =
|
|
{
|
|
FUNC_NULL,
|
|
FUNC_HEARTRATE,//心率
|
|
FUNC_BT,//蓝牙音乐
|
|
FUNC_ALARM_CLOCK,//闹钟
|
|
FUNC_BLOOD_OXYGEN,//血氧
|
|
FUNC_BLOODSUGAR,//血糖
|
|
FUNC_BLOOD_PRESSURE,//血压
|
|
FUNC_BREATHE,//呼吸
|
|
FUNC_CALCULATOR,//计算器
|
|
FUNC_CAMERA,//摇一摇拍照
|
|
FUNC_TIMER,//定时器
|
|
FUNC_SLEEP,//睡眠
|
|
FUNC_STOPWATCH,//秒表
|
|
FUNC_WEATHER,//天气
|
|
//FUNC_GAME_KNIFE, //游戏改为了射箭游戏
|
|
FUNC_GAME,//游戏
|
|
FUNC_STYLE,//风格菜单
|
|
FUNC_ALTITUDE, //海拔
|
|
FUNC_MAP,//地图
|
|
FUNC_MESSAGE,//消息
|
|
FUNC_SCAN,//二维码
|
|
FUNC_VOICE,//语音助手
|
|
FUNC_ALIPAY,//支付宝
|
|
FUNC_COMPASS,//指南针
|
|
FUNC_ADDRESS_BOOK,//电话本
|
|
FUNC_SPORT,//多运动
|
|
FUNC_CALL,//拨号
|
|
FUNC_FINDPHONE,//查找手机
|
|
FUNC_CALENDAER,//日历
|
|
FUNC_ACTIVITY,//计步数据
|
|
FUNC_FLASHLIGHT,//手电筒
|
|
FUNC_SETTING,//设置,后续的需要往后加
|
|
FUNC_GAME_KNIFE, //射箭游戏
|
|
};
|
|
|
|
|
|
|
|
int compo_get_animation_id(void);
|
|
void compo_animation_manual_next(compo_animation_t *animation);
|
|
void func_switch_to(u8 sta, u16 switch_mode);
|
|
|
|
u8 func_clock_get_max_dialplate_num(void)
|
|
{
|
|
u8 max_dialplate_num = (sizeof(dialplate_info) / sizeof(u32));
|
|
|
|
if(SysVariable.dial_watch == 0)
|
|
max_dialplate_num --;
|
|
|
|
return max_dialplate_num;
|
|
}
|
|
|
|
u32 func_clock_get_dialplate_info(u8 index)
|
|
{
|
|
return dialplate_info[index];
|
|
}
|
|
|
|
#ifdef TJD_GUI_SPIRIT_ISLAND_SHOW
|
|
void spirit_island_create(compo_form_t *frm)
|
|
{
|
|
widget_page_t *temp_page = frm->page_body;
|
|
frm->page_body = frm->page;
|
|
|
|
// 创建按键
|
|
compo_shape_t *grey_shape;
|
|
grey_shape = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE, 18);
|
|
compo_setid(grey_shape, COMPO_ID_BTN_ISLAND_RECT);
|
|
compo_shape_set_color(grey_shape, make_color(122, 122, 122));
|
|
compo_shape_set_location(grey_shape, GUI_SCREEN_CENTER_X, 25, 162, 36);
|
|
compo_shape_set_alpha(grey_shape, 120);
|
|
compo_shape_set_visible(grey_shape, false);
|
|
|
|
compo_button_t *btn = compo_button_create(frm);
|
|
compo_setid(btn, COMPO_ID_BTN_ISLAND_BG);
|
|
compo_button_set_location(btn, GUI_SCREEN_CENTER_X, 25, 162, 36);
|
|
compo_button_set_visible(btn, false);
|
|
|
|
compo_picturebox_t *pic = compo_picturebox_create(frm, UI_BUF_MESSAGE_PUSH_MESSAGE_BIN);
|
|
compo_setid(pic, COMPO_ID_PIC_ISLAND_ICON);
|
|
compo_picturebox_set_pos(pic, 62, 25);
|
|
compo_picturebox_set_size(pic, 30, 30);
|
|
compo_picturebox_set_visible(pic, false);
|
|
|
|
pic = compo_picturebox_create(frm, UI_BUF_MESSAGE_RED_REMIND_BIN);
|
|
compo_setid(pic, COMPO_ID_PIC_ISLAND_RED_REMIND);
|
|
compo_picturebox_set_pos(pic, 72, 15);
|
|
compo_picturebox_set_visible(pic, false);
|
|
|
|
// 创建文本
|
|
compo_textbox_t *txt = compo_textbox_create(frm, 50);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 20, 25, 100, 30);
|
|
compo_setid(txt, COMPO_ID_TXT_ISLAND_NOTICE);
|
|
compo_textbox_set_autoroll_mode(txt, TEXT_AUTOROLL_MODE_SROLL_CIRC);
|
|
compo_textbox_set_visible(txt, false);
|
|
SysVariable.SpiritIsland_New_Event = true;
|
|
|
|
compo_picturebox_t *picbox = compo_picturebox_create_coordinate(frm, 0, GUI_SCREEN_CENTER_X + 12, 25, COMPO_ID_PIC_LINDONG_MUSIC, true);
|
|
|
|
frm->page_body = temp_page;
|
|
}
|
|
|
|
void spirit_island_update(void)
|
|
{
|
|
// u8 min,sec;
|
|
// u16 msec;
|
|
// char str_buff[9];
|
|
spirit_island_controls_t *g_spirit_island;
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
static bool music_flag = true;
|
|
|
|
compo_shape_t *grey_shape = compo_getobj_byid(COMPO_ID_BTN_ISLAND_RECT);
|
|
compo_button_t *btn = compo_getobj_byid(COMPO_ID_BTN_ISLAND_BG);
|
|
compo_picturebox_t * icon = compo_getobj_byid(COMPO_ID_PIC_ISLAND_ICON);
|
|
compo_picturebox_t * icon_notice = compo_getobj_byid(COMPO_ID_PIC_ISLAND_RED_REMIND);
|
|
compo_textbox_t * txt_notice = compo_getobj_byid(COMPO_ID_TXT_ISLAND_NOTICE);
|
|
compo_picturebox_t * music_bg = compo_getobj_byid(COMPO_ID_PIC_LINDONG_MUSIC);
|
|
|
|
if (!bt_is_connected()&&music_flag==true)
|
|
{
|
|
SysVariable.SpiritIsland_New_Event = true;
|
|
music_flag = false;
|
|
}
|
|
else if(bt_is_connected())
|
|
{
|
|
music_flag = true;
|
|
}
|
|
static u32 ticks=0;
|
|
static u8 lindong_music_num = 0;
|
|
if (SysVariable.SpiritIslandSwitch == true)
|
|
{
|
|
g_spirit_island = si_enforce_task();
|
|
if (g_spirit_island->type == music)
|
|
{
|
|
if (bt_is_connected())
|
|
{
|
|
if (tick_check_expire(ticks, 400))
|
|
{
|
|
ticks = tick_get();
|
|
lindong_music_num++;
|
|
if (lindong_music_num >= 2)
|
|
lindong_music_num = 0;
|
|
|
|
compo_picturebox_set_visible(music_bg, true);
|
|
compo_picturebox_set(music_bg, UI_BUF_LINDONG_MUSIC_BIN);
|
|
compo_picturebox_cut(music_bg, lindong_music_num, 2);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_spirit_island->type = none;
|
|
SysVariable.SpiritIsland_New_Event = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(SysVariable.SpiritIsland_New_Event == true)
|
|
{
|
|
SysVariable.SpiritIsland_New_Event = false;
|
|
if(SysVariable.SpiritIslandSwitch == true)
|
|
{
|
|
//执行顶端任务
|
|
g_spirit_island = si_enforce_task();
|
|
|
|
/* 由于消息通知是多个共用一个类型,防止多类型消息时读完后未更新 */
|
|
if (g_spirit_island->type == message)
|
|
{
|
|
s8 check_ret = message_history_unread_type_get(g_spirit_island->message_type);
|
|
if (check_ret == -1)
|
|
{
|
|
/* 已无历史消息,删除消息任务 */
|
|
si_delet_task(message);
|
|
g_spirit_island = si_enforce_task();
|
|
}
|
|
else /* 找到历史消息 */
|
|
{
|
|
g_spirit_island->message_type = check_ret;
|
|
}
|
|
}
|
|
else if(g_spirit_island->type == music)
|
|
{
|
|
if (!bt_is_connected())
|
|
{
|
|
g_spirit_island->type = none;
|
|
}
|
|
}
|
|
|
|
if (g_spirit_island == NULL)
|
|
return;
|
|
|
|
// printf("spirit_island_update = %d",g_spirit_island->type);
|
|
|
|
switch (g_spirit_island->type)
|
|
{
|
|
case none:
|
|
case nomessage:
|
|
compo_shape_set_visible(grey_shape, true);
|
|
compo_button_set_visible(btn, true);
|
|
compo_picturebox_set_visible(icon, false);
|
|
compo_picturebox_set_visible(icon_notice, false);
|
|
compo_textbox_set_location(txt_notice, GUI_SCREEN_CENTER_X, 7+18,100,30);
|
|
compo_textbox_set_font(txt_notice, UI_BUF_0FONT_FONT_BIN);
|
|
compo_textbox_set(txt_notice, i18n[STR_NO_MESSAGE]);
|
|
compo_textbox_set_visible(txt_notice, true);
|
|
compo_textbox_set_forecolor(txt_notice, COLOR_WHITE);
|
|
compo_picturebox_set_visible(music_bg, false);
|
|
break;
|
|
case message:
|
|
compo_shape_set_visible(grey_shape, true);
|
|
compo_button_set_visible(btn, true);
|
|
compo_picturebox_set(icon,UI_BUF_MESSAGE_PUSH_MESSAGE_BIN); //预防在有未读消息时,播放音乐,再暂停音乐导致图片未更新,图标显示有误
|
|
compo_picturebox_cut(icon, get_message_icon(g_spirit_island->message_type), MESSAGE_ITEM_CNT);
|
|
compo_picturebox_set_size(icon, 30, 30);
|
|
compo_picturebox_set_visible(icon, true);
|
|
compo_picturebox_set_visible(icon_notice, BleProtocol_Message_Judge_Noread() & SysVariable.red_dot_reminder);
|
|
compo_textbox_set_location(txt_notice, 134, 7+18,100,30);
|
|
compo_textbox_set_font(txt_notice, UI_BUF_0FONT_FONT_BIN);
|
|
compo_textbox_set(txt_notice, i18n[STR_NEW_MESSAGE]);
|
|
compo_textbox_set_visible(txt_notice, true);
|
|
compo_picturebox_set_visible(music_bg, false);
|
|
break;
|
|
case music:
|
|
compo_shape_set_visible(grey_shape, true);
|
|
compo_button_set_visible(btn, true);
|
|
compo_picturebox_set(icon, UI_BUF_ICON_MUSIC_BIN);
|
|
compo_picturebox_cut(icon, 0, 1);
|
|
compo_picturebox_set_size(icon, 30, 30);
|
|
compo_picturebox_set_visible(icon, true);
|
|
compo_picturebox_set_visible(icon_notice, false);
|
|
compo_textbox_set_location(txt_notice, 134, 7+18,100,30);
|
|
compo_textbox_set_font(txt_notice, UI_BUF_0FONT_FONT_BIN);
|
|
compo_textbox_set(txt_notice, i18n[STR_PLAYING_MUSIC]);
|
|
compo_textbox_set_visible(txt_notice, false);
|
|
compo_picturebox_set(music_bg, UI_BUF_LINDONG_MUSIC_BIN);
|
|
compo_picturebox_cut(music_bg, f_clock->lindong_music_num, 2);
|
|
compo_picturebox_set_visible(music_bg, true);
|
|
break;
|
|
case stopwatch:
|
|
{
|
|
u8 min, sec;
|
|
u16 msec;
|
|
char str_buff[10] = {0};
|
|
|
|
min = ((sys_cb.stopwatch_total_msec / 1000) % 3600) / 60;
|
|
sec = (sys_cb.stopwatch_total_msec / 1000) % 60;
|
|
msec = sys_cb.stopwatch_total_msec % 1000;
|
|
SysVariable.SpiritIsland_New_Event = true;
|
|
snprintf(str_buff, sizeof(str_buff), "%02d:%02d.%02d", min, sec, msec / 10);
|
|
compo_shape_set_visible(grey_shape, true);
|
|
compo_button_set_visible(btn, true);
|
|
compo_picturebox_set(icon, UI_BUF_DYNAMIC_ISLAND_STOPWATCH_BIN);
|
|
compo_picturebox_cut(icon, 0, 1);
|
|
compo_picturebox_set_size(icon, 30, 30);
|
|
compo_picturebox_set_visible(icon, true);
|
|
compo_picturebox_set_visible(icon_notice, false);
|
|
compo_textbox_set(txt_notice, str_buff);
|
|
compo_textbox_set_font(txt_notice, UI_BUF_0FONT_FONT_STOPWATCH_16_BIN);
|
|
compo_textbox_set_location(txt_notice, 134, 7 + 18, 100, 30);
|
|
compo_textbox_set_visible(txt_notice, true);
|
|
compo_picturebox_set_visible(music_bg, false);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
compo_shape_set_visible(grey_shape, false);
|
|
compo_button_set_visible(btn, false);
|
|
compo_picturebox_set_visible(icon, false);
|
|
compo_picturebox_set_visible(icon_notice, false);
|
|
compo_textbox_set_visible(txt_notice, false);
|
|
compo_picturebox_set_visible(music_bg, false);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//单击按钮
|
|
static uint8_t spirit_island_click(void)
|
|
{
|
|
if (SysVariable.SpiritIslandSwitch == true)
|
|
{
|
|
// 执行顶端任务
|
|
spirit_island_controls_t *g_spirit_island;
|
|
g_spirit_island = si_enforce_task();
|
|
if (g_spirit_island == NULL)
|
|
return false;
|
|
point_t pt = ctp_get_sxy();
|
|
compo_button_t *btn = (compo_button_t *)compo_getobj_byid(COMPO_ID_BTN_ISLAND_BG);
|
|
rect_t rect = widget_get_absolute(btn->widget);
|
|
// printf("[%d,%d,%d,%d,%d,%d]\n", pt.x, pt.y, rect.x, rect.y, rect.wid, rect.hei);
|
|
if (abs_s(pt.x - rect.x) * 2 <= rect.wid && abs_s(pt.y - rect.y) * 2 <= rect.hei)
|
|
{
|
|
switch (g_spirit_island->type)
|
|
{
|
|
case nomessage:
|
|
break;
|
|
case message:
|
|
#ifndef TJD_MENU_REMOVE_WECHAT_AND_QQ_ICON
|
|
if (g_spirit_island->message_type == MsgType_QQ)
|
|
func_switch_to_assign_screen(FUNC_SET_QQ, false);
|
|
else if (g_spirit_island->message_type == MsgType_WeChat)
|
|
func_switch_to_assign_screen(FUNC_SET_WECHAT, false);
|
|
else
|
|
#endif
|
|
if (g_spirit_island->message_type == MsgType_Facebook)
|
|
func_switch_to_assign_screen(FUNC_SET_FACEBOOK, false);
|
|
else if (g_spirit_island->message_type == MsgType_Twitter)
|
|
func_switch_to_assign_screen(FUNC_SET_TWITTER, false);
|
|
else if (g_spirit_island->message_type == MsgType_WhatsApp)
|
|
func_switch_to_assign_screen(FUNC_SET_WHATSAPP, false);
|
|
else
|
|
func_switch_to_assign_screen(FUNC_MESSAGE, false);
|
|
break;
|
|
case music:
|
|
func_switch_to_assign_screen(FUNC_BT, false);
|
|
break;
|
|
case stopwatch:
|
|
func_switch_to_assign_screen(FUNC_STOPWATCH, false);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//单击按钮
|
|
static void func_clock_button_click(void)
|
|
{
|
|
point_t pt = ctp_get_sxy();
|
|
|
|
#ifdef TJD_GUI_SPIRIT_ISLAND_SHOW
|
|
if(spirit_island_click())
|
|
return;
|
|
#endif
|
|
|
|
u16 btn_id = compo_get_button_id();
|
|
u16 animation_id = compo_get_animation_id();
|
|
// printf("func_clock_button_click btn_id = %d\n",btn_id);
|
|
|
|
if(btn_id == COMPO_ID_BTN_ISLAND_BG)//不是快捷 button
|
|
return;
|
|
|
|
#ifdef TJD_GUI_CLOCK_DARGON_CLOCK_TOUCH
|
|
if ((pt.y > 75 && pt.x > 155 && pt.x < 210 &&pt.y < 130) && (SysVariable.dialplate_index == 3))
|
|
{
|
|
func_switch_to(FUNC_MESSAGE, FUNC_SWITCH_LR_ZOOM_LEFT | FUNC_SWITCH_AUTO);
|
|
}
|
|
#endif
|
|
|
|
if (btn_id) {
|
|
switch(SysVariable.dialplate_index)
|
|
{
|
|
#ifdef __SPECIAL_CLOCK_0001_240X296__
|
|
case SPECIAL_CLOCK1: //这里的4代表bin文件中的表盘个数
|
|
special_customs_clock_button_click(btn_id);
|
|
break;
|
|
#endif
|
|
#ifdef __SPECIAL_CLOCK_0002_240X296__
|
|
case SPECIAL_CLOCK2:
|
|
special_customs_clock_button_click_0002_240X296(btn_id);
|
|
break;
|
|
#endif
|
|
default:
|
|
if(func_binarySearch(quick_btn_tbl[btn_id]))
|
|
{
|
|
func_switch_to(quick_btn_tbl[btn_id], FUNC_SWITCH_LR_ZOOM_LEFT | FUNC_SWITCH_AUTO);
|
|
}
|
|
break;
|
|
}
|
|
} else if (animation_id) {
|
|
compo_animation_t *animation = compo_getobj_byid(animation_id);
|
|
if (animation->bond_data == COMPO_BOND_IMAGE_CLICK) {
|
|
compo_animation_manual_next(animation);
|
|
} else if (animation->bond_data == COMPO_BOND_ANIMATION_AREA_CLICK) {
|
|
compo_animation_click_set_vis(animation);
|
|
}
|
|
}
|
|
|
|
/* 动态数字 */
|
|
#ifdef CLOCK_DYNAMIC_NUMBER
|
|
if (SysVariable.dialplate_index == DIALPLATE_DYNAMIC_IDX) {
|
|
func_dynamic_figure_clock_click();
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void wallpaper_time_show_content(compo_form_t *frm,int16_t y)
|
|
{
|
|
compo_textbox_t *txt;
|
|
//时间
|
|
txt = compo_textbox_create(frm, 3);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_TIME_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X - 38 + 2 -5, y+20,GUI_SCREEN_WIDTH-40,120);
|
|
compo_bonddata(txt, COMPO_BOND_HOUR);
|
|
|
|
txt = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_TIME_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X , y+20,GUI_SCREEN_WIDTH-40,120);
|
|
compo_textbox_set(txt, ":");
|
|
|
|
txt = compo_textbox_create(frm, 3);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_TIME_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 33 + 2 +5, y+20,GUI_SCREEN_WIDTH-40,120);
|
|
compo_bonddata(txt, COMPO_BOND_MINUTE);
|
|
}
|
|
static uint16_t tjd_wallpaper_show_content(compo_form_t *frm, TimeUpDownCon content, uint8_t index, int16_t x, int16_t y)
|
|
{
|
|
int16_t highTemp = 0;
|
|
compo_picturebox_t *pic;
|
|
compo_textbox_t *txt;
|
|
|
|
char buf[TEXTBOX_TEXT_BUF_LEN] = {0};
|
|
char week_en_text[][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
|
|
#if defined(__LANGUAGE_SM_CHINESE__)
|
|
char week_ch_text[][12] = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
|
|
#endif
|
|
|
|
|
|
switch ((uint8_t)content) {
|
|
case Up_Date:
|
|
//星期
|
|
txt = compo_textbox_create(frm, 12);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X - 30 - 5, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
#if defined(__LANGUAGE_SM_CHINESE__)
|
|
if (tjd_Get_Language_Current_Index() == LANGUAGE_TYPE_Chinese)
|
|
compo_textbox_set(txt, week_ch_text[SysVariable.Rtc.weekday]);
|
|
else
|
|
#endif
|
|
compo_textbox_set(txt, week_en_text[SysVariable.Rtc.weekday]);
|
|
|
|
//日期
|
|
txt = compo_textbox_create(frm, 12);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 50 - 10, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
compo_bonddata(txt, COMPO_BOND_DATE);
|
|
|
|
break;
|
|
case Up_Sleep:
|
|
pic = compo_picturebox_create(frm, UI_BUF_WALLPAPER_ICON_BIN);
|
|
compo_picturebox_cut(pic, 2, 3); // 默认第1张图
|
|
compo_picturebox_set_pos(pic, GUI_SCREEN_CENTER_X - 57, y + 7);
|
|
|
|
//睡眠日总时长详情
|
|
txt = compo_textbox_create(frm, 3);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X- 33 , y+4,GUI_SCREEN_WIDTH/3,40);
|
|
snprintf(buf, sizeof(buf), "%02d", SysVariable.sleep.totalTime / 60);
|
|
compo_textbox_set(txt, buf);
|
|
|
|
txt = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X - 10, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
compo_textbox_set(txt, "H");
|
|
|
|
txt = compo_textbox_create(frm, 3);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 18, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
snprintf(buf, sizeof(buf), "%02d", SysVariable.sleep.totalTime % 60);
|
|
compo_textbox_set(txt, buf);
|
|
|
|
txt = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 43, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
compo_textbox_set(txt, "M");
|
|
break;
|
|
case Up_Heart:
|
|
pic = compo_picturebox_create(frm, UI_BUF_WALLPAPER_ICON_BIN);
|
|
compo_picturebox_cut(pic, 1, 3); // 默认第1张图
|
|
compo_picturebox_set_pos(pic, GUI_SCREEN_CENTER_X - 42 - 10, y + 4);
|
|
|
|
//心率
|
|
txt = compo_textbox_create(frm, 4);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X - 10 - 10, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
compo_bonddata(txt, COMPO_BOND_HEARTRATE);
|
|
|
|
txt = compo_textbox_create(frm, 4);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 30, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
#if defined(__LANGUAGE_SM_CHINESE__)
|
|
if (tjd_Get_Language_Current_Index() == LANGUAGE_TYPE_Chinese)
|
|
compo_textbox_set(txt, "次/分");
|
|
else
|
|
#endif
|
|
compo_textbox_set(txt, "BPM");
|
|
break;
|
|
case Up_Step:
|
|
pic = compo_picturebox_create(frm, UI_BUF_WALLPAPER_ICON_BIN);
|
|
compo_picturebox_cut(pic, 0, 3); // 默认第1张图
|
|
compo_picturebox_set_pos(pic, GUI_SCREEN_CENTER_X - 70, y + 4);
|
|
|
|
//心率
|
|
txt = compo_textbox_create(frm, 6);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X-25 , y+4,GUI_SCREEN_WIDTH/3,40);
|
|
compo_bonddata(txt, COMPO_BOND_STEP);
|
|
|
|
txt = compo_textbox_create(frm, 5);
|
|
compo_textbox_set_font(txt,UI_BUF_WALLPAPER_WALLPAPER_DATEWEEK_FONT_BIN);
|
|
compo_textbox_set_location(txt, GUI_SCREEN_CENTER_X + 37, y+4,GUI_SCREEN_WIDTH/3,40);
|
|
#if defined(__LANGUAGE_SM_CHINESE__)
|
|
if (tjd_Get_Language_Current_Index() == LANGUAGE_TYPE_Chinese)
|
|
compo_textbox_set(txt, "步数");
|
|
else
|
|
#endif
|
|
compo_textbox_set(txt, "STEP");
|
|
break;
|
|
}
|
|
return highTemp;
|
|
}
|
|
|
|
compo_form_t *func_clock_form_create(void)
|
|
{
|
|
compo_form_t *frm = NULL;
|
|
|
|
/* 表盘ID异常处理 */
|
|
if(SysVariable.dialplate_index >= func_clock_get_max_dialplate_num()) {
|
|
SysVariable.dialplate_index = 0;
|
|
}
|
|
|
|
if ((SysVariable.dial_watch == 2) && SysVariable.dialplate_index == (func_clock_get_max_dialplate_num() - 1)) // 自定义壁纸//
|
|
{
|
|
int16_t curY;
|
|
int16_t highTemp = 40;
|
|
TimeInfo_T timeInfo = tjd_get_wallpaper_time_info();
|
|
u32 base_addr = dialplate_info[SysVariable.dialplate_index];
|
|
// timeInfo.location = Loca_Down;
|
|
// timeInfo.up = Up_Date;
|
|
// timeInfo.down = Up_Date;
|
|
frm = compo_form_create(true);
|
|
compo_form_add_image(frm, base_addr, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y);
|
|
if (timeInfo.location == Loca_Up)
|
|
{
|
|
curY = LOCAL_ALL_ICON_START_UP_Y;
|
|
if (timeInfo.up != Up_Close)
|
|
{
|
|
tjd_wallpaper_show_content(frm, timeInfo.up, 0, LOCAL_ALL_ICON_START_X, curY);
|
|
curY += LOCAL_ALL_ICON_INTERVAL;
|
|
}
|
|
|
|
wallpaper_time_show_content(frm, curY);
|
|
// tjd_ui_draw_num_id(return_menu, ID_UI_watch_wallpaper_time_00, LOCAL_ALL_ICON_START_X, curY, ICON_NUM_GREY4bit, timeStr, color);
|
|
curY += highTemp + LOCAL_ALL_ICON_INTERVAL;
|
|
if (timeInfo.down != Up_Close)
|
|
{
|
|
tjd_wallpaper_show_content(frm, timeInfo.down, 1, LOCAL_ALL_ICON_START_X, curY);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
curY = LOCAL_ALL_ICON_START_DOWN_Y;
|
|
if (timeInfo.down != Up_Close)
|
|
{
|
|
tjd_wallpaper_show_content(frm, timeInfo.down, 1, LOCAL_ALL_ICON_START_X, curY);
|
|
curY -= (highTemp + LOCAL_ALL_ICON_INTERVAL);
|
|
}
|
|
else
|
|
{
|
|
curY -= LOCAL_ALL_ICON_INTERVAL;
|
|
}
|
|
|
|
wallpaper_time_show_content(frm, curY);
|
|
curY -= (LOCAL_ALL_ICON_INTERVAL);
|
|
// tjd_ui_draw_num_id(return_menu, ID_UI_watch_wallpaper_time_00, LOCAL_ALL_ICON_START_X, curY, ICON_NUM_GREY4bit, timeStr, color);
|
|
if (timeInfo.up != Up_Close)
|
|
{
|
|
tjd_wallpaper_show_content(frm, timeInfo.up, 0, LOCAL_ALL_ICON_START_X, curY);
|
|
}
|
|
}
|
|
}
|
|
#ifdef CLOCK_DYNAMIC_NUMBER
|
|
else if (SysVariable.dialplate_index == DIALPLATE_DYNAMIC_IDX) {
|
|
frm = func_dynamic_figure_clock_create();
|
|
}
|
|
#endif
|
|
else
|
|
{
|
|
frm = compo_form_create(true);
|
|
u32 base_addr = dialplate_info[SysVariable.dialplate_index];
|
|
u16 compo_num = bsp_uitool_header_phrase(base_addr);
|
|
switch(SysVariable.dialplate_index)
|
|
{
|
|
#ifdef __SPECIAL_CLOCK_0001_240X296__
|
|
case SPECIAL_CLOCK1:
|
|
special_customs_clock(frm);
|
|
break;
|
|
#endif
|
|
#ifdef __SPECIAL_CLOCK_0002_240X296__
|
|
case SPECIAL_CLOCK2:
|
|
special_customs_clock_0002_240X296(frm);
|
|
break;
|
|
#endif
|
|
default:
|
|
if (!compo_num)
|
|
{
|
|
halt(HALT_GUI_DIALPLATE_HEAD);
|
|
}
|
|
bsp_uitool_create(frm, base_addr, compo_num);
|
|
break;
|
|
}
|
|
}
|
|
|
|
#ifdef TJD_GUI_SPIRIT_ISLAND_SHOW
|
|
spirit_island_create(frm);
|
|
#endif
|
|
return frm;
|
|
}
|
|
|
|
//自定义表盘销毁重建
|
|
void func_clock_form_update(void)
|
|
{
|
|
if (SysVariable.dial_update_flag == true) {
|
|
//更新
|
|
if (func_cb.frm_main != NULL) {
|
|
compo_form_destroy(func_cb.frm_main);
|
|
}
|
|
|
|
func_cb.frm_main = func_clock_form_create();
|
|
SysVariable.dial_update_flag = false;
|
|
}
|
|
}
|
|
//由于现在编码器转动一次会出现响应多次事件的原因,在规定时间内只响应一次编码器事件,后续后面编码器消抖后可去掉此接口
|
|
void func_clock_qdec_time(void)
|
|
{
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
u32 tick=tick_get();
|
|
if(f_clock->qdec_flag==false&&tick-f_clock->qdec_time>=60)
|
|
{
|
|
f_clock->qdec_flag=true;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//子功能公共事件处理
|
|
void func_clock_sub_process(void)
|
|
{
|
|
|
|
|
|
#ifdef TJD_GUI_SPIRIT_ISLAND_SHOW
|
|
spirit_island_update();
|
|
#endif
|
|
func_process(); //刷新UI
|
|
}
|
|
|
|
|
|
|
|
/* 自定义表盘任务回调(放入需做好条件保护) */
|
|
static bool clock_enter_flag = false;
|
|
void func_clock_custom_process(void)
|
|
{
|
|
if (func_cb.sta != FUNC_CLOCK || clock_enter_flag == false) {
|
|
return;
|
|
}
|
|
|
|
/* 动态数字 */
|
|
#ifdef CLOCK_DYNAMIC_NUMBER
|
|
if (SysVariable.dialplate_index == DIALPLATE_DYNAMIC_IDX) {
|
|
func_dynamic_figure_clock_process();
|
|
}
|
|
#endif
|
|
}
|
|
|
|
//子功能公共消息处理
|
|
void func_clock_sub_message(size_msg_t msg)
|
|
{
|
|
func_message(msg);
|
|
}
|
|
|
|
//时钟表盘功能事件处理
|
|
static void func_clock_process(void)
|
|
{
|
|
//后续用不同类型或者数组区别不同表盘
|
|
switch(SysVariable.dialplate_index)
|
|
{
|
|
#ifdef __SPECIAL_CLOCK_0001_240X296__
|
|
case SPECIAL_CLOCK1:
|
|
special_customs_clock_process();
|
|
break;
|
|
#endif
|
|
#ifdef __SPECIAL_CLOCK_0002_240X296__
|
|
case SPECIAL_CLOCK2:
|
|
special_customs_clock_process_0002_240X296();
|
|
break;
|
|
#endif
|
|
default:
|
|
|
|
break;
|
|
}
|
|
|
|
func_clock_qdec_time();
|
|
#ifdef TJD_GUI_SPIRIT_ISLAND_SHOW
|
|
spirit_island_update();
|
|
#endif
|
|
func_process(); //刷新UI
|
|
func_clock_form_update();
|
|
}
|
|
|
|
static void func_clock_swith(bool dir)
|
|
{
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
f_clock->qdec_flag=false;
|
|
f_clock->qdec_time=tick_get();
|
|
if (dir) {
|
|
SysVariable.dialplate_index++;
|
|
//if (SysVariable.dialplate_index > func_clock_get_max_dialplate_num() - 1+SPECIAL_CLOCK_END-1) {
|
|
if (SysVariable.dialplate_index > func_clock_get_max_dialplate_num() - 1) {
|
|
SysVariable.dialplate_index = 0;
|
|
}
|
|
} else {
|
|
if (SysVariable.dialplate_index == 0) {
|
|
SysVariable.dialplate_index = func_clock_get_max_dialplate_num() - 1;
|
|
} else {
|
|
SysVariable.dialplate_index--;
|
|
}
|
|
}
|
|
// printf("dialplate index:%d\n", SysVariable.dialplate_index);
|
|
compo_form_destroy(func_cb.frm_main);
|
|
func_cb.frm_main = func_clock_form_create();
|
|
}
|
|
|
|
void func_clock_sub_end_message(size_msg_t msg)
|
|
{
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
switch (msg) {
|
|
case KU_BACK:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
if(f_clock->back_click>2)
|
|
{
|
|
f_clock->back_click=0;
|
|
}
|
|
f_clock->back_click++;
|
|
}
|
|
break;
|
|
case KD_BACK:
|
|
if(f_clock->back_click==2)
|
|
{
|
|
func_switch_to(FUNC_SMARTSTACK, FUNC_SWITCH_ZOOM_FADE_ENTER | FUNC_SWITCH_AUTO);
|
|
}
|
|
f_clock->back_click=0;
|
|
break;
|
|
case KTH_BACK:
|
|
f_clock->back_click=0;
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
//时钟表盘功能消息处理
|
|
static void func_clock_message(size_msg_t msg)
|
|
{
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
switch (msg) {
|
|
|
|
|
|
case MSG_CTP_SHORT_UP:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
func_clock_sub_card();
|
|
}
|
|
SysVariable.SpiritIsland_New_Event = true;//强制重新刷新
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_RIGHT:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
func_switch_to(FUNC_SIDEBAR, FUNC_SWITCH_LR_ZOOM_RIGHT); //右滑界面
|
|
}
|
|
SysVariable.SpiritIsland_New_Event = true;//强制重新刷新
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_DOWN:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
func_clock_sub_dropdown(MSG_CTP_SHORT_DOWN); // 下拉菜单
|
|
}
|
|
SysVariable.SpiritIsland_New_Event = true;//强制重新刷新
|
|
break;
|
|
|
|
case MSG_CTP_CLICK:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
func_clock_button_click();
|
|
}
|
|
break;
|
|
|
|
case MSG_QDEC_BACKWARD:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
if(f_clock->qdec_flag==true)
|
|
{
|
|
func_clock_swith(false);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case MSG_QDEC_FORWARD:
|
|
if (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
if(f_clock->qdec_flag==true)
|
|
{
|
|
|
|
func_clock_swith(true);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KU_DELAY_BACK:
|
|
if (f_clock->back_click != 0)
|
|
{
|
|
if (tick_check_expire(func_cb.enter_tick, 500))
|
|
{
|
|
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 (SysVariable.password_cnt == 4 && SysVariable.password_need == 1) {
|
|
func_switch_to_assign_screen(FUNC_PASSWORD_SUB_DISP, false);
|
|
}else{
|
|
func_clock_sub_shortcut();
|
|
}
|
|
SysVariable.SpiritIsland_New_Event = true; // 强制重新刷新
|
|
break;
|
|
|
|
default:
|
|
func_clock_sub_end_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//进入时钟表盘功能
|
|
static void func_clock_enter(void)
|
|
{
|
|
func_cb.f_cb = func_zalloc(sizeof(f_clock_t));
|
|
func_cb.flag_sort = false;
|
|
func_cb.frm_main = func_clock_form_create();
|
|
SysVariable.SpiritIsland_New_Event = true;//强制重新刷新
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
f_clock->back_click=0;
|
|
f_clock->qdec_flag=true;
|
|
f_clock->lindong_music_num=0;
|
|
clock_enter_flag = true;
|
|
}
|
|
|
|
|
|
//退出时钟表盘功能
|
|
static void func_clock_exit(void)
|
|
{
|
|
f_clock_t *f_clock = (f_clock_t*)func_cb.f_cb;
|
|
f_clock->back_click=0;
|
|
func_cb.last = FUNC_CLOCK;
|
|
clock_enter_flag = false;
|
|
}
|
|
|
|
//时钟表盘功能
|
|
void func_clock(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_clock_enter();
|
|
while (func_cb.sta == FUNC_CLOCK) {
|
|
func_clock_process();
|
|
func_clock_message(msg_dequeue());
|
|
}
|
|
func_clock_exit();
|
|
}
|