2023-12-19 16:55:05 +08:00
|
|
|
#include "zf_common_headfile.h"
|
2024-01-08 22:30:20 +08:00
|
|
|
#include "page_ui_widget.h"
|
|
|
|
|
#include "page.h"
|
2024-05-23 15:53:21 +08:00
|
|
|
#include "by_frame.h"
|
|
|
|
|
#include "jj_blueteeth.h"
|
2023-12-19 16:55:05 +08:00
|
|
|
|
|
|
|
|
#define LINE_HEAD 1
|
2024-07-02 20:32:08 +08:00
|
|
|
#define LINE_END 5
|
2023-12-19 16:55:05 +08:00
|
|
|
|
|
|
|
|
static char Text[] = "Menu";
|
|
|
|
|
|
2024-01-04 22:07:13 +08:00
|
|
|
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
|
|
|
|
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
2024-06-07 21:55:55 +08:00
|
|
|
uint32_t cnt = 0;
|
|
|
|
|
uint8_t go_flag = 0;
|
2024-06-05 20:17:45 +08:00
|
|
|
uint32_t reset[3];
|
2023-12-19 16:55:05 +08:00
|
|
|
static void Print_Menu_p(void);
|
|
|
|
|
/***************************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* 以下为页面模板函数
|
|
|
|
|
*
|
|
|
|
|
***************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 页面初始化事件
|
|
|
|
|
* @param 无
|
|
|
|
|
* @retval 无
|
|
|
|
|
*/
|
|
|
|
|
static void Setup()
|
|
|
|
|
{
|
2024-01-04 22:43:15 +08:00
|
|
|
ips200_clear();
|
2023-12-19 16:55:05 +08:00
|
|
|
Print_Menu_p();
|
2024-05-23 15:53:21 +08:00
|
|
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
2024-06-07 21:55:55 +08:00
|
|
|
reset[0] = 0x01;
|
2023-12-19 16:55:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 页面退出事件
|
|
|
|
|
* @param 无
|
|
|
|
|
* @retval 无
|
|
|
|
|
*/
|
|
|
|
|
static void Exit()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 页面循环执行的内容
|
|
|
|
|
* @param 无
|
|
|
|
|
* @retval 无
|
|
|
|
|
*/
|
|
|
|
|
static void Loop()
|
|
|
|
|
{
|
2024-06-07 21:55:55 +08:00
|
|
|
if (go_flag == 1) {
|
|
|
|
|
system_delay_ms(1000);
|
|
|
|
|
bt_fly_flag = 1;
|
|
|
|
|
system_delay_ms(1000);
|
|
|
|
|
bt_run_flag = 1;
|
|
|
|
|
|
|
|
|
|
go_flag = 0;
|
|
|
|
|
}
|
2023-12-19 16:55:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 页面事件
|
|
|
|
|
* @param btn:发出事件的按键
|
|
|
|
|
* @param event:事件编号
|
|
|
|
|
* @retval 无
|
|
|
|
|
*/
|
|
|
|
|
static void Event(page_event event)
|
|
|
|
|
{
|
|
|
|
|
Curser_Last = Curser;
|
|
|
|
|
|
|
|
|
|
if (page_event_forward == event) {
|
|
|
|
|
Curser--; // 光标上移
|
|
|
|
|
} else if (page_event_backward == event) {
|
|
|
|
|
Curser++; // 光标下移
|
2024-01-05 15:55:17 +08:00
|
|
|
} else if (page_event_press_short == event) {
|
2023-12-19 16:55:05 +08:00
|
|
|
if (page_max > Curser && page_menu < Curser) {
|
|
|
|
|
Page_Shift(Curser); // 切换到光标选中的页面
|
|
|
|
|
}
|
2024-05-23 15:53:21 +08:00
|
|
|
} else if (page_event_press_long == event) {
|
2024-07-06 21:54:16 +08:00
|
|
|
go_flag = 1;
|
|
|
|
|
uint32_t temp = 0x5c;
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
by_frame_send(&temp);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-07 21:55:55 +08:00
|
|
|
ips200_clear();
|
2023-12-19 16:55:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Curser < LINE_HEAD) {
|
|
|
|
|
Curser = LINE_END;
|
|
|
|
|
} else if (Curser > LINE_END) {
|
|
|
|
|
Curser = LINE_HEAD;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-23 15:53:21 +08:00
|
|
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
2023-12-19 16:55:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 页面注册函数
|
|
|
|
|
*
|
|
|
|
|
* @param pageID
|
|
|
|
|
*/
|
|
|
|
|
void PageRegister_page_menu(unsigned char pageID)
|
|
|
|
|
{
|
|
|
|
|
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***************************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* 以下为页面自定义功能函数
|
|
|
|
|
*
|
|
|
|
|
***************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 打印菜单项
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void Print_Menu_p(void)
|
|
|
|
|
{
|
|
|
|
|
// SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####");
|
2023-12-21 22:33:36 +08:00
|
|
|
ips200_show_string(0, 0, Text);
|
|
|
|
|
for (uint8_t i = page_menu + 1; i < page_max; i++) {
|
2024-01-06 17:19:36 +08:00
|
|
|
ips200_show_string(10, i * 18, pagelist[i].Text);
|
2023-12-19 16:55:05 +08:00
|
|
|
// SCREEN_showstr(8, i, pagelist[i].Text);
|
|
|
|
|
}
|
|
|
|
|
}
|