From e0c578a71fd920dc20b5e879e24a30e56ce28c35 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Thu, 16 Sep 2021 14:42:33 +0200 Subject: [PATCH 1/4] Wait a while before using serial port --- command/device/provision.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command/device/provision.go b/command/device/provision.go index b955d439..0a3e6965 100644 --- a/command/device/provision.go +++ b/command/device/provision.go @@ -78,7 +78,10 @@ func (p provision) run() error { return err } defer p.ser.Close() - logrus.Infof("%s\n\n", "Connected to board") + + // Wait some time before using the serial port + time.Sleep(500 * time.Millisecond) + logrus.Infof("%s\n\n", "Connected to the board") // Send configuration commands to the board err = p.configBoard() From da094660c7eed26dd37e9789ae0208bc32eb9f76 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Fri, 5 Nov 2021 14:59:58 +0100 Subject: [PATCH 2/4] Increase wait time --- command/device/provision.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/device/provision.go b/command/device/provision.go index 0a3e6965..2c42e60e 100644 --- a/command/device/provision.go +++ b/command/device/provision.go @@ -80,7 +80,7 @@ func (p provision) run() error { defer p.ser.Close() // Wait some time before using the serial port - time.Sleep(500 * time.Millisecond) + time.Sleep(1500 * time.Millisecond) logrus.Infof("%s\n\n", "Connected to the board") // Send configuration commands to the board From eae689281cd9286703f957663123e05241dba30f Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Fri, 5 Nov 2021 15:03:33 +0100 Subject: [PATCH 3/4] Increase read timeout --- internal/serial/serial.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/serial/serial.go b/internal/serial/serial.go index 235ed1f7..dc627ecd 100644 --- a/internal/serial/serial.go +++ b/internal/serial/serial.go @@ -55,7 +55,7 @@ func (s *Serial) Connect(address string) error { } s.port = port - s.port.SetReadTimeout(time.Millisecond * 2000) + s.port.SetReadTimeout(time.Millisecond * 4000) return nil } From 5825110226a47d2991df9e0d700fa87cc2fef279 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Mon, 15 Nov 2021 17:19:17 +0100 Subject: [PATCH 4/4] Adjust times --- command/device/provision.go | 2 +- internal/serial/serial.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/command/device/provision.go b/command/device/provision.go index 2c42e60e..9baa8cbb 100644 --- a/command/device/provision.go +++ b/command/device/provision.go @@ -80,7 +80,7 @@ func (p provision) run() error { defer p.ser.Close() // Wait some time before using the serial port - time.Sleep(1500 * time.Millisecond) + time.Sleep(2000 * time.Millisecond) logrus.Infof("%s\n\n", "Connected to the board") // Send configuration commands to the board diff --git a/internal/serial/serial.go b/internal/serial/serial.go index dc627ecd..d6c9e7d3 100644 --- a/internal/serial/serial.go +++ b/internal/serial/serial.go @@ -55,7 +55,7 @@ func (s *Serial) Connect(address string) error { } s.port = port - s.port.SetReadTimeout(time.Millisecond * 4000) + s.port.SetReadTimeout(time.Millisecond * 2500) return nil }