Cleaned up generation and display of VID/PID for unknown boards

This commit is contained in:
Edward Wright 2021-10-28 00:01:39 -04:00
parent 9aef1260d6
commit faf242b138
2 changed files with 14 additions and 10 deletions

View File

@ -20,12 +20,20 @@ namespace SimplySerial
public string make; public string make;
public string model; public string model;
public Board(string vid="----", string pid="----", string make="VID", string model="PID") public Board(string vid="----", string pid="----", string make="", string model="")
{ {
this.vid = vid; this.vid = vid.ToUpper();
this.pid = pid; this.pid = pid.ToUpper();
if (make != "")
this.make = make; this.make = make;
else
this.make = $"VID:{this.vid}";
if (model != "")
this.model = model; this.model = model;
else
this.model = $"PID:{this.pid}";
} }
} }

View File

@ -236,11 +236,9 @@ namespace SimplySerial
// if we get this far, clear the screen and send the connection message if not in 'quiet' mode // if we get this far, clear the screen and send the connection message if not in 'quiet' mode
Console.Clear(); Console.Clear();
// TODO: Clean up make/model nonsense - build default/generic make/model when board is identified
Output(String.Format("<<< SimplySerial v{0} connected via {1} >>>\n" + Output(String.Format("<<< SimplySerial v{0} connected via {1} >>>\n" +
"Settings : {2} baud, {3} parity, {4} data bits, {5} stop bit{6}, auto-connect {7}.\n" + "Settings : {2} baud, {3} parity, {4} data bits, {5} stop bit{6}, auto-connect {7}.\n" +
"Device : {8}{9} {10}{11}{12}\n{13}" + "Device : {8} {9}{10}\n{11}" +
"---\n\nUse CTRL-X to exit.\n", "---\n\nUse CTRL-X to exit.\n",
version, version,
port.name, port.name,
@ -250,9 +248,7 @@ namespace SimplySerial
(stopBits == StopBits.None) ? "0" : (stopBits == StopBits.One) ? "1" : (stopBits == StopBits.OnePointFive) ? "1.5" : "2", (stopBits == StopBits.One) ? "" : "s", (stopBits == StopBits.None) ? "0" : (stopBits == StopBits.One) ? "1" : (stopBits == StopBits.OnePointFive) ? "1.5" : "2", (stopBits == StopBits.One) ? "" : "s",
(autoConnect == AutoConnect.ONE) ? "on" : (autoConnect == AutoConnect.ANY) ? "any" : "off", (autoConnect == AutoConnect.ONE) ? "on" : (autoConnect == AutoConnect.ANY) ? "any" : "off",
port.board.make, port.board.make,
(port.board.make == "VID") ? ":" + port.vid : "",
port.board.model, port.board.model,
(port.board.model == "PID") ? ":" + port.pid : "",
(port.isCircuitPython) ? " (CircuitPython-capable)" : "", (port.isCircuitPython) ? " (CircuitPython-capable)" : "",
(logging == true) ? ($"Logfile : {logFile} (Mode = " + ((logMode == FileMode.Create) ? "OVERWRITE" : "APPEND") + ")\n" ) : "" (logging == true) ? ($"Logfile : {logFile} (Mode = " + ((logMode == FileMode.Create) ? "OVERWRITE" : "APPEND") + ")\n" ) : ""
), flush: true); ), flush: true);