#include "TopDefine.h" #include "FreeRTOS.h" #include "userTask.h" #include #include "shootTask.hpp" #include "shoot.hpp" #include "remote_control.h" #include "nuc.h" extern RC_ctrl_t rc_ctrl; Shoot shoot; NUC_t nucData; // 自瞄 int aaaxxx=0; void FunctionShoot(void *argument) { (void)argument; /* 未使用argument,消除警告 */ const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CTRL_SHOOT; osDelay(3000);//等待M2006电机启动 uint32_t tick = osKernelGetTickCount(); while(1) { #ifdef DEBUG task_struct.stack_water_mark.shoot = osThreadGetStackSpace(osThreadGetId()); #endif shoot.rc_mode(); //遥控器模式 if (osMessageQueueGet(task_struct.msgq.nuc, &nucData, NULL, 0) == osOK) { shoot.distanceGet(nucData); } shoot.shoot_control(); // shoot.t_posSet=aaaxxx; // shoot.trigger_control(); // shoot.GO_SendData(goangle,5); // shoot.shoot_control(); // shoot.t_posSet=goangle; // shoot.trigger_control(); tick += delay_tick; /* 计算下一个唤醒时刻 */ osDelayUntil(tick); } }