remove the double init code
This commit is contained in:
parent
d2c397aa21
commit
cbf96ef8d1
|
@ -51,13 +51,6 @@ func uartInit() error {
|
||||||
c := &serial.Config{Name: "/dev/ttyS2", Baud: 1500000, FlowCtrl: serial.HWCONTROL_RTS_CTS}
|
c := &serial.Config{Name: "/dev/ttyS2", Baud: 1500000, FlowCtrl: serial.HWCONTROL_RTS_CTS}
|
||||||
var err error
|
var err error
|
||||||
sPort, err = serial.OpenPort(c)
|
sPort, err = serial.OpenPort(c)
|
||||||
if err != nil {
|
|
||||||
log.Println(log.ErrorLog, err)
|
|
||||||
return errors.New("port open error!")
|
|
||||||
} else {
|
|
||||||
flushUart() //flush uart data
|
|
||||||
sPort.Close()
|
|
||||||
sPort, err = serial.OpenPort(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(log.ErrorLog, err)
|
log.Println(log.ErrorLog, err)
|
||||||
return errors.New("port open error!")
|
return errors.New("port open error!")
|
||||||
|
@ -65,7 +58,6 @@ func uartInit() error {
|
||||||
flushUart() //flush uart data
|
flushUart() //flush uart data
|
||||||
go uartReadStart()
|
go uartReadStart()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue