Skip to content

Commit f3cc402

Browse files
Paolo Calaopolldo
Paolo Calao
authored andcommitted
Wait a while before using serial port (#34)
Add 2 seconds sleep before sending the first serial message to the device
1 parent 0ad8eeb commit f3cc402

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

command/device/provision.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ func (p provision) run() error {
7878
return err
7979
}
8080
defer p.ser.Close()
81-
logrus.Infof("%s\n\n", "Connected to board")
81+
82+
// Wait some time before using the serial port
83+
time.Sleep(2000 * time.Millisecond)
84+
logrus.Infof("%s\n\n", "Connected to the board")
8285

8386
// Send configuration commands to the board
8487
err = p.configBoard()

internal/serial/serial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (s *Serial) Connect(address string) error {
5555
}
5656
s.port = port
5757

58-
s.port.SetReadTimeout(time.Millisecond * 2000)
58+
s.port.SetReadTimeout(time.Millisecond * 2500)
5959
return nil
6060
}
6161

0 commit comments

Comments
 (0)