mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 11:37:45 +08:00
修复消息队列野指针的bug和队列长度计算异常的错误
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "robot.h"
|
||||
#include "message_center.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -64,7 +65,13 @@ void MX_FREERTOS_Init(void);
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float a;
|
||||
uint8_t b;
|
||||
uint32_t c;
|
||||
/* data */
|
||||
}good;
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
@@ -113,6 +120,17 @@ int main(void)
|
||||
|
||||
RobotInit();
|
||||
|
||||
good asdf;
|
||||
good asdfsadf;
|
||||
good pub={.a=1,.b=2,.c=3};
|
||||
Subscriber_t* s=SubRegister("test\0",sizeof(good));
|
||||
Subscriber_t* ss=SubRegister("test\0",sizeof(good));
|
||||
Publisher_t* p=PubRegister("test\0",sizeof(asdf));
|
||||
PubPushMessage(p,&pub);
|
||||
PubPushMessage(p,&pub);
|
||||
volatile uint8_t d= SubGetMessage(s,&asdf);
|
||||
d=SubGetMessage(s,&asdf);
|
||||
d=SubGetMessage(ss,&asdfsadf);
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Call init function for freertos objects (in freertos.c) */
|
||||
|
||||
Reference in New Issue
Block a user