feat: 增加通信内容
This commit is contained in:
@@ -51,11 +51,12 @@ float sp_Kd = 0.0f;
|
|||||||
float in_speed;
|
float in_speed;
|
||||||
float out_speed;
|
float out_speed;
|
||||||
|
|
||||||
float set_speed0 = 460.0f;
|
float set_speed0 = 460.0f;
|
||||||
float set_speed1 = 460.0f;
|
float set_speed1 = 460.0f;
|
||||||
int cnt1 = 0;
|
int cnt1 = 0;
|
||||||
int cnt2 = 0;
|
int cnt2 = 0;
|
||||||
uint32_t in_state = 0;
|
uint8_t in_state = 0;
|
||||||
|
uint8_t in_stop = 0;
|
||||||
|
|
||||||
uint32_t pwm_duty_ls;
|
uint32_t pwm_duty_ls;
|
||||||
uint32_t pwm_duty_rs;
|
uint32_t pwm_duty_rs;
|
||||||
@@ -86,7 +87,10 @@ float sport_get_speed(void)
|
|||||||
|
|
||||||
void sport_motion(void)
|
void sport_motion(void)
|
||||||
{
|
{
|
||||||
if (1 == in_state) {
|
if (1 == in_stop) {
|
||||||
|
bt_fly_flag = bt_run_flag = 0;
|
||||||
|
}
|
||||||
|
if (0 == in_state || 2 == in_state) {
|
||||||
PID_SetTunings(&far_gyro_pid, an_Kp1, an_Ki1, an_Kd1);
|
PID_SetTunings(&far_gyro_pid, an_Kp1, an_Ki1, an_Kd1);
|
||||||
PID_SetTunings(&near_pos_pid, po_Kp1, po_Ki1, po_Kd1);
|
PID_SetTunings(&near_pos_pid, po_Kp1, po_Ki1, po_Kd1);
|
||||||
PID_SetTunings(&far_gyro_pid, gy_Kp1, gy_Ki1, gy_Kd1);
|
PID_SetTunings(&far_gyro_pid, gy_Kp1, gy_Ki1, gy_Kd1);
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ extern uint32_t pwm_duty_rs;
|
|||||||
extern uint32_t pwm_duty_lb;
|
extern uint32_t pwm_duty_lb;
|
||||||
extern uint32_t pwm_duty_rb;
|
extern uint32_t pwm_duty_rb;
|
||||||
|
|
||||||
extern uint32_t in_state;
|
extern uint8_t in_state;
|
||||||
|
extern uint8_t in_stop;
|
||||||
void sport_pid_init();
|
void sport_pid_init();
|
||||||
void sport_motion(void);
|
void sport_motion(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -61,7 +61,7 @@ typedef union {
|
|||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
int32_t s32;
|
int32_t s32;
|
||||||
float f32;
|
float f32;
|
||||||
uint8_t u8;
|
uint8_t u8[4];
|
||||||
} TYPE_UNION;
|
} TYPE_UNION;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "by_frame.h"
|
#include "by_frame.h"
|
||||||
#include "by_rt_button.h"
|
#include "by_rt_button.h"
|
||||||
#include "by_fan_control.h"
|
#include "by_fan_control.h"
|
||||||
|
uint8_t last_state;
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
TYPE_UNION test_data[BY_FRAME_DATA_NUM];
|
TYPE_UNION test_data[BY_FRAME_DATA_NUM];
|
||||||
@@ -69,6 +69,11 @@ int main(void)
|
|||||||
jj_bt_run();
|
jj_bt_run();
|
||||||
in_pos = test_data[1].f32;
|
in_pos = test_data[1].f32;
|
||||||
in_angle = test_data[0].f32;
|
in_angle = test_data[0].f32;
|
||||||
in_state= test_data[2].u32;
|
in_state = test_data[2].u8[0];
|
||||||
|
in_stop = test_data[2].u8[1];
|
||||||
|
if (last_state != in_state) {
|
||||||
|
bt_printf("changing to%u\r\n",in_state);
|
||||||
|
}
|
||||||
|
last_state = in_state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,10 @@ static void Exit()
|
|||||||
*/
|
*/
|
||||||
static void Loop()
|
static void Loop()
|
||||||
{
|
{
|
||||||
ips200_show_string(0, 20, "outsp:");
|
ips200_show_string(0, 0, "sta:");
|
||||||
ips200_show_float(80, 20, out_speed, 4, 1);
|
ips200_show_float(80, 0, in_state, 4, 1);
|
||||||
|
ips200_show_string(0, 20, "sto:");
|
||||||
|
ips200_show_float(80, 20, in_stop, 4, 1);
|
||||||
ips200_show_string(0, 40, "angle");
|
ips200_show_string(0, 40, "angle");
|
||||||
ips200_show_float(80, 40, in_angle, 4, 1);
|
ips200_show_float(80, 40, in_angle, 4, 1);
|
||||||
ips200_show_string(0, 60, "near");
|
ips200_show_string(0, 60, "near");
|
||||||
@@ -59,14 +61,14 @@ static void Loop()
|
|||||||
ips200_show_string(0, 160, "outpos");
|
ips200_show_string(0, 160, "outpos");
|
||||||
ips200_show_float(80, 160, out_pos, 4, 1);
|
ips200_show_float(80, 160, out_pos, 4, 1);
|
||||||
|
|
||||||
ips200_show_string(0, 180, "ls");
|
// ips200_show_string(0, 180, "ls");
|
||||||
ips200_show_float(80, 180, pwm_duty_ls, 4, 1);
|
// ips200_show_float(80, 180, pwm_duty_ls, 4, 1);
|
||||||
ips200_show_string(0, 200, "rs");
|
// ips200_show_string(0, 200, "rs");
|
||||||
ips200_show_float(80, 200, pwm_duty_rs, 4, 1);
|
// ips200_show_float(80, 200, pwm_duty_rs, 4, 1);
|
||||||
ips200_show_string(0, 220, "lb");
|
// ips200_show_string(0, 220, "lb");
|
||||||
ips200_show_float(80, 220, pwm_duty_lb, 4, 1);
|
// ips200_show_float(80, 220, pwm_duty_lb, 4, 1);
|
||||||
ips200_show_string(100, 0, "rb");
|
// ips200_show_string(100, 0, "rb");
|
||||||
ips200_show_float(180, 0, pwm_duty_rb, 4, 1);
|
// ips200_show_float(180, 0, pwm_duty_rb, 4, 1);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 页面事件
|
* @brief 页面事件
|
||||||
|
|||||||
Reference in New Issue
Block a user