Skip to content

Commit

Permalink
Merge pull request #21 from RoboMaster/icra2019_dev
Browse files Browse the repository at this point in the history
BUG:修复一个协议接口初始化值错误导致的重复解包
  • Loading branch information
bzrobotics committed May 5, 2019
2 parents 651a7c3 + 05f2e25 commit 9cb7d9d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
Binary file modified MDK-ARM/bin/infantry.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion MDK-ARM/infantry.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>0</BrowseInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>..\build\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
Expand Down
4 changes: 3 additions & 1 deletion application/infantry_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "sys.h"

#define FIRMWARE_VERSION_0 5u
#define FIRMWARE_VERSION_0 6u
#define FIRMWARE_VERSION_1 1u
#define FIRMWARE_VERSION_2 0u
#define FIRMWARE_VERSION_3 1u
Expand All @@ -37,6 +37,8 @@
#define CHASSIS_ADDRESS 0x01
#define GIMBAL_ADDRESS 0x02

/* cmd id can not be set 0xffff */

#define CMD_MANIFOLD2_HEART (0x0001u)
#define CMD_REPORT_VERSION (0x0002u)

Expand Down
19 changes: 14 additions & 5 deletions application/protocol/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,21 @@ uint32_t protocol_local_init(uint8_t address)
}

MUTEX_INIT(protocol_local_info.mutex_lock);

memset(protocol_local_info.route_table, 0xFF, PROTOCOL_ROUTE_TABLE_MAX_NUM);
memset(protocol_local_info.interface, 0, sizeof(protocol_local_info.interface));
memset(&boardcast_object, 0, sizeof(boardcast_object_t));
memset(&protocol_local_info.send_cmd_info, 0, sizeof(protocol_local_info.send_cmd_info));
memset(&protocol_local_info.rcv_cmd_info, 0, sizeof(protocol_local_info.rcv_cmd_info));

for(int i; i < PROTOCOL_INTERFACE_MAX; i++)
{
/* initalization user data is 0xFF */
memset(&protocol_local_info.interface[i].user_data, 0xFF, sizeof(union interface_user_data));
}

for(int i; i < PROTOCOL_CMD_MAX_NUM; i++)
{
/* initalization cmd is 0xFF */
memset(&protocol_local_info.send_cmd_info[i].cmd, 0xFFFF, 2);
memset(&protocol_local_info.rcv_cmd_info[i].cmd, 0xFFFF, 2);
}

protocol_local_info.address = address;
protocol_local_info.rcv_nor_callBack = protocol_rcv_pack_handle;
Expand Down

0 comments on commit 9cb7d9d

Please sign in to comment.