fix cap
This commit is contained in:
parent
89ac086894
commit
415b6e4c0f
@ -89,6 +89,7 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
User/module/config.c
|
||||
User/module/gimbal.c
|
||||
User/module/shoot.c
|
||||
User/module/cap.c
|
||||
User/module/cmd/cmd.c
|
||||
User/module/cmd/cmd_adapter.c
|
||||
User/module/cmd/cmd_behavior.c
|
||||
@ -107,6 +108,7 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
User/task/monitor.c
|
||||
User/task/rc.c
|
||||
User/task/cli.c
|
||||
User/task/cap.c
|
||||
User/task/user_task.c
|
||||
User/task/vofa.c
|
||||
User/task/cmd.c
|
||||
|
||||
@ -8,8 +8,8 @@ extern "C" {
|
||||
#include "device/device.h"
|
||||
//#include "referee.h"
|
||||
|
||||
#define SUPERCAP_CAN BSP_FDCAN_1
|
||||
//#define SUPERCAP_CAN BSP_FDCAN_2
|
||||
#define SUPERCAP_CAN BSP_FDCAN_2
|
||||
// #define SUPERCAP_CAN BSP_FDCAN_3
|
||||
|
||||
//#define SUPERCAP_TX_ID 0x301 //C板发给超级电容的ID
|
||||
//#define SUPERCAP_RX_ID 0x100 //超级电容发给C板的ID
|
||||
|
||||
@ -28,14 +28,14 @@ Cap_RefereeUI_t cap_ui;
|
||||
|
||||
/* USER PRIVATE CODE END */
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void Task_super_cap(void *argument) {
|
||||
void Task_cap(void *argument) {
|
||||
(void)argument; /* 未使用argument,消除警告 */
|
||||
|
||||
|
||||
/* 计算任务运行到指定频率需要等待的tick数 */
|
||||
const uint32_t delay_tick = osKernelGetTickFreq() / SUPER_CAP_FREQ;
|
||||
const uint32_t delay_tick = osKernelGetTickFreq() / CAP_FREQ;
|
||||
|
||||
osDelay(SUPER_CAP_INIT_DELAY); /* 延时一段时间再开启任务 */
|
||||
osDelay(CAP_INIT_DELAY); /* 延时一段时间再开启任务 */
|
||||
|
||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||
/* USER CODE INIT BEGIN */
|
||||
|
||||
@ -43,6 +43,7 @@ void Task_Init(void *argument) {
|
||||
task_runtime.thread.blink = osThreadNew(Task_blink, NULL, &attr_blink);
|
||||
task_runtime.thread.ctrl_shoot = osThreadNew(Task_ctrl_shoot, NULL, &attr_ctrl_shoot);
|
||||
task_runtime.thread.ai = osThreadNew(Task_ai, NULL, &attr_ai);
|
||||
task_runtime.thread.cap = osThreadNew(Task_cap, NULL, &attr_cap);
|
||||
// task_runtime.thread.vofa = osThreadNew(Task_vofa, NULL, &attr_vofa);
|
||||
task_runtime.thread.cli = osThreadNew(Task_cli, NULL, &attr_cli);
|
||||
// task_runtime.thread.debug = osThreadNew(Task_debug, NULL, &attr_debug);
|
||||
|
||||
@ -74,3 +74,8 @@ const osThreadAttr_t attr_referee = {
|
||||
.priority = osPriorityNormal,
|
||||
.stack_size = 512 * 4,
|
||||
};
|
||||
const osThreadAttr_t attr_cap = {
|
||||
.name = "cap",
|
||||
.priority = osPriorityNormal,
|
||||
.stack_size = 256 * 4,
|
||||
};
|
||||
@ -24,7 +24,7 @@ extern "C" {
|
||||
#define DEBUG_FREQ (10.0)
|
||||
#define CMD_FREQ (500.0)
|
||||
#define REFEREE_FREQ (500.0)
|
||||
#define SUPER_CAP_FREQ (500.0)
|
||||
#define CAP_FREQ (500.0)
|
||||
|
||||
/* 任务初始化延时ms */
|
||||
#define TASK_INIT_DELAY (100u)
|
||||
@ -41,7 +41,7 @@ extern "C" {
|
||||
#define DEBUG_INIT_DELAY (0)
|
||||
#define CMD_INIT_DELAY (0)
|
||||
#define REFEREE_INIT_DELAY (0)
|
||||
#define SUPER_CAP_INIT_DELAY (0)
|
||||
#define CAP_INIT_DELAY (0)
|
||||
|
||||
/* Exported defines --------------------------------------------------------- */
|
||||
/* Exported macro ----------------------------------------------------------- */
|
||||
@ -64,7 +64,7 @@ typedef struct {
|
||||
osThreadId_t debug;
|
||||
osThreadId_t cmd;
|
||||
osThreadId_t referee;
|
||||
|
||||
osThreadId_t cap;
|
||||
} thread;
|
||||
|
||||
/* USER MESSAGE BEGIN */
|
||||
@ -144,6 +144,7 @@ typedef struct {
|
||||
UBaseType_t ai;
|
||||
UBaseType_t vofa;
|
||||
UBaseType_t cli;
|
||||
UBaseType_t cap;
|
||||
UBaseType_t debug;
|
||||
UBaseType_t cmd;
|
||||
UBaseType_t referee;
|
||||
@ -163,6 +164,7 @@ typedef struct {
|
||||
float debug;
|
||||
float cmd;
|
||||
float referee;
|
||||
float cap;
|
||||
} freq;
|
||||
|
||||
/* 任务最近运行时间 */
|
||||
@ -178,6 +180,7 @@ typedef struct {
|
||||
float debug;
|
||||
float cmd;
|
||||
float referee;
|
||||
float cap;
|
||||
} last_up_time;
|
||||
|
||||
} Task_Runtime_t;
|
||||
@ -199,6 +202,7 @@ extern const osThreadAttr_t attr_vofa;
|
||||
extern const osThreadAttr_t attr_cli;
|
||||
extern const osThreadAttr_t attr_debug;
|
||||
extern const osThreadAttr_t attr_cmd;
|
||||
extern const osThreadAttr_t attr_cap;
|
||||
extern const osThreadAttr_t attr_referee;
|
||||
|
||||
/* 任务函数声明 */
|
||||
@ -216,7 +220,7 @@ void Task_cli(void *argument);
|
||||
void Task_debug(void *argument);
|
||||
void Task_cmd(void *argument);
|
||||
void Task_referee(void *argument);
|
||||
|
||||
void Task_cap(void *argument);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user