pref: 整理部分文件和变量

This commit is contained in:
2024-01-06 16:22:49 +08:00
parent a3bb280c7e
commit 8f0a04b962
12 changed files with 181 additions and 193 deletions

View File

@@ -25,94 +25,29 @@
#include "gl_headfile.h"
#include "by_rt_button.h"
#include "by_fan_control.h"
#include "cw_servo.h"
#include "./page/cw_page.h"
uint8_t (*Img_Gray)[MT9V03X_W];
// uint8_t *mt9v03x_image_copy[0];
int32_t pts_left[PT_MAXLEN][2];
int32_t pts_right[PT_MAXLEN][2];
int32_t pts_left_count, pts_right_count;
float pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
int32_t pts_inv_l_count, pts_inv_r_count;
float pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
int32_t pts_filter_l_count, pts_filter_r_count;
float pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
int32_t pts_resample_left_count, pts_resample_right_count;
float mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
int32_t mid_left_count, mid_right_count;
float angle_new_left[PT_MAXLEN];
float angle_new_right[PT_MAXLEN];
int angle_new_left_num, angle_new_right_num;
uint8_t mt9v03x_image_copy[MT9V03X_H][MT9V03X_W];
float angle_left[PT_MAXLEN];
float angle_right[PT_MAXLEN];
int angle_left_num, angle_right_num;
int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
bool Lpt0_found, Lpt1_found;
int Lpt1[2], Lpt0[2];
int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
bool Lpt_in0_found, Lpt_in1_found;
int Lpt_in1[2], Lpt_in0[2];
bool is_straight0, is_straight1;
bool is_turn0, is_turn1;
float rptsn[PT_MAXLEN][2];
int rptsn_num;
float aim_distance;
enum track_type_e track_type = TRACK_RIGHT;
int frame_count = 0;
uint16_t pwm_cnt = 500;
void img_processing();
void get_corners();
int main(void)
{
clock_init(SYSTEM_CLOCK_120M);
system_delay_init();
debug_init();
mt9v03x_init();
pwm_init(TIM2_PWM_MAP0_CH1_A0, 50, 1000);
pwm_init(TIM2_PWM_MAP0_CH2_A1, 50, 1000);
ips200_init(IPS200_TYPE_SPI);
by_gpio_init();
by_exit_init();
by_pwm_init();
// cw_servo_init();
// while (imu660ra_init())
// ;
Page_Init();
while (1) {
// ips200_show_uint(0, 0, pwm_cnt, 6);
// uint8_t temp_status = by_get_rb_status();
// if (2 == temp_status) {
// pwm_cnt += 50;
// } else if (3 == temp_status) {
// pwm_cnt -= 50;
// }
// pwm_cnt = (uint16_t)clip(pwm_cnt, 500, 1000);
// by_pwm_update_duty(4000);
// pwm_set_duty(TIM2_PWM_MAP0_CH1_A0, pwm_cnt);
// pwm_set_duty(TIM2_PWM_MAP0_CH2_A1, pwm_cnt);
// by_pwm_update_duty(pwm_cnt);
Page_Run();
if (mt9v03x_finish_flag) {
// 该操作消耗大概 1970 个 tick折合约 110us
memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
mt9v03x_finish_flag = 0;