some changes while testing with arduino

master
Jonas Arnold 3 years ago
parent 7289bdf8bf
commit c4e8f3c123
  1. 9
      UsbHidTestApp/Program.cs

@ -113,7 +113,9 @@ internal class Program
else else
{ {
byte[] msgBytes = Encoding.ASCII.GetBytes(message!); byte[] msgBytes = Encoding.ASCII.GetBytes(message!);
List<byte> listBytes = msgBytes.ToList(); List<byte> listBytes = new List<byte>();
listBytes.Add((byte)' '); // temp fix for first sign wrong
listBytes.AddRange(msgBytes);
listBytes.Add((byte)'\n'); listBytes.Add((byte)'\n');
_device.Write(listBytes.ToArray()); _device.Write(listBytes.ToArray());
} }
@ -176,10 +178,13 @@ internal class Program
string print = Encoding.UTF8.GetString(readData.Data); string print = Encoding.UTF8.GetString(readData.Data);
//print = print.Replace("\r", "").Replace("\n", ""); // Newline Mode: none //print = print.Replace("\r", "").Replace("\n", ""); // Newline Mode: none
//print = print.Replace("\r", ""); // Newline Mode: only print \n //print = print.Replace("\r", ""); // Newline Mode: only print \n
//print = print.Replace("\n", ""); // Newline Mode: only print \r print = print.Replace("\0", ""); // delete null chars
if(String.IsNullOrEmpty(print) == false)
{
Console.Write(print); Console.Write(print);
} }
} }
}
catch (TimeoutException) { } catch (TimeoutException) { }
} }
} }

Loading…
Cancel
Save