帧间间隔时间10ms->100ms

This commit is contained in:
2025-12-29 11:48:45 +08:00
parent b45b8e1d8d
commit 343292b9b2

View File

@@ -35,9 +35,12 @@ func (spw *serialPortWrapper) Open() (err error) {
var parity string
switch spw.conf.Parity {
case PARITY_NONE: parity = "N"
case PARITY_EVEN: parity = "E"
case PARITY_ODD: parity = "O"
case PARITY_NONE:
parity = "N"
case PARITY_EVEN:
parity = "E"
case PARITY_ODD:
parity = "O"
}
spw.port, err = serial.Open(&serial.Config{
@@ -46,7 +49,7 @@ func (spw *serialPortWrapper) Open() (err error) {
DataBits: int(spw.conf.DataBits),
Parity: parity,
StopBits: int(spw.conf.StopBits),
Timeout: 10 * time.Millisecond,
Timeout: 100 * time.Millisecond,
})
return
@@ -69,6 +72,7 @@ func (spw *serialPortWrapper) Close() (err error) {
// - the serial port's receive buffer is empty: port.Read() blocks for
// up to 10ms and returns serial.ErrTimeout. The serial timeout error is
// masked and Read() returns with no data.
//
// As the higher-level methods use io.ReadFull(), Read() will be called
// as many times as necessary until either enough bytes have been read or an
// error is returned (ErrRequestTimedOut or any other i/o error).