|
|
@ -16,11 +16,12 @@ |
|
|
修改内容 : 创建文件 |
|
|
修改内容 : 创建文件 |
|
|
|
|
|
|
|
|
******************************************************************************/ |
|
|
******************************************************************************/ |
|
|
#include "paint_robot_new.h" |
|
|
|
|
|
#include "BHBF.h" |
|
|
#include "BHBF.h" |
|
|
#include "pb.h" |
|
|
#include "pb.h" |
|
|
#include "pb_decode.h" |
|
|
#include "pb_decode.h" |
|
|
#include "../Protobuf/PSource/bsp_PV.pb.h" |
|
|
#include "../Protobuf/PSource/bsp_PV.pb.h" |
|
|
|
|
|
#include "../Protobuf/PSource/msp_MK32.pb.h" |
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
/*----------------------------------------------*
|
|
|
* 外部变量说明 * |
|
|
* 外部变量说明 * |
|
|
@ -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
|
|
|
// 按键数值转换:1050为中间值,272-1712
|
|
|
for (int i = 0; i < 16; i++) |
|
|
for (int i = 0; i < 16; i++) |
|
|
{ |
|
|
{ |
|
|
// 通过指针解引用赋值,完美替代原来的 RB_MK32[i + 1]
|
|
|
|
|
|
CH[i] = (int32_t)((CH[i] - 992) * 1.388889); |
|
|
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) |
|
|
if (buf[23] == 0) |
|
|
{ |
|
|
{ |
|
|
RB_MK32.IsOnline = 1; |
|
|
RB_MK32.IsOnline = 1; |
|
|
|