Browse Source

对MK32和陀螺仪的发送消息做降频,防止消息队列长时间占满处理不过来。rbcore也调大为2k

master
Lizongdi 17 hours ago
parent
commit
bd619cc30a
  1. 2
      RBcore/BHBF.c
  2. 8
      RBcore/TL720D.c
  3. 8
      project/paint_robot_new/paint_robot_new_MK32.c

2
RBcore/BHBF.c

@ -133,7 +133,7 @@ void RBcore_Init(void)
const osThreadAttr_t GF_Dispatch_attributes = {
.name = MODULE_NAME_RBCORE,
.stack_size = 1024,
.stack_size = 2048,
.priority = (osPriority_t) osPriorityRealtime1,
};
(void)osThreadNew(RBcore_Task, NULL, &GF_Dispatch_attributes);

8
RBcore/TL720D.c

@ -19,6 +19,7 @@
#include "msp_TL720D.pb.h"
#include "BHBF.h"
#include "msg_center.h"
#include "rd_time.h"
/*----------------------------------------------*
* *
@ -107,6 +108,8 @@ static int check_TL720D(char *_pBuffer, uint32_t _iSize)
static void decode_TL720D(const char *buf, uint32_t _iSize)
{
static uint32_t uiLastSendTick = 0;
g_stTL720D.RF_Angle_Roll = getDeci((uint8_t *)&buf[4]);
g_stTL720D.RF_Angle_Pitch = getDeci((uint8_t *)&buf[7]);
g_stTL720D.RF_Angle_Yaw = getDeci((uint8_t *)&buf[10]);
@ -117,8 +120,13 @@ static void decode_TL720D(const char *buf, uint32_t _iSize)
g_stTL720D.RF_Gro_Y = getDeci((uint8_t *)&buf[25]);
g_stTL720D.RF_Gro_Z = getDeci((uint8_t *)&buf[28]);
uint32_t uiNowTick = Rd_GetTime();
if ((int32_t)(uiNowTick - uiLastSendTick) >= 50)
{
uiLastSendTick = uiNowTick;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t));
}
}
void Read_TL720D(void *argument)
{

8
project/paint_robot_new/paint_robot_new_MK32.c

@ -19,6 +19,7 @@
#include "BHBF.h"
#include "Protobuf/PSource/msp_MK32.pb.h"
#include "msg_center.h"
#include "rd_time.h"
/*----------------------------------------------*
* *
@ -59,6 +60,8 @@ int check_MK32(char *_pBuffer, uint32_t _iSize)
void decode_MK32(const char *buf, uint32_t _iSize)
{
static uint32_t uiLastSendTick = 0;
int32_t CH[16];
int Start_byte = 0;
@ -101,5 +104,10 @@ void decode_MK32(const char *buf, uint32_t _iSize)
}
RB_MK32.RxIndex++;
uint32_t uiNowTick = Rd_GetTime();
if ((int32_t)(uiNowTick - uiLastSendTick) >= 50)
{
uiLastSendTick = uiNowTick;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_MK32, (void *)&RB_MK32, sizeof(RB_MK32));
}
}

Loading…
Cancel
Save