From a334c2c8a227f5ba5fb3a3671cdefa5801d39bfb Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Thu, 20 Aug 2026 10:50:09 +0800 Subject: [PATCH] =?UTF-8?q?paint=5Frobot=5Fnew=20v1.0=E3=80=90=E8=B0=83?= =?UTF-8?q?=E9=80=9A=E6=89=93=E6=A0=87=E3=80=91=E8=B0=83=E6=95=B4MK32?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=BD=BF=E7=94=A8probuf=E4=B8=AD=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paint_robot_new/include/paint_robot_new.h | 22 +------------------ project/paint_robot_new/paint_robot_new.c | 13 +++++------ 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/project/paint_robot_new/include/paint_robot_new.h b/project/paint_robot_new/include/paint_robot_new.h index ece89d5..49cedc0 100644 --- a/project/paint_robot_new/include/paint_robot_new.h +++ b/project/paint_robot_new/include/paint_robot_new.h @@ -66,27 +66,7 @@ extern "C"{ /*==============================================* * constants or macros define * *----------------------------------------------*/ -typedef struct _MSP_MK32_Button -{ - int32_t CH0_RY_H; - int32_t CH1_RY_V; - int32_t CH2_LY_V; - int32_t CH3_LY_H; - int32_t CH4_SA; - int32_t CH5_SB; - int32_t CH6_SC; - int32_t CH7_SD; - int32_t CH8_SE; - int32_t CH9_SF; - int32_t CH10_LD1; - int32_t CH11_RD1; - int32_t CH12_S1; - int32_t CH13_S2; - int32_t CH14_LT; - int32_t CH15_RT; - int32_t IsOnline; - int32_t RxIndex; -} MSP_MK32_Button; + /*==============================================* * project-wide global variables * diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index 5f40d0f..93c5fa6 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -16,11 +16,12 @@ 修改内容 : 创建文件 ******************************************************************************/ -#include "paint_robot_new.h" #include "BHBF.h" #include "pb.h" #include "pb_decode.h" #include "../Protobuf/PSource/bsp_PV.pb.h" +#include "../Protobuf/PSource/msp_MK32.pb.h" +#include /*----------------------------------------------* * 外部变量说明 * @@ -33,13 +34,13 @@ /*----------------------------------------------* * 内部函数原型说明 * *----------------------------------------------*/ -static MSP_MK32_Button RB_MK32; +static SP_MSP_MK32_Button RB_MK32; +static PV_struct_define decoded_PV_variable = { 0 }; +static PV_struct_define decoded_PV = { 0 }; /*----------------------------------------------* * 全局变量 * *----------------------------------------------*/ -PV_struct_define decoded_PV_variable = { 0 }; -PV_struct_define decoded_PV = { 0 }; /*----------------------------------------------* * 模块级变量 * @@ -90,13 +91,11 @@ void decode_MK32(const char *buf, uint32_t _iSize) // 按键数值转换:1050为中间值,272-1712 for (int i = 0; i < 16; i++) { - // 通过指针解引用赋值,完美替代原来的 RB_MK32[i + 1] CH[i] = (int32_t)((CH[i] - 992) * 1.388889); } - RD_MEMCPY(&RB_MK32, CH, sizeof(CH)); + RD_MEMCPY(&(RB_MK32.CH0_RY_H), CH, sizeof(CH)); - // buf[23] 才是在线标志字节,对应老工程 Sbus_Data_Count(&buffer[1]) 中的 buf[22]==buffer[23] if (buf[23] == 0) { RB_MK32.IsOnline = 1;