mirror of
https://github.com/jpeletier/koolnova2mqtt.git
synced 2026-01-11 15:11:43 +00:00
fixed panic on startup when serial port is busy
This commit is contained in:
@@ -105,9 +105,9 @@ func (mb *modbus) try(slaveID byte, f func() error) (err error) {
|
||||
log.Printf("Retried modbus operation due to %s. %d retries left\n", err, retries)
|
||||
mb.handler.Close()
|
||||
throttle(100)
|
||||
err = mb.handler.Connect()
|
||||
if err != nil {
|
||||
return err
|
||||
connectErr := mb.handler.Connect()
|
||||
if connectErr != nil {
|
||||
return connectErr
|
||||
}
|
||||
retries--
|
||||
throttle(delay)
|
||||
|
||||
Reference in New Issue
Block a user