Răsfoiți Sursa

2022-03-01 / Wendell

Actions
1. tcflush buffer before send a request

Files
1. Module_Systex.c

Image version: D0.00.XX.XXXX.XX
Wendell 3 ani în urmă
părinte
comite
df80f904be
1 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 3 2
      EVSE/Modularization/Module_Systex.c

+ 3 - 2
EVSE/Modularization/Module_Systex.c

@@ -113,7 +113,8 @@ int SendRequest(int uart, unsigned char* cmd, int length)
 		//printf("%x\n",SendBuffer[i]);
 	//printf("strlen(SendBuffer)=%d\n",strlen(SendBuffer));
 	//printf("SendBuffer[0]=%x,SendBuffer[601]=%x,SendBuffer[602]=%x \n",SendBuffer[i],SendBuffer[601],SendBuffer[602]);
-	//tcflush(uart,TCIOFLUSH);
+	tcflush(uart, TCIOFLUSH);
+	sleep(1);
 	while(1)
 	{
 			Rtn=write(uart, SendBuffer+TotalRtn, len-TotalRtn);
@@ -150,7 +151,7 @@ int SendRequest(int uart, unsigned char* cmd, int length)
 					else
 					{
 						DEBUG_INFO_1("SendRequest: not recv ACKACK(%x, %x)\n", SendBuffer[0],SendBuffer[1]);
-						read(uart, SendBuffer, RequestLength);
+						//read(uart, SendBuffer, RequestLength);
 						return -1;
 					}			
 				}