日常更新,适配3.5寸桨叶版,新加障碍分段参数
This commit is contained in:
@@ -128,7 +128,7 @@ void Page_Init(void)
|
||||
PAGE_REG(page_param_pid0);
|
||||
PAGE_REG(page_param_pid1);
|
||||
PAGE_REG(page_param_pid2);
|
||||
|
||||
PAGE_REG(page_param_pid3);
|
||||
PAGE_REG(page_dparam);
|
||||
Page_Shift(page_menu);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ enum PageID {
|
||||
page_param_pid0,
|
||||
page_param_pid1,
|
||||
page_param_pid2,
|
||||
page_param_pid3,
|
||||
page_dparam,
|
||||
// page_argv,
|
||||
// page_sys,
|
||||
|
||||
@@ -60,10 +60,8 @@ static void Loop()
|
||||
ips200_show_float(80, 140, out_gyro, 4, 1);
|
||||
ips200_show_string(0, 160, "outpos");
|
||||
ips200_show_float(80, 160, out_pos, 4, 1);
|
||||
ips200_show_string(0, 180, "outcal");
|
||||
ips200_show_float(80, 180, out_cal, 4, 1);
|
||||
ips200_show_string(0, 200, "vol");
|
||||
ips200_show_float(80, 200, (float)now_vol, 4,2);
|
||||
ips200_show_string(0, 180, "vol");
|
||||
ips200_show_float(80, 180, (float)now_vol, 4,2);
|
||||
|
||||
ips200_show_string(180, 0, "ls");
|
||||
ips200_show_float(220, 0, pwm_duty_ls, 4, 1);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "jj_blueteeth.h"
|
||||
|
||||
#define LINE_HEAD 1
|
||||
#define LINE_END 4
|
||||
#define LINE_END 5
|
||||
|
||||
static char Text[] = "Menu";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#define LINE_HEAD 1
|
||||
#define LINE_END DATA_IN_FLASH_NUM - Page3_head
|
||||
#define LINE_END Page4_head - Page3_head
|
||||
#define Strat_param Page3_head
|
||||
static char Text[] = "cir_pid";
|
||||
static int event_flag = 0;
|
||||
|
||||
137
app/page/page_param_pid3.c
Normal file
137
app/page/page_param_pid3.c
Normal file
@@ -0,0 +1,137 @@
|
||||
#include "jj_param.h"
|
||||
#include "page_ui_widget.h"
|
||||
#include "jj_motion.h"
|
||||
#include "page.h"
|
||||
#include <math.h>
|
||||
|
||||
#define LINE_HEAD 1
|
||||
#define LINE_END DATA_IN_FLASH_NUM - Page4_head
|
||||
#define Strat_param Page4_head
|
||||
static char Text[] = "barr_pid";
|
||||
static int event_flag = 0;
|
||||
static int index_power = 0;
|
||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||
static void jj_param_show();
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面模板函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
/**
|
||||
* @brief 页面初始化事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Setup()
|
||||
{
|
||||
ips200_clear();
|
||||
ips200_show_string(0, 2,"barrir");
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
for (int16 i = 0; i < LINE_END; i++) {
|
||||
ips200_show_string(0, i * 18 + 20, Param_Data[i +Strat_param ].text);
|
||||
if (Param_Data[i + Strat_param].type == EINT32)
|
||||
ips200_show_int(50, i * 18 + 20, *((int32 *)(Param_Data[i + Strat_param].p_data)), 5);
|
||||
else if (Param_Data[i + Strat_param].type == EFLOAT)
|
||||
ips200_show_float(50, i * 18 + 20, *((float *)(Param_Data[i + Strat_param].p_data)), 4, 5);
|
||||
}
|
||||
ips200_show_int(100, 2, index_power, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面退出事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Exit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面循环执行的内容
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Loop()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @brief 页面事件
|
||||
* @param btn:发出事件的按键
|
||||
* @param event:事件编号
|
||||
* @retval 无
|
||||
*/
|
||||
static void Event(page_event event)
|
||||
{
|
||||
|
||||
if (0 == event_flag) {
|
||||
|
||||
Curser_Last = Curser;
|
||||
if (page_event_forward == event) {
|
||||
Curser--; // 光标上移
|
||||
} else if (page_event_backward == event) {
|
||||
Curser++; // 光标下移
|
||||
} else if (page_event_press_short == event) {
|
||||
event_flag = 1; // 选中参数
|
||||
Print_Curser(Curser, Curser_Last, RGB565_RED);
|
||||
return;
|
||||
} else if (page_event_press_long == event) {
|
||||
jj_param_write();
|
||||
sport_pid_init();
|
||||
Page_Shift(page_menu);
|
||||
return;
|
||||
}
|
||||
if (Curser < LINE_HEAD) {
|
||||
Curser = LINE_END;
|
||||
} else if (Curser > LINE_END) {
|
||||
Curser = LINE_HEAD;
|
||||
}
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
} else if (1 == event_flag) {
|
||||
if (page_event_forward == event) {
|
||||
if (Param_Data[Curser + Strat_param-1].type == EFLOAT) {
|
||||
*((float *)(Param_Data[Curser + Strat_param-1].p_data)) += powf(10.0f, (float)index_power);
|
||||
} else if (Param_Data[Curser + Strat_param-1].type == EINT32) {
|
||||
*((int32 *)(Param_Data[Curser + Strat_param-1].p_data)) += 1;
|
||||
} else if (Param_Data[Curser + Strat_param-1].type == EUINT32) {
|
||||
*((uint32 *)(Param_Data[Curser + Strat_param-1].p_data)) += 1;
|
||||
}
|
||||
} else if (page_event_backward == event) {
|
||||
if (Param_Data[Curser + Strat_param-1].type == EFLOAT) {
|
||||
*((float *)(Param_Data[Curser + Strat_param-1].p_data)) -= powf(10.0f, (float)index_power);
|
||||
} else if (Param_Data[Curser + Strat_param-1].type == EINT32) {
|
||||
*((int32 *)(Param_Data[Curser + Strat_param-1].p_data)) -= 1;
|
||||
} else if (Param_Data[Curser + Strat_param-1].type == EUINT32) {
|
||||
*((uint32 *)(Param_Data[Curser + Strat_param-1].p_data)) -= 1;
|
||||
}
|
||||
} else if (page_event_press_short == event) {
|
||||
index_power++;
|
||||
if (index_power > 2) {
|
||||
index_power = -2;
|
||||
}
|
||||
ips200_show_int(100, 2, index_power, 5);
|
||||
} else if (page_event_press_long == event) {
|
||||
event_flag = 0;
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
}
|
||||
jj_param_show();
|
||||
}
|
||||
}
|
||||
static void jj_param_show()
|
||||
{
|
||||
if (EINT32 == Param_Data[Curser + Strat_param-1].type)
|
||||
ips200_show_int(50, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + Strat_param-1].p_data)), 5);
|
||||
else if (EUINT32 == Param_Data[Curser + Strat_param-1].type)
|
||||
ips200_show_uint(50, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + Strat_param-1].p_data)), 5);
|
||||
else if (EFLOAT == Param_Data[Curser + Strat_param-1].type)
|
||||
ips200_show_float(50, Curser * 18 + 2, *((float *)(Param_Data[Curser + Strat_param-1].p_data)), 4, 5);
|
||||
}
|
||||
/**
|
||||
* @brief 页面注册函数
|
||||
*
|
||||
* @param pageID
|
||||
*/
|
||||
void PageRegister_page_param_pid3(unsigned char pageID)
|
||||
{
|
||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
||||
}
|
||||
Reference in New Issue
Block a user