From 7d5bee30d1307be61d8a92266d26d07b6afbb7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=95=E6=98=8E=E6=B1=9F?= <246462502@qq.com> Date: Sat, 23 Mar 2024 18:26:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=81=BF=E9=9A=9C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gl_state.c | 4 +++- app/gl_state.h | 2 ++ app/gl_tracking.c | 6 +++--- app/jj_param.c | 10 +++++++--- app/jj_param.h | 13 +++++++------ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/gl_state.c b/app/gl_state.c index b6365de..6ec18f9 100644 --- a/app/gl_state.c +++ b/app/gl_state.c @@ -4,4 +4,6 @@ enum state_type_e state_type =0; float cricle_aim=0.2f; float cross_aim=0.49f; -float common_aim=0.35f; \ No newline at end of file +float common_aim=0.35f; +float barrier_aim=0.1f; +float barrier_offset=4.0f; \ No newline at end of file diff --git a/app/gl_state.h b/app/gl_state.h index e3a1cca..8d1799a 100644 --- a/app/gl_state.h +++ b/app/gl_state.h @@ -24,5 +24,7 @@ extern enum state_type_e state_type; extern float cricle_aim; extern float cross_aim; extern float common_aim; +extern float barrier_aim; +extern float barrier_offset; #endif /* STATE_H_ */ diff --git a/app/gl_tracking.c b/app/gl_tracking.c index 4ad438b..fae8979 100644 --- a/app/gl_tracking.c +++ b/app/gl_tracking.c @@ -29,7 +29,7 @@ void aim_distance_select(void) } else if (circle_type != CIRCLE_NONE) { aim_distance = cross_aim; } else if (barrier_type != BARRIER_NONE) { - aim_distance = 0.3f; + aim_distance = barrier_aim; } else { aim_distance = common_aim; } @@ -138,10 +138,10 @@ void MidLineTrack() // float error = -atan2f(dx, dy) * 180 / PI32; if (barrier_type == BARRIER_LEFT_BEGIN) { - dx_near = rptsn[aim_idx_near][1] - cx; + dx_near = rptsn[aim_idx_near][1] - cx +barrier_offset; pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * dx / dn / dn) / PI32 * 180.0f; } else if (barrier_type == BARRIER_RIGHT_BEGIN) { - dx_near = rptsn[aim_idx_near][1] - cx; + dx_near = rptsn[aim_idx_near][1] - cx - barrier_offset; pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * dx / dn / dn) / PI32 * 180.0f; } else { dx_near = rptsn[aim_idx_near][1] - cx; diff --git a/app/jj_param.c b/app/jj_param.c index 777ecb3..5947df4 100644 --- a/app/jj_param.c +++ b/app/jj_param.c @@ -16,9 +16,13 @@ uint32_t *addre[2]; void jj_param_eeprom_init(void) { soft_iic_init(&eeprom_param, K24C02_DEV_ADDR, K24C02_SOFT_IIC_DELAY, K24C02_SCL_PIN, K24C02_SDA_PIN); // eeprom初始化 - PARAM_REG(aim_cross, &cross_aim, EFLOAT, 1, "cros:"); // 注冊 - PARAM_REG(aim_cricle, &cricle_aim, EFLOAT, 1, "cric:"); // 注冊 - PARAM_REG(aim_common, &common_aim, EFLOAT, 1, "comm:"); // 注冊 + PARAM_REG(aim_cross, &cross_aim, EFLOAT, 1, "cros:"); // 注冊 + PARAM_REG(aim_cricle, &cricle_aim, EFLOAT, 1, "cric:"); // 注冊 + PARAM_REG(aim_common, &common_aim, EFLOAT, 1, "comm:"); // 注冊 + PARAM_REG(aim_barrier, &barrier_aim, EFLOAT, 1, "barr:"); + PARAM_REG(offset_barrier, &barrier_offset, EFLOAT, 1, "offs:"); + PARAM_REG(delta_x, &pure_angle, EFLOAT, 2, "far:"); + PARAM_REG(delta_y, &dx_near, EFLOAT, 2, "near:"); jj_param_read(); // 注冊 } diff --git a/app/jj_param.h b/app/jj_param.h index e744b5c..4f60104 100644 --- a/app/jj_param.h +++ b/app/jj_param.h @@ -16,15 +16,16 @@ typedef enum { - Page1_head=0, - - aim_common=Page1_head, + Page1_head = 0, + + aim_common = Page1_head, aim_cross, aim_cricle, - + aim_barrier, + offset_barrier, Page2_head, // 第二页参数 - imgax_Kp=Page2_head, + imgax_Kp = Page2_head, imgax_Ki, imgax_Kd, @@ -52,7 +53,7 @@ typedef union { typedef struct { void *p_data; ENUM_TYPE type; - uint8_t cmd;//01:仅存储 00:仅显示 02:传输并显示 + uint8_t cmd; // 01:仅存储 00:仅显示 02:传输并显示 char *text; } PARAM_INFO; extern soft_iic_info_struct eeprom_param;