remove the double init code

This commit is contained in:
xiaoheng 2018-12-11 19:54:44 +08:00
parent d2c397aa21
commit cbf96ef8d1
1 changed files with 1 additions and 9 deletions

View File

@ -51,13 +51,6 @@ func uartInit() error {
c := &serial.Config{Name: "/dev/ttyS2", Baud: 1500000, FlowCtrl: serial.HWCONTROL_RTS_CTS}
var err error
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 {
log.Println(log.ErrorLog, err)
return errors.New("port open error!")
@ -65,7 +58,6 @@ func uartInit() error {
flushUart() //flush uart data
go uartReadStart()
}
}
return err
}