131 lines
3.2 KiB
C
131 lines
3.2 KiB
C
#include "include.h"
|
||
#include "func.h"
|
||
#include "m_sportInfo.h"
|
||
#include "api.h"
|
||
#include "ancs_msg.h"
|
||
#include "m_storage.h"
|
||
#include "app_variable.h"
|
||
#if TRACE_EN
|
||
#define TRACE(...) printf(__VA_ARGS__)
|
||
#else
|
||
#define TRACE(...)
|
||
#endif
|
||
|
||
typedef struct f_screentest_t_ {
|
||
u32 enter_tick;
|
||
} f_screentest_t;
|
||
|
||
enum {
|
||
COMPO_ID_BTN = 1,
|
||
};
|
||
static u32 ticks = 0;
|
||
static int color_index = 0;
|
||
static u32 color_tab[] = {0xFFFF, 0xF800, 0x07E0,0x001F,0xFFE0,0xF81F,0x07FF,0x8410,0xAD55};
|
||
|
||
/* 工厂模式屏幕测试运行状态:true正在运行,false未在运行 */
|
||
static bool fac_screen_test_state = false;
|
||
static void func_screen_test_run_state_set(bool state)
|
||
{
|
||
fac_screen_test_state = state;
|
||
}
|
||
|
||
static bool func_screen_test_run_state_get(void)
|
||
{
|
||
return fac_screen_test_state;
|
||
}
|
||
|
||
compo_form_t *func_screentest_form_create(void)
|
||
{
|
||
compo_form_t *frm = compo_form_create(true);
|
||
|
||
compo_shape_t *rect = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE,14);
|
||
compo_setid(rect,COMPO_ID_BTN);
|
||
compo_shape_set_location(rect, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y, GUI_SCREEN_WIDTH, GUI_SCREEN_HEIGHT);
|
||
compo_shape_set_color(rect,color_tab[color_index]);
|
||
return frm;
|
||
}
|
||
|
||
static void func_screentest_process(void)
|
||
{
|
||
compo_form_t *rect = compo_getobj_byid(COMPO_ID_BTN);
|
||
|
||
if (tick_check_expire(ticks, 500)) {
|
||
reset_sleep_delay_all();
|
||
ticks = tick_get();
|
||
color_index++;
|
||
if(color_index >= sizeof(color_tab)/sizeof(u16) - 1)
|
||
{
|
||
color_index = 0;
|
||
}
|
||
compo_shape_set_color(rect,color_tab[color_index]);
|
||
}
|
||
func_process();
|
||
}
|
||
|
||
static void func_screentest_message(size_msg_t msg)
|
||
{
|
||
/* 检测窗体是否被外部改变,只允许用户主动改变退出 */
|
||
if (func_cb.sta != FUNC_SUB_SCREEN) {
|
||
func_cb.sta = FUNC_SUB_SCREEN;
|
||
}
|
||
|
||
switch (msg) {
|
||
case MSG_CTP_CLICK:
|
||
break;
|
||
case MSG_CTP_SHORT_UP:
|
||
break;
|
||
|
||
case MSG_CTP_SHORT_DOWN:
|
||
break;
|
||
|
||
case MSG_CTP_LONG:
|
||
break;
|
||
case KU_LEFT:
|
||
case KEY_RIGHT:
|
||
break;
|
||
case KEY_LEFT:
|
||
break;
|
||
case KEY_BACK:
|
||
break;
|
||
|
||
case MSG_CTP_SHORT_RIGHT:
|
||
func_message(msg);
|
||
|
||
/* 右滑退出厂测模式 */
|
||
if (func_cb.sta == FUNC_FACTORY_TEST) {
|
||
func_screen_test_run_state_set(false);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
func_message(msg);
|
||
break;
|
||
}
|
||
}
|
||
|
||
static void func_screentest_enter(void)
|
||
{
|
||
func_cb.f_cb = func_zalloc(sizeof(f_screentest_t));
|
||
func_cb.frm_main = func_screentest_form_create();
|
||
}
|
||
|
||
static void func_screentest_exit(void)
|
||
{
|
||
func_cb.last = FUNC_SUB_SCREEN;
|
||
}
|
||
|
||
void func_screentest(void)
|
||
{
|
||
printf("%s\n", __func__);
|
||
func_screentest_enter();
|
||
|
||
/* 厂测过程除用户主动退出外 不响应外部窗体切换 */
|
||
func_screen_test_run_state_set(true);
|
||
|
||
while (func_screen_test_run_state_get()) {
|
||
func_screentest_process();
|
||
func_screentest_message(msg_dequeue());
|
||
}
|
||
func_screentest_exit();
|
||
}
|