fix comm code

master
phkim 3 years ago
parent d6b046c8cb
commit 08000ea7ef
  1. 9
      RS232Test/Form1.cs
  2. 4372
      RS232Test/Form1.resx
  3. BIN
      Resources/Graphicloads-100-Flat-2-Switch.ico

@ -120,18 +120,19 @@ namespace RS232Test
return; return;
inStream = String.Concat(inStream, data); inStream = String.Concat(inStream, data);
string message = EqTocReceive(inStream); string message = EqTocReceive(inStream, "\r\n");
Console.WriteLine();
EqTocPrint(message); EqTocPrint(message);
} }
private string EqTocReceive(string stream) private string EqTocReceive(string stream, string seperator)
{ {
int etxIndex = inStream.IndexOf("\r\n"); int etxIndex = inStream.IndexOf(seperator);
if (etxIndex < 0) if (etxIndex < 0)
return null; return null;
string message = inStream.Substring(0, etxIndex); string message = inStream.Substring(0, etxIndex);
inStream = inStream.Substring(etxIndex + 2, inStream.Length - etxIndex - 2); inStream = inStream.Remove(0, etxIndex + seperator.Length);
return message; return message;
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Loading…
Cancel
Save