mirror of
https://github.com/fasteddy516/SimplySerial.git
synced 2024-11-24 10:04:35 +00:00
added connection message
This commit is contained in:
parent
90a93d3b77
commit
cfa9071fee
@ -11,6 +11,7 @@ namespace SimplySerial
|
|||||||
static SerialPort serialPort;
|
static SerialPort serialPort;
|
||||||
|
|
||||||
// default comspec values and application settings set here will be overridden by values passed through command-line arguments
|
// default comspec values and application settings set here will be overridden by values passed through command-line arguments
|
||||||
|
static readonly string version = "0.1.0";
|
||||||
static bool Quiet = false;
|
static bool Quiet = false;
|
||||||
static bool NoWait = false;
|
static bool NoWait = false;
|
||||||
static string port = string.Empty;
|
static string port = string.Empty;
|
||||||
@ -53,6 +54,20 @@ namespace SimplySerial
|
|||||||
ConsoleKeyInfo keyInfo = new ConsoleKeyInfo();
|
ConsoleKeyInfo keyInfo = new ConsoleKeyInfo();
|
||||||
Console.TreatControlCAsInput = true; // we need to use CTRL-C to activate the REPL in CircuitPython, so it can't be used to exit the application
|
Console.TreatControlCAsInput = true; // we need to use CTRL-C to activate the REPL in CircuitPython, so it can't be used to exit the application
|
||||||
|
|
||||||
|
// if we get this far, clear the screen and send the connection message if not in 'quiet' mode
|
||||||
|
Console.Clear();
|
||||||
|
if (!SimplySerial.Quiet)
|
||||||
|
{
|
||||||
|
Console.WriteLine("SimplySerial v{0} connected at {1} baud, {2} parity, {3} data bits, {4} stop bit{5}. Use CTRL-X to exit.\n",
|
||||||
|
version,
|
||||||
|
baud,
|
||||||
|
(parity == Parity.None) ? "no" : (parity.ToString()).ToLower(),
|
||||||
|
dataBits,
|
||||||
|
(stopBits == StopBits.None) ? "0" : (stopBits == StopBits.One) ? "1" : (stopBits == StopBits.OnePointFive) ? "1.5" : "2",
|
||||||
|
(stopBits == StopBits.One) ? "" : "s"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// this is the core functionality - loop while the serial port is open
|
// this is the core functionality - loop while the serial port is open
|
||||||
while (serialPort.IsOpen)
|
while (serialPort.IsOpen)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user