From 133d3960bbee48ff9bd924cc1c9af146748fa8be Mon Sep 17 00:00:00 2001 From: Rolf Lear Date: Sun, 14 Mar 2021 12:14:55 -0400 Subject: [PATCH] Some lint-type fixes, make RTU inputs ints not bytes --- rtu.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rtu.go b/rtu.go index 5d884ee..4e07056 100644 --- a/rtu.go +++ b/rtu.go @@ -55,7 +55,7 @@ type rtu struct { } // NewRTU establishes a connection to a local COM port (windows) or serial device (others) -func NewRTU(device string, baud int, parity byte, stopbits byte, dtr bool) (Modbus, error) { +func NewRTU(device string, baud int, parity int, stopbits int, dtr bool) (Modbus, error) { options := serial.Config{} options.Name = device options.Baud = baud @@ -70,7 +70,7 @@ func NewRTU(device string, baud int, parity byte, stopbits byte, dtr bool) (Modb case 'O': options.Parity = serial.ParityOdd default: - return nil, fmt.Errorf("Illegal parity %c", parity) + return nil, fmt.Errorf("illegal parity %c", parity) } switch stopbits { case 1: @@ -78,7 +78,7 @@ func NewRTU(device string, baud int, parity byte, stopbits byte, dtr bool) (Modb case 2: options.StopBits = serial.Stop2 default: - return nil, fmt.Errorf("Illegal stop bits %v", stopbits) + return nil, fmt.Errorf("illegal stop bits %v", stopbits) } options.ReadTimeout = time.Millisecond @@ -100,10 +100,10 @@ func NewRTU(device string, baud int, parity byte, stopbits byte, dtr bool) (Modb wp.name = device wp.serial = port wp.isopen = true - wp.closed = make(chan bool, 0) + wp.closed = make(chan bool) wp.rxchar = make(chan byte, 300) - wp.rxto = make(chan bool, 0) - wp.rxtoc = make(chan bool, 0) + wp.rxto = make(chan bool) + wp.rxtoc = make(chan bool) wp.txready = make(chan bool, 1) wp.toTX = make(chan adu, 5) wp.toDemux = make(chan adu, 5)