feat: 完成控制代码编写
This commit is contained in:
@@ -124,7 +124,7 @@ void Page_Run(void)
|
||||
void Page_Init(void)
|
||||
{
|
||||
PAGE_REG(page_menu);
|
||||
PAGE_REG(page_rtcam);
|
||||
// PAGE_REG(page_rtcam);
|
||||
PAGE_REG(page_param);
|
||||
// PAGE_REG(page_argv);
|
||||
// PAGE_REG(page_sys);
|
||||
|
||||
@@ -19,7 +19,7 @@ enum PageID {
|
||||
PAGE_NULL = -1,
|
||||
//......
|
||||
page_menu,
|
||||
page_rtcam,
|
||||
//page_rtcam,
|
||||
page_param,
|
||||
// page_argv,
|
||||
// page_sys,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "page_ui_widget.h"
|
||||
#include "jj_motion.h"
|
||||
#include "page.h"
|
||||
#include <math.h>
|
||||
|
||||
#define LINE_HEAD 0
|
||||
#define LINE_END DATA_NUM - 2
|
||||
@@ -25,14 +26,14 @@ static void Setup()
|
||||
{
|
||||
ips200_clear();
|
||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||
for (int16 i = 0; i < DATA_NUM - 1; i++) {
|
||||
ips200_show_string(10, i * 18 + 2, Param_Data[i].text);
|
||||
for (int16 i = 0; i < DATA_IN_FLASH_NUM - 1; i++) {
|
||||
ips200_show_string(0, i * 18 + 2, Param_Data[i].text);
|
||||
if (Param_Data[i].type == EINT32)
|
||||
ips200_show_int(50, i * 18 + 2, *((int32 *)(Param_Data[i].p_data)), 5);
|
||||
else if (Param_Data[i].type == EFLOAT)
|
||||
ips200_show_float(50, i * 18 + 2, *((float *)(Param_Data[i].p_data)), 4, 5);
|
||||
}
|
||||
ips200_show_int(50, (DATA_NUM-1)* 18 + 2, index_power, 5);
|
||||
ips200_show_int(50, (DATA_IN_FLASH_NUM-1)* 18 + 2, index_power, 5);
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ static void Event(page_event event)
|
||||
Print_Curser(Curser, Curser_Last, RGB565_RED);
|
||||
return;
|
||||
} else if (page_event_press_long == event) {
|
||||
jj_param_update();
|
||||
jj_param_write();
|
||||
sport_pid_init();
|
||||
Page_Shift(page_menu);
|
||||
return;
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
#include "zf_common_headfile.h"
|
||||
#include "page_ui_widget.h"
|
||||
#include "page.h"
|
||||
|
||||
#define LINE_HEAD 11
|
||||
#define LINE_END 16
|
||||
|
||||
static char Text[] = "RealTime Image";
|
||||
|
||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面模板函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief 页面初始化事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Setup()
|
||||
{
|
||||
ips200_clear();
|
||||
Print_Curser(Curser, Curser_Last,RGB565_PURPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面退出事件
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Exit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 页面循环执行的内容
|
||||
* @param 无
|
||||
* @retval 无
|
||||
*/
|
||||
static void Loop()
|
||||
{
|
||||
Show_Marked_Image();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
|
||||
} 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_rtcam(unsigned char pageID)
|
||||
{
|
||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
||||
}
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* 以下为页面自定义功能函数
|
||||
*
|
||||
***************************************************************************************/
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "page_ui_widget.h"
|
||||
#include "zf_common_headfile.h"
|
||||
#include "gl_data.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief 绘制光标
|
||||
@@ -137,57 +137,57 @@ void Set_Vaule(ITEM *item, uint8_t item_num, float step)
|
||||
// }
|
||||
}
|
||||
|
||||
void Show_Marked_Image(void)
|
||||
{
|
||||
#define IMAGE_DISPLAY_WIDTH (230U)
|
||||
#define IMAGE_DISPLAY_HEIGHT (146U)
|
||||
#define START_X ((240U - IMAGE_DISPLAY_WIDTH) / 2U)
|
||||
#define START_Y (16U)
|
||||
// void Show_Marked_Image(void)
|
||||
// {
|
||||
// #define IMAGE_DISPLAY_WIDTH (230U)
|
||||
// #define IMAGE_DISPLAY_HEIGHT (146U)
|
||||
// #define START_X ((240U - IMAGE_DISPLAY_WIDTH) / 2U)
|
||||
// #define START_Y (16U)
|
||||
|
||||
float horizontal_zoom_rate = ((float)(IMAGE_DISPLAY_WIDTH)) / ((float)(MT9V03X_W));
|
||||
float vertical_zoom_rate = ((float)(IMAGE_DISPLAY_HEIGHT)) / ((float)(MT9V03X_H));
|
||||
// float horizontal_zoom_rate = ((float)(IMAGE_DISPLAY_WIDTH)) / ((float)(MT9V03X_W));
|
||||
// float vertical_zoom_rate = ((float)(IMAGE_DISPLAY_HEIGHT)) / ((float)(MT9V03X_H));
|
||||
|
||||
ips200_show_gray_image(START_X, START_Y, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, IMAGE_DISPLAY_WIDTH, IMAGE_DISPLAY_HEIGHT, 0);
|
||||
ips200_draw_frame(START_X - 3, START_Y - 3, START_X + IMAGE_DISPLAY_WIDTH + 2, START_Y + IMAGE_DISPLAY_HEIGHT + 2, 2, RGB565_BLUE);
|
||||
// 确认边线数组在显示前不会清空
|
||||
for (uint i = 0; i < PT_MAXLEN; i++) {
|
||||
//寻近线逆透视后边线数组
|
||||
uint16_t l_x = START_X + (uint16_t)((float)pts_inv_r[i][1] * horizontal_zoom_rate);
|
||||
uint16_t l_y = START_Y + (uint16_t)((float)pts_inv_r[i][0] * vertical_zoom_rate);
|
||||
uint16_t r_x = START_X + (uint16_t)((float)pts_inv_l[i][1] * horizontal_zoom_rate);
|
||||
uint16_t r_y = START_Y + (uint16_t)((float)pts_inv_l[i][0] * vertical_zoom_rate);
|
||||
//寻远线逆透视后边线数组
|
||||
uint16_t far_l_x = START_X + (uint16_t)((float)pts_far_inv_r[i][1] * horizontal_zoom_rate);
|
||||
uint16_t far_l_y = START_Y + (uint16_t)((float)pts_far_inv_r[i][0] * vertical_zoom_rate);
|
||||
uint16_t far_r_x = START_X + (uint16_t)((float)pts_far_inv_l[i][1] * horizontal_zoom_rate);
|
||||
uint16_t far_r_y = START_Y + (uint16_t)((float)pts_far_inv_l[i][0] * vertical_zoom_rate);
|
||||
//寻近线中线数组
|
||||
uint16_t mid_x_l = START_X + (uint16_t)(mid_left[i][1] * horizontal_zoom_rate);
|
||||
uint16_t mix_y_l = START_Y + (uint16_t)(mid_left[i][0] * vertical_zoom_rate);
|
||||
uint16_t mid_x_r = START_X + (uint16_t)(mid_right[i][1] * horizontal_zoom_rate);
|
||||
uint16_t mix_y_r = START_Y + (uint16_t)(mid_right[i][0] * vertical_zoom_rate);
|
||||
// ips200_show_gray_image(START_X, START_Y, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, IMAGE_DISPLAY_WIDTH, IMAGE_DISPLAY_HEIGHT, 0);
|
||||
// ips200_draw_frame(START_X - 3, START_Y - 3, START_X + IMAGE_DISPLAY_WIDTH + 2, START_Y + IMAGE_DISPLAY_HEIGHT + 2, 2, RGB565_BLUE);
|
||||
// // 确认边线数组在显示前不会清空
|
||||
// for (uint i = 0; i < PT_MAXLEN; i++) {
|
||||
// //寻近线逆透视后边线数组
|
||||
// uint16_t l_x = START_X + (uint16_t)((float)pts_inv_r[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t l_y = START_Y + (uint16_t)((float)pts_inv_r[i][0] * vertical_zoom_rate);
|
||||
// uint16_t r_x = START_X + (uint16_t)((float)pts_inv_l[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t r_y = START_Y + (uint16_t)((float)pts_inv_l[i][0] * vertical_zoom_rate);
|
||||
// //寻远线逆透视后边线数组
|
||||
// uint16_t far_l_x = START_X + (uint16_t)((float)pts_far_inv_r[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t far_l_y = START_Y + (uint16_t)((float)pts_far_inv_r[i][0] * vertical_zoom_rate);
|
||||
// uint16_t far_r_x = START_X + (uint16_t)((float)pts_far_inv_l[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t far_r_y = START_Y + (uint16_t)((float)pts_far_inv_l[i][0] * vertical_zoom_rate);
|
||||
// //寻近线中线数组
|
||||
// uint16_t mid_x_l = START_X + (uint16_t)(mid_left[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t mix_y_l = START_Y + (uint16_t)(mid_left[i][0] * vertical_zoom_rate);
|
||||
// uint16_t mid_x_r = START_X + (uint16_t)(mid_right[i][1] * horizontal_zoom_rate);
|
||||
// uint16_t mix_y_r = START_Y + (uint16_t)(mid_right[i][0] * vertical_zoom_rate);
|
||||
|
||||
//近线数组显示
|
||||
ips200_draw_rect(l_x, l_y, l_x + 2, l_y, RGB565_RED);
|
||||
ips200_draw_rect(r_x - 2, r_y, r_x, r_y, RGB565_BLUE);
|
||||
// //近线数组显示
|
||||
// ips200_draw_rect(l_x, l_y, l_x + 2, l_y, RGB565_RED);
|
||||
// ips200_draw_rect(r_x - 2, r_y, r_x, r_y, RGB565_BLUE);
|
||||
|
||||
//远线数组显示
|
||||
//ips200_draw_rect(far_l_x, far_l_y, far_l_x + 2, far_l_y, RGB565_RED);
|
||||
//ips200_draw_rect(far_r_x - 2, far_r_y, far_r_x, far_r_y, RGB565_BLUE);
|
||||
// //远线数组显示
|
||||
// //ips200_draw_rect(far_l_x, far_l_y, far_l_x + 2, far_l_y, RGB565_RED);
|
||||
// //ips200_draw_rect(far_r_x - 2, far_r_y, far_r_x, far_r_y, RGB565_BLUE);
|
||||
|
||||
//中线数组显示
|
||||
ips200_draw_rect(mid_x_l, mix_y_l, mid_x_l + 2, mix_y_l, RGB565_BLACK);
|
||||
ips200_draw_rect(mid_x_r, mix_y_r, mid_x_r + 2, mix_y_r, RGB565_BLUE);
|
||||
// //中线数组显示
|
||||
// ips200_draw_rect(mid_x_l, mix_y_l, mid_x_l + 2, mix_y_l, RGB565_BLACK);
|
||||
// ips200_draw_rect(mid_x_r, mix_y_r, mid_x_r + 2, mix_y_r, RGB565_BLUE);
|
||||
|
||||
// ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
|
||||
// ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate) - 1, START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
|
||||
// ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
|
||||
// ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate) + 1, START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
|
||||
}
|
||||
#undef IMAGE_DISPLAY_WIDTH
|
||||
#undef START_X
|
||||
#undef START_Y
|
||||
}
|
||||
// // ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
|
||||
// // ips200_draw_point(START_X + (uint16_t)((float)pts_right[i][1] * horizontal_zoom_rate) - 1, START_Y + (uint16_t)((float)pts_right[i][0] * vertical_zoom_rate), RGB565_GREEN);
|
||||
// // ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate), START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
|
||||
// // ips200_draw_point(START_X + (uint16_t)((float)pts_left[i][1] * horizontal_zoom_rate) + 1, START_Y + (uint16_t)((float)pts_left[i][0] * vertical_zoom_rate), RGB565_YELLOW);
|
||||
// }
|
||||
// #undef IMAGE_DISPLAY_WIDTH
|
||||
// #undef START_X
|
||||
// #undef START_Y
|
||||
// }
|
||||
|
||||
uint16_t rgb_gradient(uint16_t i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user