Browse Source

update

master
zhaohe 4 months ago
parent
commit
e17619d620
  1. 4
      protocol/packet.hpp

4
protocol/packet.hpp

@ -40,8 +40,8 @@ typedef enum {
} zcan_cmd_packet_type_t; } zcan_cmd_packet_type_t;
static inline bool zcr_cmd_checkpacket(const zcr_cmd_header_t* header, int len) { static inline bool zcr_cmd_checkpacket(const zcr_cmd_header_t* header, int len) {
if (len < sizeof(zcr_cmd_header_t)) return false;
if ((header->datalen + sizeof(zcr_cmd_header_t) + 1) != len) return false;
if (len < (int)sizeof(zcr_cmd_header_t)) return false;
if ((int)(header->datalen + sizeof(zcr_cmd_header_t) + 1) != len) return false;
uint8_t checksum = 0; uint8_t checksum = 0;
for (int i = 0; i < len - 1; i++) checksum += ((uint8_t*)header)[i]; for (int i = 0; i < len - 1; i++) checksum += ((uint8_t*)header)[i];

Loading…
Cancel
Save