|
|
@ -18,6 +18,9 @@ |
|
|
******************************************************************************/ |
|
|
******************************************************************************/ |
|
|
#include "paint_robot_new.h" |
|
|
#include "paint_robot_new.h" |
|
|
#include "BHBF.h" |
|
|
#include "BHBF.h" |
|
|
|
|
|
#include "pb.h" |
|
|
|
|
|
#include "pb_decode.h" |
|
|
|
|
|
#include "../Protobuf/PSource/bsp_PV.pb.h" |
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
/*----------------------------------------------*
|
|
|
* 外部变量说明 * |
|
|
* 外部变量说明 * |
|
|
@ -31,10 +34,12 @@ |
|
|
* 内部函数原型说明 * |
|
|
* 内部函数原型说明 * |
|
|
*----------------------------------------------*/ |
|
|
*----------------------------------------------*/ |
|
|
static MSP_MK32_Button RB_MK32; |
|
|
static MSP_MK32_Button RB_MK32; |
|
|
static int RB_Mode = 0; //0表示手动,1表示自动
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
/*----------------------------------------------*
|
|
|
* 全局变量 * |
|
|
* 全局变量 * |
|
|
*----------------------------------------------*/ |
|
|
*----------------------------------------------*/ |
|
|
|
|
|
PV_struct_define decoded_PV_variable = { 0 }; |
|
|
|
|
|
PV_struct_define decoded_PV = { 0 }; |
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
/*----------------------------------------------*
|
|
|
* 模块级变量 * |
|
|
* 模块级变量 * |
|
|
@ -159,9 +164,32 @@ int check_PV(char *_pBuffer, uint32_t _iSize) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void decode_PV(const char *buf, uint32_t _iSize) |
|
|
void decode_PV(const char *_pBuffer, uint32_t _iSize) |
|
|
{ |
|
|
{ |
|
|
RB_Mode = 0; |
|
|
if (_pBuffer[2] == 0x01 && _pBuffer[3] == 0x01) //01 01 设置PV
|
|
|
|
|
|
{ |
|
|
|
|
|
pb_istream_t i_pv_stream; |
|
|
|
|
|
|
|
|
|
|
|
i_pv_stream = pb_istream_from_buffer((const pb_byte_t *)&_pBuffer[4], _iSize - 6); |
|
|
|
|
|
pb_decode(&i_pv_stream, PV_struct_define_fields, &decoded_PV_variable); |
|
|
|
|
|
|
|
|
|
|
|
if(decoded_PV_variable.TimeStamp>decoded_PV.TimeStamp) |
|
|
|
|
|
{ |
|
|
|
|
|
decoded_PV=decoded_PV_variable; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if (*(_pBuffer + 2) == 0x02 && *(_pBuffer + 3) == 0x01) //设置PV
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else if (*(_pBuffer + 2) == 0x03 && *(_pBuffer + 3) == 0x01) //返回IV
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
// Motor_CmdData_t tMotor_CmdData_t = {0};
|
|
|
// Motor_CmdData_t tMotor_CmdData_t = {0};
|
|
|
// tMotor_CmdData_t.m_ucMotorIndex = 1;
|
|
|
// tMotor_CmdData_t.m_ucMotorIndex = 1;
|
|
|
// tMotor_CmdData_t.m_iValue = 10;
|
|
|
// tMotor_CmdData_t.m_iValue = 10;
|
|
|
|