141 lines
3.7 KiB
C
141 lines
3.7 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
#include "app_variable.h"
|
|
|
|
|
|
#if TRACE_EN
|
|
#define TRACE(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define TRACE(...)
|
|
#endif
|
|
|
|
MeasureMode_t gmeasureMode; //当前测量项
|
|
|
|
|
|
//按钮
|
|
enum{
|
|
COMPO_ID_BTN_NO = 1,
|
|
COMPO_ID_BTN_YES,
|
|
};
|
|
|
|
|
|
typedef struct f_faway_hand_t_ {
|
|
u32 ticks;
|
|
u8 sec;
|
|
// u32 str_idx;
|
|
} f_faway_hand_t;
|
|
|
|
|
|
//创建脱腕检测窗体
|
|
compo_form_t *func_farway_hand_form_create(void)
|
|
{
|
|
//新建窗体
|
|
compo_form_t *frm = compo_form_create(true);
|
|
|
|
// 设置标题栏
|
|
compo_form_set_mode(frm, COMPO_FORM_MODE_SHOW_TITLE | COMPO_FORM_MODE_SHOW_TIME);
|
|
if(func_cb.last == FUNC_HEARTRATE)
|
|
{
|
|
compo_form_set_title(frm, i18n[STR_HEART_RATE]);
|
|
// printf("is last heart");
|
|
}else if(func_cb.last == FUNC_BLOOD_PRESSURE)
|
|
{
|
|
compo_form_set_title(frm, i18n[STR_BLOOD_PRESSURE]);
|
|
// printf("is last bp");
|
|
}else if(func_cb.last == FUNC_BLOOD_OXYGEN)
|
|
{
|
|
compo_form_set_title(frm, i18n[STR_BLOOD_OXYGEN]);
|
|
// printf("is last bo");
|
|
}
|
|
else{
|
|
// printf("is last special");
|
|
compo_form_set_title(frm, i18n[STR_HEART_RATE]);
|
|
}
|
|
//图片
|
|
compo_form_add_image(frm, UI_BUF_COMMON_FARWAY_HAND_BIN, GUI_SCREEN_CENTER_X, 68 + 40);
|
|
//上边提示语-“检测到脱腕”
|
|
compo_textbox_t *txt_off = compo_textbox_create(frm, 50);
|
|
compo_textbox_set_multiline(txt_off,true);
|
|
compo_textbox_set_location(txt_off, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y+40, GUI_SCREEN_WIDTH -40, 60);
|
|
compo_textbox_set_autoroll_mode(txt_off, TEXT_AUTOROLL_MODE_SROLL_CIRC);
|
|
compo_textbox_set(txt_off, i18n[STR_WRIST_OFF]);
|
|
//下方提示语-“请偏紧佩戴手表”
|
|
compo_textbox_t *txt_remind = compo_textbox_create(frm, 100);
|
|
compo_textbox_set_forecolor(txt_remind,make_color(163,163,163));
|
|
compo_textbox_set_location(txt_remind, GUI_SCREEN_CENTER_X, GUI_SCREEN_HEIGHT-30, GUI_SCREEN_WIDTH -20, 30);
|
|
compo_textbox_set_autoroll_mode(txt_remind, TEXT_AUTOROLL_MODE_SROLL_CIRC);
|
|
compo_textbox_set(txt_remind, i18n[STR_WRIST_OFF_REMIND]);
|
|
|
|
return frm;
|
|
}
|
|
|
|
//脱腕检测计时退出
|
|
static void func_farway_hand_time_out(void)
|
|
{
|
|
f_faway_hand_t *f_pst_select = (f_faway_hand_t *)func_cb.f_cb;
|
|
|
|
if (tick_check_expire(f_pst_select->ticks, 100)) {
|
|
f_pst_select->ticks = tick_get();
|
|
if(++f_pst_select->sec > 30){
|
|
func_back_to(); //直接退出任务
|
|
}
|
|
}
|
|
}
|
|
|
|
//脱腕检测功能事件处理
|
|
static void func_farway_hand_process(void)
|
|
{
|
|
func_farway_hand_time_out();
|
|
func_process();
|
|
}
|
|
|
|
|
|
//脱腕检测功能消息处理
|
|
static void func_farway_hand_message(size_msg_t msg)
|
|
{
|
|
switch (msg) {
|
|
case MSG_CTP_SHORT_UP:
|
|
case MSG_CTP_SHORT_DOWN:
|
|
case MSG_CTP_SHORT_LEFT:
|
|
case MSG_CTP_SHORT_RIGHT:
|
|
case MSG_CTP_LONG:
|
|
case MSG_CTP_CLICK:
|
|
case KU_BACK:
|
|
func_back_to(); //直接退出任务
|
|
break;
|
|
|
|
case MSG_QDEC_FORWARD:
|
|
case MSG_QDEC_BACKWARD:
|
|
break;
|
|
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//进入脱腕检测功能
|
|
static void func_farway_hand_enter(void)
|
|
{
|
|
func_cb.f_cb = func_zalloc(sizeof(f_faway_hand_t));
|
|
func_cb.frm_main = func_farway_hand_form_create();
|
|
}
|
|
|
|
//退出脱腕检测功能
|
|
static void func_farway_hand_exit(void)
|
|
{
|
|
func_cb.last = FUNC_FARWAY_HAND;
|
|
}
|
|
|
|
//脱腕检测功能
|
|
void func_farway_hand(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_farway_hand_enter();
|
|
while (func_cb.sta == FUNC_FARWAY_HAND) {
|
|
func_farway_hand_process();
|
|
func_farway_hand_message(msg_dequeue());
|
|
}
|
|
func_farway_hand_exit();
|
|
}
|