Explorar o código

修复接收数据小于2时的判断,原if改为while。

jianfeng1.wang %!s(int64=2) %!d(string=hai) anos
pai
achega
a68155d263
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      FactoryTool_CShare/IO/SerialCMD.cs

+ 4 - 2
FactoryTool_CShare/IO/SerialCMD.cs

@@ -2869,8 +2869,9 @@ namespace MOKA_Factory_Tools
                         Log.WriteErrorLog("Received Nothing.");
                         return false;
                     }
+
                     int TryCount = 3;
-                    if ( reallyLength <= 2 )
+                    while ( reallyLength <= 2 )
                     {
                         if (TryCount < 0)
                         {
@@ -2882,7 +2883,8 @@ namespace MOKA_Factory_Tools
                         reallyLength += len;
                         TryCount--;
                     }
-                    Log.WriteInfoLog("数据" + SerialInit.ByteToHex(receive2Data.Take(reallyLength).ToArray()));
+                    Log.WriteInfoLog("接收的数据2:" + SerialInit.ByteToHex(receive2Data.Take(reallyLength).ToArray()));
+
                     //CRC校验
                     byte crcHighByte = receive2Data[reallyLength - 2];
                     byte crcLowByte = receive2Data[reallyLength - 1];