Skip to content

Commit

Permalink
Coms
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 30, 2023
1 parent 8ac449d commit 01cfdf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SmartA4/A4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class A4
/// <exception cref="ArgumentOutOfRangeException"></exception>
public SerialPort CreateSerial(Coms com, Int32 baudrate = 9600)
{
if (com < 0 || com > Coms.COM4) throw new ArgumentOutOfRangeException(nameof(com), $"无效串口COM{com},支持COM1/COM2/COM3/COM4");
if (com < 0 || com > Coms.COM4) throw new ArgumentOutOfRangeException(nameof(com), $"无效串口{com},支持COM1/COM2/COM3/COM4");

return new SerialPort(ComNames[(Int32)com], baudrate);
}
Expand All @@ -77,7 +77,7 @@ public SerialPort CreateSerial(Coms com, Int32 baudrate = 9600)
/// <exception cref="ArgumentOutOfRangeException"></exception>
public Modbus CreateModbus(Coms com, Int32 baudrate = 9600)
{
if (com < 0 || com > Coms.COM4) throw new ArgumentOutOfRangeException(nameof(com), $"无效串口COM{com},支持COM1/COM2/COM3/COM4");
if (com < 0 || com > Coms.COM4) throw new ArgumentOutOfRangeException(nameof(com), $"无效串口{com},支持COM1/COM2/COM3/COM4");

return new ModbusRtu { PortName = ComNames[(Int32)com], Baudrate = baudrate };
}
Expand Down

0 comments on commit 01cfdf0

Please sign in to comment.