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;