feat: 新增边线显示控件(未测试)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#include "gl_headfile.h"
|
#include "gl_headfile.h"
|
||||||
|
|
||||||
|
|
||||||
sint32 limit(sint32 x, sint32 low, sint32 up)
|
int32_t limit(int32_t x, int32_t low, int32_t up)
|
||||||
{
|
{
|
||||||
return x > up ? up : x < low ? low : x;
|
return x > up ? up : x < low ? low : x;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,7 @@
|
|||||||
#define FRAMETOLEFT (5)
|
#define FRAMETOLEFT (5)
|
||||||
#define FRAMETORIGHT (5)
|
#define FRAMETORIGHT (5)
|
||||||
|
|
||||||
typedef signed int sint32;
|
int32_t limit(int32_t x, int32_t low, int32_t up);
|
||||||
typedef float float32;
|
|
||||||
|
|
||||||
sint32 limit(sint32 x, sint32 low, sint32 up);
|
|
||||||
int clip(int x, int low, int up);
|
int clip(int x, int low, int up);
|
||||||
float fclip(float x, float low, float up) ;
|
float fclip(float x, float low, float up) ;
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const sint32 direction_front[4][2] = {{0, -1},{1, 0},{0, 1},{-1, 0}};
|
const int32_t direction_front[4][2] = {{0, -1},{1, 0},{0, 1},{-1, 0}};
|
||||||
const sint32 direction_frontleft[4][2] = {{-1, -1},{1, -1},{1, 1},{-1, 1}};
|
const int32_t direction_frontleft[4][2] = {{-1, -1},{1, -1},{1, 1},{-1, 1}};
|
||||||
const sint32 direction_frontright[4][2] ={{1, -1},{1, 1},{-1, 1},{-1, -1}};
|
const int32_t direction_frontright[4][2] ={{1, -1},{1, 1},{-1, 1},{-1, -1}};
|
||||||
|
|
||||||
|
|
||||||
void SearchLineAdaptive_Left(uint8 img_gray[], sint32 block_size, sint32 down_value, sint32 h, sint32 w, sint32 pts[][2], sint32* line_num)
|
void SearchLineAdaptive_Left(uint8_t img_gray[], int32_t block_size, int32_t down_value, int32_t h, int32_t w, int32_t pts[][2], int32_t* line_num)
|
||||||
{
|
{
|
||||||
int half = block_size / 2;
|
int half = block_size / 2;
|
||||||
int step = 0, dir = 0, turn = 0;
|
int step = 0, dir = 0, turn = 0;
|
||||||
@@ -53,7 +53,7 @@ void SearchLineAdaptive_Left(uint8 img_gray[], sint32 block_size, sint32 down_va
|
|||||||
*line_num = step;
|
*line_num = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchLineAdaptive_Right(uint8 img_gray[], sint32 block_size, sint32 down_value, sint32 h, sint32 w, sint32 pts[][2], sint32* line_num)
|
void SearchLineAdaptive_Right(uint8_t img_gray[], int32_t block_size, int32_t down_value, int32_t h, int32_t w, int32_t pts[][2], int32_t* line_num)
|
||||||
{
|
{
|
||||||
int half = block_size / 2;
|
int half = block_size / 2;
|
||||||
int step = 0, dir = 0, turn = 0;
|
int step = 0, dir = 0, turn = 0;
|
||||||
@@ -100,7 +100,7 @@ void SearchLineAdaptive_Right(uint8 img_gray[], sint32 block_size, sint32 down_v
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GetLinesFilter(float32 pts_in[][2], sint32 pts_in_count, float32 pts_out[][2], sint32 kernelsize)
|
void GetLinesFilter(float pts_in[][2], int32_t pts_in_count, float pts_out[][2], int32_t kernelsize)
|
||||||
{
|
{
|
||||||
int half = kernelsize / 2;
|
int half = kernelsize / 2;
|
||||||
for (int i = 0; i < pts_in_count; i++) {
|
for (int i = 0; i < pts_in_count; i++) {
|
||||||
@@ -115,7 +115,7 @@ void GetLinesFilter(float32 pts_in[][2], sint32 pts_in_count, float32 pts_out[][
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetLinesResample(float32 pts_in[][2], sint32 num1, float32 pts_out[][2], sint32* num2, float32 dist)
|
void GetLinesResample(float pts_in[][2], int32_t num1, float pts_out[][2], int32_t* num2, float dist)
|
||||||
{
|
{
|
||||||
if (num1 < 0) {
|
if (num1 < 0) {
|
||||||
*num2 = 0;
|
*num2 = 0;
|
||||||
@@ -192,7 +192,7 @@ void nms_angle(float angle_in[], int num, float angle_out[], int kernel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetMidLine_Left(float32 pts_left[][2], sint32 pts_left_count, float32 mid_left[][2], sint32 approx_num, float32 dist)
|
void GetMidLine_Left(float pts_left[][2], int32_t pts_left_count, float mid_left[][2], int32_t approx_num, float dist)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pts_left_count; i++) {
|
for (int i = 0; i < pts_left_count; i++) {
|
||||||
float dx = pts_left[clip(i + approx_num, 0, pts_left_count - 1)][1] - pts_left[clip(i - approx_num, 0, pts_left_count - 1)][1];
|
float dx = pts_left[clip(i + approx_num, 0, pts_left_count - 1)][1] - pts_left[clip(i - approx_num, 0, pts_left_count - 1)][1];
|
||||||
@@ -207,7 +207,7 @@ void GetMidLine_Left(float32 pts_left[][2], sint32 pts_left_count, float32 mid_l
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetMidLine_Right(float32 pts_right[][2], sint32 pts_right_count, float32 mid_right[][2], sint32 approx_num, float32 dist)
|
void GetMidLine_Right(float pts_right[][2], int32_t pts_right_count, float mid_right[][2], int32_t approx_num, float dist)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pts_right_count; i++) {
|
for (int i = 0; i < pts_right_count; i++) {
|
||||||
float dx = pts_right[clip(i + approx_num, 0, pts_right_count -1)][1] - pts_right[clip(i - approx_num, 0, pts_right_count -1 )][1];
|
float dx = pts_right[clip(i + approx_num, 0, pts_right_count -1)][1] - pts_right[clip(i - approx_num, 0, pts_right_count -1 )][1];
|
||||||
@@ -223,10 +223,10 @@ void GetMidLine_Right(float32 pts_right[][2], sint32 pts_right_count, float32 mi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int is_curve(float32 angle[], int n, float32 threshold) {
|
int is_curve(float angle[], int n, float threshold) {
|
||||||
for (int i = 1; i < n - 1; i++) {
|
for (int i = 1; i < n - 1; i++) {
|
||||||
float32 da = fabs(angle[i] - angle[i-1]);
|
float da = fabs(angle[i] - angle[i-1]);
|
||||||
float32 db = fabs(angle[i+1] - angle[i]);
|
float db = fabs(angle[i+1] - angle[i]);
|
||||||
if (da > threshold && db > threshold) {
|
if (da > threshold && db > threshold) {
|
||||||
return 1; // 是弯道
|
return 1; // 是弯道
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SearchStartPoint_Left(uint8 img_gray[], sint32* h_start, sint32* w_start, uint8 threshold);
|
void SearchStartPoint_Left(uint8_t img_gray[], int32_t* h_start, int32_t* w_start, uint8_t threshold);
|
||||||
void GetLinesFilter(float32 pts_in[][2], sint32 pts_in_count, float32 pts_out[][2], sint32 kernelsize);
|
void GetLinesFilter(float pts_in[][2], int32_t pts_in_count, float pts_out[][2], int32_t kernelsize);
|
||||||
void GetLinesResample(float32 pts_in[][2], sint32 num1, float32 pts_out[][2], sint32* num2, float32 dist);
|
void GetLinesResample(float pts_in[][2], int32_t num1, float pts_out[][2], int32_t* num2, float dist);
|
||||||
void local_angle_points(float pts_in[][2], int num, float angle_out[], int dist);
|
void local_angle_points(float pts_in[][2], int num, float angle_out[], int dist);
|
||||||
void nms_angle(float angle_in[], int num, float angle_out[], int kernel);
|
void nms_angle(float angle_in[], int num, float angle_out[], int kernel);
|
||||||
void GetMidLine_Left(float32 pts_left[][2], sint32 pts_left_count, float32 mid_left[][2], sint32 approx_num, float32 dist);
|
void GetMidLine_Left(float pts_left[][2], int32_t pts_left_count, float mid_left[][2], int32_t approx_num, float dist);
|
||||||
void GetMidLine_Right(float32 pts_right[][2], sint32 pts_right_count, float32 mid_right[][2], sint32 approx_num, float32 dist);
|
void GetMidLine_Right(float pts_right[][2], int32_t pts_right_count, float mid_right[][2], int32_t approx_num, float dist);
|
||||||
int is_curve(float32 angle[], int n, float32 threshold) ;
|
int is_curve(float angle[], int n, float threshold) ;
|
||||||
|
|
||||||
#endif /* COMMON_H_ */
|
#endif /* COMMON_H_ */
|
||||||
@@ -5,9 +5,6 @@
|
|||||||
/*
|
/*
|
||||||
@author: glz
|
@author: glz
|
||||||
@brief:
|
@brief:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
|
|
||||||
typedef signed int sint32;
|
|
||||||
|
|
||||||
void img_processing(void);
|
void img_processing(void);
|
||||||
void SearchLineAdaptive_Left(uint8 img_gray[], sint32 block_size, sint32 down_value, sint32 h, sint32 w, sint32 pts[][2], sint32* line_num);
|
void SearchLineAdaptive_Left(uint8_t img_gray[], int32_t block_size, int32_t down_value, int32_t h, int32_t w, int32_t pts[][2], int32_t* line_num);
|
||||||
void SearchLineAdaptive_Right(uint8 img_gray[], sint32 block_size, sint32 down_value, sint32 h, sint32 w, sint32 pts[][2], sint32* line_num);
|
void SearchLineAdaptive_Right(uint8_t img_gray[], int32_t block_size, int32_t down_value, int32_t h, int32_t w, int32_t pts[][2], int32_t* line_num);
|
||||||
|
|
||||||
#endif /* STATE_H_ */
|
#endif /* STATE_H_ */
|
||||||
|
|||||||
80
app/main.c
80
app/main.c
@@ -2,11 +2,11 @@
|
|||||||
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
||||||
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||||
*
|
*
|
||||||
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNUͨ<55>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNU ͨ<EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><> GPL <20>ĵ<EFBFBD>3<EFBFBD>棨<EFBFBD><EFBFBD> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
* <20><> GPL <20>ĵ<EFBFBD> 3 <EFBFBD>棨<EFBFBD><EFBFBD> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
||||||
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
||||||
@@ -34,25 +34,25 @@
|
|||||||
********************************************************************************************************************/
|
********************************************************************************************************************/
|
||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
#include "gl_headfile.h"
|
#include "gl_headfile.h"
|
||||||
#include "cw_servo.h"
|
|
||||||
#include "by_pt_button.h"
|
#include "by_pt_button.h"
|
||||||
#include "by_fan_control.h"
|
#include "by_fan_control.h"
|
||||||
|
#include "cw_servo.h"
|
||||||
|
#include "./page/cw_page.h"
|
||||||
|
|
||||||
uint8 (*Img_Gray)[MT9V03X_W]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V03X_W <20>е<EFBFBD> uint8 <20><><EFBFBD>͵Ķ<CDB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
uint8_t (*Img_Gray)[MT9V03X_W]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V03X_W <20>е<EFBFBD> uint8_t <20><><EFBFBD>͵Ķ<CDB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||||
//uint8 *mt9v03x_image_copy[0]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> uint8 <20><><EFBFBD>͵<EFBFBD>һά<D2BB><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
// uint8_t *mt9v03x_image_copy[0]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> uint8_t <20><><EFBFBD>͵<EFBFBD>һά<D2BB><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||||
sint32 pts_left[PT_MAXLEN][2], pts_right[PT_MAXLEN][2];
|
int32_t pts_left[PT_MAXLEN][2], pts_right[PT_MAXLEN][2];
|
||||||
sint32 pts_left_count, pts_right_count;
|
int32_t pts_left_count, pts_right_count;
|
||||||
float32 pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
|
float pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
|
||||||
sint32 pts_inv_l_count, pts_inv_r_count;
|
int32_t pts_inv_l_count, pts_inv_r_count;
|
||||||
float32 pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
|
float pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
|
||||||
sint32 pts_filter_l_count, pts_filter_r_count;
|
int32_t pts_filter_l_count, pts_filter_r_count;
|
||||||
float32 pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
|
float pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
|
||||||
sint32 pts_resample_left_count, pts_resample_right_count;
|
int32_t pts_resample_left_count, pts_resample_right_count;
|
||||||
float32 mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
|
float mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
|
||||||
sint32 mid_left_count, mid_right_count;
|
int32_t mid_left_count, mid_right_count;
|
||||||
|
|
||||||
|
// <20><><EFBFBD>ұ<EFBFBD><D2B1>߾ֲ<DFBE><D6B2>Ƕȱ仯<C8B1><E4BBAF> + <20>Ǽ<EFBFBD><C7BC><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||||
//<2F><><EFBFBD>ұ<EFBFBD><D2B1>߾ֲ<DFBE><D6B2>Ƕȱ仯<C8B1><E4BBAF>+<2B>Ǽ<EFBFBD><C7BC><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
||||||
float angle_new_left[PT_MAXLEN];
|
float angle_new_left[PT_MAXLEN];
|
||||||
float angle_new_right[PT_MAXLEN];
|
float angle_new_right[PT_MAXLEN];
|
||||||
int angle_new_left_num, angle_new_right_num;
|
int angle_new_left_num, angle_new_right_num;
|
||||||
@@ -63,10 +63,10 @@ float angle_left[PT_MAXLEN];
|
|||||||
float angle_right[PT_MAXLEN];
|
float angle_right[PT_MAXLEN];
|
||||||
int angle_left_num, angle_right_num;
|
int angle_left_num, angle_right_num;
|
||||||
|
|
||||||
// L<>ǵ<EFBFBD>
|
// L <EFBFBD>ǵ<EFBFBD>
|
||||||
int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
|
int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
|
||||||
bool Lpt0_found, Lpt1_found;
|
bool Lpt0_found, Lpt1_found;
|
||||||
int Lpt1[2],Lpt0[2];
|
int Lpt1[2], Lpt0[2];
|
||||||
|
|
||||||
int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
|
int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
|
||||||
bool Lpt_in0_found, Lpt_in1_found;
|
bool Lpt_in0_found, Lpt_in1_found;
|
||||||
@@ -85,41 +85,43 @@ float aim_distance;
|
|||||||
|
|
||||||
enum track_type_e track_type = TRACK_RIGHT;
|
enum track_type_e track_type = TRACK_RIGHT;
|
||||||
|
|
||||||
|
|
||||||
int frame_count = 0;
|
int frame_count = 0;
|
||||||
|
|
||||||
void img_processing();
|
void img_processing();
|
||||||
void get_corners();
|
void get_corners();
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
clock_init(SYSTEM_CLOCK_120M); // <20><>ʼ<EFBFBD><CABC>оƬʱ<C6AC><CAB1> <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ϊ 120MHz
|
clock_init(SYSTEM_CLOCK_120M); // <20><>ʼ<EFBFBD><CABC>оƬʱ<C6AC><CAB1> <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ϊ 120MHz
|
||||||
debug_init(); // <20><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC> MPU ʱ<><CAB1> <20><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>
|
debug_init(); // <20><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC> MPU ʱ<><CAB1> <20><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>
|
||||||
mt9v03x_init();
|
mt9v03x_init();
|
||||||
ips114_init();
|
ips200_init(IPS200_TYPE_SPI);
|
||||||
by_gpio_init();
|
by_gpio_init();
|
||||||
by_exit_init();
|
by_exit_init();
|
||||||
by_pwm_init();
|
by_pwm_init();
|
||||||
cw_servo_init();
|
cw_servo_init();
|
||||||
|
|
||||||
while (1) {
|
Page_Init();
|
||||||
//while (frame_count < 20) {
|
|
||||||
// if (mt9v03x_finish_flag) {
|
|
||||||
// memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
|
|
||||||
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 8);
|
|
||||||
// //threshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, MT9V03X_W, MT9V03X_H, 110);
|
|
||||||
// ips114_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
|
||||||
// mt9v03x_finish_flag = 0;
|
|
||||||
// frame_count++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
Page_Run();
|
||||||
|
// while (frame_count < 20) {
|
||||||
|
// if (mt9v03x_finish_flag) {
|
||||||
|
// memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
|
||||||
|
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 8);
|
||||||
|
// //threshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, MT9V03X_W, MT9V03X_H, 110);
|
||||||
|
// ips114_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
||||||
|
// mt9v03x_finish_flag = 0;
|
||||||
|
// frame_count++;
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/************************ ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD> ***************************/
|
||||||
if (mt9v03x_finish_flag) {
|
if (mt9v03x_finish_flag) {
|
||||||
//ips114_show_gray_image(0, 0, mt9v03x_image[0], 188, 120, 188, 120,0);
|
memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
|
||||||
memcpy(mt9v03x_image_copy[0], mt9v03x_image[0],(sizeof(mt9v03x_image_copy)/sizeof(uint8_t)));
|
// ips114_show_gray_image(0, 0, mt9v03x_image[0], 188, 120, 188, 120,0);
|
||||||
//Img_Gray = mt9v03x_image;
|
// Img_Gray = mt9v03x_image;
|
||||||
//mt9v03x_image_copy[0] = Img_Gray[0];
|
// mt9v03x_image_copy[0] = Img_Gray[0];
|
||||||
mt9v03x_finish_flag = 0;
|
mt9v03x_finish_flag = 0;
|
||||||
|
|
||||||
state_type = COMMON_STATE;
|
state_type = COMMON_STATE;
|
||||||
@@ -130,9 +132,7 @@ int main(void)
|
|||||||
ElementJudge();
|
ElementJudge();
|
||||||
ElementRun();
|
ElementRun();
|
||||||
MidLineTrack();
|
MidLineTrack();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/************************ ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD> ***************************/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
32
app/main.h
32
app/main.h
@@ -2,35 +2,32 @@
|
|||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
|
||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
|
#include "gl_common.h"
|
||||||
|
|
||||||
|
// extern uint8 *mt9v03x_image_copy[0];
|
||||||
//extern uint8 *mt9v03x_image_copy[0];
|
extern int32_t pts_left[PT_MAXLEN][2], pts_right[PT_MAXLEN][2]; // 0:H,1:W
|
||||||
extern sint32 pts_left[PT_MAXLEN][2], pts_right[PT_MAXLEN][2]; //0:H,1:W
|
extern int32_t pts_left_count, pts_right_count;
|
||||||
extern sint32 pts_left_count, pts_right_count;
|
extern float pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
|
||||||
extern float32 pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
|
extern int32_t pts_inv_l_count, pts_inv_r_count;
|
||||||
extern sint32 pts_inv_l_count, pts_inv_r_count;
|
extern float pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
|
||||||
extern float32 pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
|
extern int32_t pts_filter_l_count, pts_filter_r_count;
|
||||||
extern sint32 pts_filter_l_count, pts_filter_r_count;
|
extern float pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
|
||||||
extern float32 pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
|
extern int32_t pts_resample_left_count, pts_resample_right_count;
|
||||||
extern sint32 pts_resample_left_count, pts_resample_right_count;
|
|
||||||
extern uint8_t mt9v03x_image_copy[MT9V03X_H][MT9V03X_W];
|
extern uint8_t mt9v03x_image_copy[MT9V03X_H][MT9V03X_W];
|
||||||
extern float32 mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
|
extern float mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
|
||||||
extern sint32 mid_left_count, mid_right_count;
|
extern int32_t mid_left_count, mid_right_count;
|
||||||
|
|
||||||
|
|
||||||
extern float angle_left[PT_MAXLEN];
|
extern float angle_left[PT_MAXLEN];
|
||||||
extern float angle_right[PT_MAXLEN];
|
extern float angle_right[PT_MAXLEN];
|
||||||
extern int angle_left_num, angle_right_num;
|
extern int angle_left_num, angle_right_num;
|
||||||
|
|
||||||
|
|
||||||
extern float angle_new_left[PT_MAXLEN];
|
extern float angle_new_left[PT_MAXLEN];
|
||||||
extern float angle_new_right[PT_MAXLEN];
|
extern float angle_new_right[PT_MAXLEN];
|
||||||
extern int angle_new_left_num, angle_new_right_num;
|
extern int angle_new_left_num, angle_new_right_num;
|
||||||
|
|
||||||
|
|
||||||
extern int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
|
extern int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
|
||||||
extern bool Lpt0_found, Lpt1_found;
|
extern bool Lpt0_found, Lpt1_found;
|
||||||
extern int Lpt1[2],Lpt0[2];
|
extern int Lpt1[2], Lpt0[2];
|
||||||
|
|
||||||
extern int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
|
extern int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
|
||||||
extern bool Lpt_in0_found, Lpt_in1_found;
|
extern bool Lpt_in0_found, Lpt_in1_found;
|
||||||
@@ -44,9 +41,6 @@ extern float rptsn[PT_MAXLEN][2];
|
|||||||
extern int rptsn_num;
|
extern int rptsn_num;
|
||||||
extern float aim_distance;
|
extern float aim_distance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum track_type_e {
|
enum track_type_e {
|
||||||
TRACK_LEFT,
|
TRACK_LEFT,
|
||||||
TRACK_RIGHT,
|
TRACK_RIGHT,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "cw_page.h"
|
#include "cw_page.h"
|
||||||
|
|
||||||
PAGE_LIST pagelist[page_max];
|
PAGE_LIST pagelist[page_max];
|
||||||
static uint8 page_busy = 0;
|
static uint8_t page_busy = 0;
|
||||||
static int8 now_page = page_menu;
|
static int8_t now_page = page_menu;
|
||||||
static int8 new_page = page_menu;
|
static int8_t new_page = page_menu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 注册一个基本页面,包含一个初始化函数,循环函数,退出函数,事件函数
|
* @brief 注册一个基本页面,包含一个初始化函数,循环函数,退出函数,事件函数
|
||||||
@@ -15,7 +15,7 @@ static int8 new_page = page_menu;
|
|||||||
* @param eventCallback: 事件函数回调
|
* @param eventCallback: 事件函数回调
|
||||||
* @retval 无
|
* @retval 无
|
||||||
*/
|
*/
|
||||||
void Page_Register(uint8 pageID, char *pageText,
|
void Page_Register(uint8_t pageID, char *pageText,
|
||||||
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
||||||
CallbackFunction_t exitCallback, EventFunction_t eventCallback) {
|
CallbackFunction_t exitCallback, EventFunction_t eventCallback) {
|
||||||
pagelist[pageID].Text = pageText;
|
pagelist[pageID].Text = pageText;
|
||||||
@@ -66,9 +66,9 @@ void Page_OpenCurrentPage() {
|
|||||||
/**
|
/**
|
||||||
* @brief 获取页面状态
|
* @brief 获取页面状态
|
||||||
*
|
*
|
||||||
* @return uint8 页面忙返回1 空闲返回0
|
* @return uint8_t 页面忙返回1 空闲返回0
|
||||||
*/
|
*/
|
||||||
uint8 Page_GetStatus(void) {
|
uint8_t Page_GetStatus(void) {
|
||||||
if (page_busy)
|
if (page_busy)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ do{\
|
|||||||
PageRegister_##name(name);\
|
PageRegister_##name(name);\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
void Page_Register(uint8 pageID, char *pageText,
|
void Page_Register(uint8_t pageID, char *pageText,
|
||||||
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
||||||
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
|
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ void Page_EventTransmit(unsigned char event);
|
|||||||
void Page_Shift(unsigned char pageID);
|
void Page_Shift(unsigned char pageID);
|
||||||
void Page_CloseCurrentPage(void);
|
void Page_CloseCurrentPage(void);
|
||||||
void Page_OpenCurrentPage(void);
|
void Page_OpenCurrentPage(void);
|
||||||
uint8 Page_GetStatus(void);
|
uint8_t Page_GetStatus(void);
|
||||||
void Page_Run(void);
|
void Page_Run(void);
|
||||||
void Page_Init(void);
|
void Page_Init(void);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ static void Exit()
|
|||||||
*/
|
*/
|
||||||
static void Loop()
|
static void Loop()
|
||||||
{
|
{
|
||||||
|
Show_Marked_Image();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,9 +99,9 @@ void PageRegister_page_menu(unsigned char pageID)
|
|||||||
static void Print_Menu_p(void)
|
static void Print_Menu_p(void)
|
||||||
{
|
{
|
||||||
// SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####");
|
// SCREEN_showstr_style(5 * 8, 0, RED, WHITE, "#### MAIN MENU ####");
|
||||||
ips114_show_string(0, 0, Text);
|
ips200_show_string(0, 0, Text);
|
||||||
for (uint8 i = page_menu + 1; i < page_max; i++) {
|
for (uint8_t i = page_menu + 1; i < page_max; i++) {
|
||||||
ips114_show_string(8, i, pagelist[i].Text);
|
ips200_show_string(8, i, pagelist[i].Text);
|
||||||
// SCREEN_showstr(8, i, pagelist[i].Text);
|
// SCREEN_showstr(8, i, pagelist[i].Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
106
app/page/cw_page_rtcam.c
Normal file
106
app/page/cw_page_rtcam.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#include "zf_common_headfile.h"
|
||||||
|
#include "cw_page_ui_widget.h"
|
||||||
|
#include "cw_page.h"
|
||||||
|
|
||||||
|
#define LINE_HEAD 1
|
||||||
|
#define LINE_END 7
|
||||||
|
|
||||||
|
static char Text[] = "RealTime Image";
|
||||||
|
|
||||||
|
static int8_t Curser = 1; // 定义光标位置
|
||||||
|
static int8_t Curser_Last = 1; // 定义光标位置
|
||||||
|
static void Print_Menu_p(void);
|
||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* 以下为页面模板函数
|
||||||
|
*
|
||||||
|
***************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面初始化事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Setup()
|
||||||
|
{
|
||||||
|
ips114_clear();
|
||||||
|
Print_Menu_p();
|
||||||
|
Print_Curser(Curser, Curser_Last);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面退出事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Exit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面循环执行的内容
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 == event) {
|
||||||
|
if (page_max > Curser && page_menu < Curser) {
|
||||||
|
Page_Shift(Curser); // 切换到光标选中的页面
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Curser < LINE_HEAD) {
|
||||||
|
Curser = LINE_END;
|
||||||
|
} else if (Curser > LINE_END) {
|
||||||
|
Curser = LINE_HEAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
Print_Curser(Curser, Curser_Last);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面注册函数
|
||||||
|
*
|
||||||
|
* @param pageID
|
||||||
|
*/
|
||||||
|
void PageRegister_page_rtcam(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 ####");
|
||||||
|
ips200_show_string(0, 0, Text);
|
||||||
|
for (uint8_t i = page_menu + 1; i < page_max; i++) {
|
||||||
|
ips200_show_string(8, i, pagelist[i].Text);
|
||||||
|
// SCREEN_showstr(8, i, pagelist[i].Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#include "cw_page_ui_widget.h"
|
#include "cw_page_ui_widget.h"
|
||||||
|
#include "zf_common_headfile.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 绘制光标
|
* @brief 绘制光标
|
||||||
@@ -6,60 +8,63 @@
|
|||||||
* @param Curser_In 当前光标位置
|
* @param Curser_In 当前光标位置
|
||||||
* @param Curser_Last_In 上一时刻光标位置
|
* @param Curser_Last_In 上一时刻光标位置
|
||||||
*/
|
*/
|
||||||
void Print_Curser(uint8 Curser_In, uint8 Curser_Last_In) {
|
void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In)
|
||||||
ips114_show_string(0, Curser_Last_In, " ");
|
{
|
||||||
ips114_show_string(0, Curser_In, ">");
|
ips200_show_string(0, Curser_Last_In * 16, " ");
|
||||||
|
ips200_show_string(0, Curser_In * 16, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 打印菜单项
|
* @brief 打印菜单项
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Print_Menu(const ITEM *item, uint8 item_sum) {
|
void Print_Menu(const ITEM *item, uint8_t item_sum)
|
||||||
ips114_show_string(0, 0, " --return--");
|
{
|
||||||
for (uint8 i = 0; i < item_sum; i++) {
|
ips200_show_string(0, 0, " --return--");
|
||||||
ips114_show_string(8, i + 1, item[i].text);
|
for (uint8_t i = 0; i < item_sum; i++) {
|
||||||
}
|
ips200_show_string(8, i * 16 + 16, item[i].text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 打印数值项
|
* @brief 打印数值项
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Print_Value(const ITEM *item, uint8 item_sum) {
|
void Print_Value(const ITEM *item, uint8_t item_sum)
|
||||||
// for (uint8 i = 0; i < item_sum; i++) {
|
{
|
||||||
// switch (Param_Data[item[i].data_tag].type) {
|
// for (uint8_t i = 0; i < item_sum; i++) {
|
||||||
// case EINT8:
|
// switch (Param_Data[item[i].data_tag].type) {
|
||||||
// ips114_show_int(128, i + 1,
|
// case EINT8:
|
||||||
// *((int8 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// break;
|
// *((int8_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// case EINT16:
|
// break;
|
||||||
// ips114_show_int(128, i + 1,
|
// case EINT16:
|
||||||
// *((int16 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// break;
|
// *((int16_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// case EINT32:
|
// break;
|
||||||
// ips114_show_int(128, i + 1,
|
// case EINT32:
|
||||||
// *((int32 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// break;
|
// *((int32_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// case EUINT8:
|
// break;
|
||||||
// ips114_show_int(128, i + 1,
|
// case EUINT8:
|
||||||
// *((uint8 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// break;
|
// *((uint8_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// case EUINT16:
|
// break;
|
||||||
// ips114_show_int(128, i + 1,
|
// case EUINT16:
|
||||||
// *((uint16 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// break;
|
// *((uint16_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// case EUINT32:
|
// break;
|
||||||
// ips114_show_int(128, i + 1,
|
// case EUINT32:
|
||||||
// *((uint32 *)Param_Data[item[i].data_tag].p_data), 5);
|
// ips200_show_int(128, i + 1,
|
||||||
// case EFLOAT:
|
// *((uint32_t *)Param_Data[item[i].data_tag].p_data), 5);
|
||||||
// ips114_show_float(128, i + 1,
|
// case EFLOAT:
|
||||||
// *((float *)Param_Data[item[i].data_tag].p_data), 5, 2);
|
// ips200_show_float(128, i + 1,
|
||||||
// break;
|
// *((float *)Param_Data[item[i].data_tag].p_data), 5, 2);
|
||||||
// default:
|
// break;
|
||||||
// break;
|
// default:
|
||||||
// }
|
// break;
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,56 +73,78 @@ void Print_Value(const ITEM *item, uint8 item_sum) {
|
|||||||
* @param item_num
|
* @param item_num
|
||||||
* @param dir
|
* @param dir
|
||||||
*/
|
*/
|
||||||
void Set_Vaule(ITEM *item, uint8 item_num, float step) {
|
void Set_Vaule(ITEM *item, uint8_t item_num, float step)
|
||||||
|
{
|
||||||
|
|
||||||
// if (EFLOAT == Param_Data[item[item_num].data_tag].type) { // 待修改变量为浮点
|
// if (EFLOAT == Param_Data[item[item_num].data_tag].type) { // 待修改变量为浮点
|
||||||
// *((float *)Param_Data[item[item_num].data_tag].p_data) += step;
|
// *((float *)Param_Data[item[item_num].data_tag].p_data) += step;
|
||||||
// ips114_show_float(128, item_num + 1,
|
// ips200_show_float(128, item_num + 1,
|
||||||
// *((float *)Param_Data[item[item_num].data_tag].p_data), 6,
|
// *((float *)Param_Data[item[item_num].data_tag].p_data), 6,
|
||||||
// 2);
|
// 2);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (0 < step &&
|
// if (0 < step &&
|
||||||
// 1 > step) { // 避免步进值小于 1 时截尾为 0,不知道为啥 ceil 函数不可用
|
// 1 > step) { // 避免步进值小于 1 时截尾为 0,不知道为啥 ceil 函数不可用
|
||||||
// step = 1;
|
// step = 1;
|
||||||
// } else if (0 > step && -1 < step) {
|
// } else if (0 > step && -1 < step) {
|
||||||
// step = -1;
|
// step = -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// switch (Param_Data[item[item_num].data_tag].type) {
|
// switch (Param_Data[item[item_num].data_tag].type) {
|
||||||
// case EINT8:
|
// case EINT8:
|
||||||
// *((int8 *)Param_Data[item[item_num].data_tag].p_data) += (int8)step;
|
// *((int8_t *)Param_Data[item[item_num].data_tag].p_data) += (int8_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((int8 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((int8_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// case EINT16:
|
// case EINT16:
|
||||||
// *((int16 *)Param_Data[item[item_num].data_tag].p_data) += (int16)step;
|
// *((int16_t *)Param_Data[item[item_num].data_tag].p_data) += (int16_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((int16 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((int16_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// case EINT32:
|
// case EINT32:
|
||||||
// *((int32 *)Param_Data[item[item_num].data_tag].p_data) += (int32)step;
|
// *((int32_t *)Param_Data[item[item_num].data_tag].p_data) += (int32_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((int32 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((int32_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// case EUINT8:
|
// case EUINT8:
|
||||||
// *((uint8 *)Param_Data[item[item_num].data_tag].p_data) += (uint8)step;
|
// *((uint8_t *)Param_Data[item[item_num].data_tag].p_data) += (uint8_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((uint8 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((uint8_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// case EUINT16:
|
// case EUINT16:
|
||||||
// *((uint16 *)Param_Data[item[item_num].data_tag].p_data) += (uint16)step;
|
// *((uint16_t *)Param_Data[item[item_num].data_tag].p_data) += (uint16_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((uint16 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((uint16_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// case EUINT32:
|
// case EUINT32:
|
||||||
// *((uint32 *)Param_Data[item[item_num].data_tag].p_data) += (uint32)step;
|
// *((uint32_t *)Param_Data[item[item_num].data_tag].p_data) += (uint32_t)step;
|
||||||
// ips114_show_int(128, item_num + 1,
|
// ips200_show_int(128, item_num + 1,
|
||||||
// *((uint32 *)Param_Data[item[item_num].data_tag].p_data), 5);
|
// *((uint32_t *)Param_Data[item[item_num].data_tag].p_data), 5);
|
||||||
// break;
|
// break;
|
||||||
// default:
|
// default:
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
ips200_show_gray_image(START_X, START_Y, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, IMAGE_DISPLAY_WIDTH, IMAGE_DISPLAY_HEIGHT, 0);
|
||||||
|
|
||||||
|
// 确认边线数组在显示前不会清空
|
||||||
|
for (uint i = 0; i < PT_MAXLEN; i++) {
|
||||||
|
ips200_draw_point(START_X + (uint16_t)(mid_right[i][0] * horizontal_zoom_rate), START_Y + (uint16_t)(mid_right[i][1] * vertical_zoom_rate), RGB565_GREEN);
|
||||||
|
ips200_draw_point(START_X + (uint16_t)(mid_left[i][0] * horizontal_zoom_rate), START_Y + (uint16_t)(mid_left[i][1] * vertical_zoom_rate), RGB565_GREEN);
|
||||||
|
}
|
||||||
|
#undef IMAGE_DISPLAY_WIDTH
|
||||||
|
#undef START_X
|
||||||
|
#undef START_Y
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *text; //变量显示名
|
char *text; //变量显示名
|
||||||
uint8 data_tag; //变量结构体
|
uint8_t data_tag; //变量结构体
|
||||||
} ITEM;
|
} ITEM;
|
||||||
|
|
||||||
void Print_Curser(uint8 Curser_In, uint8 Curser_Last_In);
|
void Print_Curser(uint8_t Curser_In, uint8_t Curser_Last_In);
|
||||||
void Print_Menu(const ITEM* item, uint8 item_sum);
|
void Print_Menu(const ITEM* item, uint8_t item_sum);
|
||||||
void Print_Value(const ITEM* item, uint8 item_sum);
|
void Print_Value(const ITEM* item, uint8_t item_sum);
|
||||||
void Set_Vaule(ITEM* item, uint8 item_num, float step);
|
void Set_Vaule(ITEM* item, uint8_t item_num, float step);
|
||||||
|
void Show_Marked_Image(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -64,7 +64,7 @@
|
|||||||
#include "zf_common_typedef.h"
|
#include "zf_common_typedef.h"
|
||||||
|
|
||||||
|
|
||||||
// --------------------单排两寸屏幕SPI接口引脚定义--------------------//
|
// --------------------单排两寸屏幕 SPI 接口引脚定义--------------------//
|
||||||
|
|
||||||
#define IPS200_USE_SOFT_SPI (0 ) // 默认使用硬件 SPI 方式驱动 建议使用硬件 SPI 方式驱动
|
#define IPS200_USE_SOFT_SPI (0 ) // 默认使用硬件 SPI 方式驱动 建议使用硬件 SPI 方式驱动
|
||||||
#if IPS200_USE_SOFT_SPI // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的
|
#if IPS200_USE_SOFT_SPI // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的
|
||||||
@@ -85,13 +85,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 如果使用的是单排排针的两寸屏幕 SPI 驱动控制引脚 可以修改
|
// 如果使用的是单排排针的两寸屏幕 SPI 驱动控制引脚 可以修改
|
||||||
#define IPS200_RST_PIN_SPI (B7 ) // 液晶复位引脚定义
|
// #define IPS200_RST_PIN_SPI (B7 ) // 液晶复位引脚定义
|
||||||
#define IPS200_DC_PIN_SPI (D7 ) // 液晶命令位引脚定义
|
// #define IPS200_DC_PIN_SPI (D7 ) // 液晶命令位引脚定义
|
||||||
#define IPS200_CS_PIN_SPI (D4 )
|
// #define IPS200_CS_PIN_SPI (D4 )
|
||||||
#define IPS200_BLk_PIN_SPI (D0 )
|
// #define IPS200_BLk_PIN_SPI (D0 )
|
||||||
|
|
||||||
|
#define IPS200_RST_PIN_SPI (D8 ) // 液晶复位引脚定义
|
||||||
|
#define IPS200_DC_PIN_SPI (D9 ) // 液晶命令位引脚定义
|
||||||
|
#define IPS200_CS_PIN_SPI (D10 )
|
||||||
|
#define IPS200_BLk_PIN_SPI (D11 )
|
||||||
|
|
||||||
|
|
||||||
// --------------------单排两寸屏幕SPI接口引脚定义--------------------//
|
// --------------------单排两寸屏幕 SPI 接口引脚定义--------------------//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -103,16 +108,16 @@
|
|||||||
#define IPS200_CS_PIN_PARALLEL8 (D4 )
|
#define IPS200_CS_PIN_PARALLEL8 (D4 )
|
||||||
#define IPS200_BL_PIN_PARALLEL8 (D0 )
|
#define IPS200_BL_PIN_PARALLEL8 (D0 )
|
||||||
|
|
||||||
//8个数据引脚必须连续 例如B0-B7,B6-B13等等。
|
//8 个数据引脚必须连续 例如 B0-B7,B6-B13 等等。
|
||||||
//--------------数据端口寄存器--------------
|
//--------------数据端口寄存器--------------
|
||||||
#define IPS200_DATAPORT GPIOE
|
#define IPS200_DATAPORT GPIOE
|
||||||
|
|
||||||
//--------------数据端口起始地址偏移--------------
|
//--------------数据端口起始地址偏移--------------
|
||||||
#define DATA_START_NUM 0
|
#define DATA_START_NUM 0
|
||||||
|
|
||||||
//例:D1-D8 IPS200_DATAPORT设置为GPIOD DATA_START_NUM设置为1
|
//例:D1-D8 IPS200_DATAPORT 设置为 GPIOD DATA_START_NUM 设置为 1
|
||||||
//例:C5-C12 IPS200_DATAPORT设置为GPIOC DATA_START_NUM设置为5
|
//例:C5-C12 IPS200_DATAPORT 设置为 GPIOC DATA_START_NUM 设置为 5
|
||||||
// --------------------双排SPI接口两寸屏幕引脚定义--------------------//
|
// --------------------双排 SPI 接口两寸屏幕引脚定义--------------------//
|
||||||
|
|
||||||
#define IPS200_DEFAULT_DISPLAY_DIR (IPS200_PORTAIT) // 默认的显示方向
|
#define IPS200_DEFAULT_DISPLAY_DIR (IPS200_PORTAIT) // 默认的显示方向
|
||||||
#define IPS200_DEFAULT_PENCOLOR (RGB565_RED ) // 默认的画笔颜色
|
#define IPS200_DEFAULT_PENCOLOR (RGB565_RED ) // 默认的画笔颜色
|
||||||
@@ -139,9 +144,9 @@ typedef enum
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
IPS200_PORTAIT = 0, // 竖屏模式
|
IPS200_PORTAIT = 0, // 竖屏模式
|
||||||
IPS200_PORTAIT_180 = 1, // 竖屏模式 旋转180
|
IPS200_PORTAIT_180 = 1, // 竖屏模式 旋转 180
|
||||||
IPS200_CROSSWISE = 2, // 横屏模式
|
IPS200_CROSSWISE = 2, // 横屏模式
|
||||||
IPS200_CROSSWISE_180 = 3, // 横屏模式 旋转180
|
IPS200_CROSSWISE_180 = 3, // 横屏模式 旋转 180
|
||||||
}ips200_dir_enum;
|
}ips200_dir_enum;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
Reference in New Issue
Block a user