From bd619cc30a587492d77301d3149faf58d4f3c5c9 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Wed, 9 Sep 2026 10:42:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9MK32=E5=92=8C=E9=99=80=E8=9E=BA?= =?UTF-8?q?=E4=BB=AA=E7=9A=84=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=E5=81=9A?= =?UTF-8?q?=E9=99=8D=E9=A2=91=EF=BC=8C=E9=98=B2=E6=AD=A2=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=98=9F=E5=88=97=E9=95=BF=E6=97=B6=E9=97=B4=E5=8D=A0=E6=BB=A1?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8D=E8=BF=87=E6=9D=A5=E3=80=82rbcore?= =?UTF-8?q?=E4=B9=9F=E8=B0=83=E5=A4=A7=E4=B8=BA2k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RBcore/BHBF.c | 2 +- RBcore/TL720D.c | 10 +++++++++- project/paint_robot_new/paint_robot_new_MK32.c | 10 +++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) 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)); + } }