Ver código fonte

flush before send frame

Signed-off-by: FuangCao <cavan.cao@foxmail.com>
FuangCao 5 anos atrás
pai
commit
c055540051
3 arquivos alterados com 5 adições e 3 exclusões
  1. 1 1
      Project/version.txt
  2. 3 1
      Source/drv_can.c
  3. 1 1
      Source/sw_build_info.h

+ 1 - 1
Project/version.txt

@@ -1 +1 @@
-PS100XX_V11_11210008
+PS100XX_V11_11210046

+ 3 - 1
Source/drv_can.c

@@ -80,6 +80,8 @@ shark_bool shark_can_send_frame(shark_can_efid_t efid, const void *buff, u8 leng
 	u8 tail = (shark_can_tx_tail + 1) % NELEM(shark_can_tx_queue);
 	shark_can_frame_t *frame;
 
+	shark_can_tx_flush();
+
 	if (tail == shark_can_tx_head || work_normal == 0) {
 		return shark_false;
 	}
@@ -109,7 +111,7 @@ shark_bool shark_can_send(u8 dest, u8 src, u8 type, const u8 *buff, u16 length)
 	efid.total = (length + 7) / 8;
 
 	while (length > 0) {
-		u8 wrlen = length > 8 ? 8 : length;
+		u8 wrlen = length < 8 ? length : 8;
 
 		efid.index = index;
 		efid.length = wrlen - 1;

+ 1 - 1
Source/sw_build_info.h

@@ -1,3 +1,3 @@
 #pragma once
 
-#define CONFIG_VERSION "PS100XX_V11_11210008"
+#define CONFIG_VERSION "PS100XX_V11_11210046"