This commit is contained in:
bmy
2024-03-04 15:07:54 +08:00
6 changed files with 20 additions and 23 deletions

View File

@@ -10,6 +10,7 @@ uint32_t a[40] = {0};
void queue_init(void)
{
queue_long = 0;
memset(a, 0, sizeof(a));
}
@@ -22,7 +23,7 @@ void queue_add_element(int element)
}
void queue_pop_element(void)
{
memmove(a, &a[1], queue_long * sizeof(a));
memmove(a, &a[1], (queue_long - 1) * sizeof(a[0]));
if (queue_long > 0) {
queue_long--;
}

View File

@@ -45,15 +45,17 @@ void sport_motion(void)
cnt1++;
in_gyro = imu660ra_gyro_z; // 陀螺仪输入
in_angle = 0; // 图像远端输入
in_pos = 0; // 图像近端输入
in_speed = encoder_get_count(TIM5_ENCOEDER) / 1024 / 0.01 * 0.25; // 速度输入m/s
encoder_clear_count(TIM5_ENCOEDER); // 清除计数
// in_angle = 0; // 图像远端输入
// in_pos = 0; // 图像近端输入
// 清除计数
PID_Compute(&far_gyro_pid);
if (cnt1 >= 10) {
PID_Compute(&far_angle_pid);
PID_Compute(&speed_pid);
in_speed = encoder_get_count(TIM5_ENCOEDER); // 速度输入m/s
// printf("rate:%d\r\n", (int16)in_speed);
encoder_clear_count(TIM5_ENCOEDER);
cnt1 = 0;
}

View File

@@ -7,6 +7,7 @@
PARAM_INFO Param_Data[DATA_NUM];
soft_iic_info_struct eeprom_param;
TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
TYPE_UNION temp_frame_param[20];
/**
* @brief 参数初始化注册

View File

@@ -63,6 +63,7 @@ typedef struct {
extern soft_iic_info_struct eeprom_param;
extern PARAM_INFO Param_Data[DATA_NUM];
extern TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
extern TYPE_UNION temp_frame_param[20];
void jj_param_eeprom_init(void);
void jj_param_write(void);
void jj_param_read(void);

View File

@@ -37,13 +37,12 @@
int main(void)
{
TYPE_UNION test_data;
TYPE_UNION test_data_last;
TYPE_UNION test_data[2];
clock_init(SYSTEM_CLOCK_120M);
system_delay_init();
debug_init();
encoder_dir_init(TIM5_ENCOEDER, TIM5_ENCOEDER_MAP0_CH1_A0, TIM5_ENCOEDER_MAP0_CH2_A1);
encoder_quad_init(TIM5_ENCOEDER, TIM5_ENCOEDER_MAP0_CH1_A0, TIM5_ENCOEDER_MAP0_CH2_A1);
ips200_init(IPS200_TYPE_SPI);
while (imu660ra_init())
;
@@ -63,17 +62,10 @@ int main(void)
printf("ok\r\n");
while (1) {
// Page_Run();
by_frame_parse(1, &test_data.u32);
Page_Run();
by_frame_parse(2, &test_data[1].u32);
if (test_data.u32 != test_data_last.u32) {
ips200_show_float(0, 50, test_data.f32, 4, 2);
// printf("- %ld\r\n", (uint32_t)(test_data.f32 * 100));
}
test_data_last.u32 = test_data.u32;
// by_buzzer_run();
// jj_bt_run();
by_buzzer_run();
jj_bt_run();
}
}

View File

@@ -33,7 +33,7 @@ static void Setup()
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_IN_FLASH_NUM-1)* 18 + 2, index_power, 5);
ips200_show_int(100, 2, index_power, 5);
}
@@ -108,7 +108,7 @@ static void Event(page_event event)
if (index_power > 2) {
index_power = -2;
}
ips200_show_int(50, (DATA_NUM-1)* 18 + 2, index_power, 5);
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);