diff --git a/RBcore/BHBF.c b/RBcore/BHBF.c index af3aa5a..d7d4d0a 100644 --- a/RBcore/BHBF.c +++ b/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); diff --git a/RBcore/TL720D.c b/RBcore/TL720D.c index 247c5da..cce5dbc 100644 --- a/RBcore/TL720D.c +++ b/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,7 +120,12 @@ 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]); - MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t)); + 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) diff --git a/project/paint_robot_new/paint_robot_new_MK32.c b/project/paint_robot_new/paint_robot_new_MK32.c index d68f69a..8c49958 100644 --- a/project/paint_robot_new/paint_robot_new_MK32.c +++ b/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++; - MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_MK32, (void *)&RB_MK32, sizeof(RB_MK32)); + 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)); + } }