From 35b8b7a4c579bbfae432bc2c789c8564b16aa958 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 22 Mar 2025 14:10:45 +0800 Subject: [PATCH 1/2] update protocol --- protocol.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protocol.hpp b/protocol.hpp index 3ebe7cf..e425dba 100644 --- a/protocol.hpp +++ b/protocol.hpp @@ -1,7 +1,7 @@ #pragma once -#include "protocol\cmdid.hpp" -#include "protocol\errorcode.hpp" -#include "protocol\packet.hpp" -#include "protocol\reg_index.hpp" +#include "protocol/cmdid.hpp" +#include "protocol/errorcode.hpp" +#include "protocol/packet.hpp" +#include "protocol/reg_index.hpp" // -#include "protocol\zmotor_struct.hpp" +#include "protocol/zmotor_struct.hpp" From e17619d6204aa72069968f4763ba5d2238bb645e Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 22 Mar 2025 14:44:59 +0800 Subject: [PATCH 2/2] update --- protocol/packet.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/packet.hpp b/protocol/packet.hpp index 481ba23..bfe4a09 100644 --- a/protocol/packet.hpp +++ b/protocol/packet.hpp @@ -40,8 +40,8 @@ typedef enum { } zcan_cmd_packet_type_t; 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; for (int i = 0; i < len - 1; i++) checksum += ((uint8_t*)header)[i];