feat:
增加发车和停车菜单 增加停车相关条件开关功能 pref: 弯道速度控制一次函数->二次函数 删除图像下发无意义的0状态 fix: 修复下位机多次复位才能触发上位机复位
This commit is contained in:
120
app/page/page_gocar.c
Normal file
120
app/page/page_gocar.c
Normal file
@@ -0,0 +1,120 @@
|
||||
#include "zf_common_headfile.h"
|
||||
#include "page_ui_widget.h"
|
||||
#include "page.h"
|
||||
#include "by_frame.h"
|
||||
#include "jj_blueteeth.h"
|
||||
#include "jj_motion.h"
|
||||
|
||||
#define LINE_HEAD 1
|
||||
#define LINE_END 6
|
||||
|
||||
static char Text[] = "gocar";
|
||||
|
||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||
static int8_t last_go = 0;
|
||||
static int8_t last_cnt = 0;
|
||||
static int8_t last_fly = 0;
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面模板函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief 页面初始化事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Setup()
|
||||
{
|
||||
|
||||
ips200_clear();
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
ips200_show_string(10, 200, "go_flag:");
|
||||
ips200_show_int(80, 200, go_cnt, 1);
|
||||
ips200_show_string(10, 180, "ru_flag:");
|
||||
ips200_show_int(80, 180, bt_run_flag, 1);
|
||||
ips200_show_string(10, 160, "fl_flag:");
|
||||
ips200_show_int(80, 160, bt_fly_flag, 1);
|
||||
ips200_show_string(10, 18, "fan_test");
|
||||
ips200_show_string(10, 2 * 18, "run");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面退出事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Exit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面循环执行的内容
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Loop()
|
||||
{
|
||||
if (last_cnt != go_cnt) {
|
||||
ips200_show_int(80, 200, go_cnt, 1);
|
||||
}
|
||||
last_cnt = go_cnt;
|
||||
if (last_go != bt_run_flag) {
|
||||
ips200_show_int(80, 180, bt_run_flag, 1);
|
||||
}
|
||||
last_go = bt_run_flag;
|
||||
if (last_fly != bt_fly_flag) {
|
||||
ips200_show_int(80, 160, bt_fly_flag, 1);
|
||||
}
|
||||
last_fly = bt_fly_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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++; // 光标下移
|
||||
} else if (page_event_press_short == event) {
|
||||
if (go_cnt == 1 && Curser == 1) {
|
||||
go_cnt = 0; // 起步拖动失败。重新开始
|
||||
} else if (go_cnt == 0 && Curser == 1) {
|
||||
go_cnt = 1;
|
||||
bt_fly_flag = 1;
|
||||
}
|
||||
if (go_cnt == 1 && Curser == 2) {
|
||||
go_cnt = 2;
|
||||
}
|
||||
|
||||
} else if (page_event_press_long == event) {
|
||||
Page_Shift(page_menu);
|
||||
}
|
||||
|
||||
if (Curser < LINE_HEAD) {
|
||||
Curser = LINE_END;
|
||||
} else if (Curser > LINE_END) {
|
||||
Curser = LINE_HEAD;
|
||||
}
|
||||
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面注册函数
|
||||
*
|
||||
* @param pageID
|
||||
*/
|
||||
void PageRegister_page_gocar(unsigned char pageID)
|
||||
{
|
||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
||||
}
|
||||
Reference in New Issue
Block a user