fix uart init bug
This commit is contained in:
parent
c5b154eb7d
commit
117d9ec29b
|
@ -1,5 +1,5 @@
|
|||
hash: 68ce7d30bd26f2275d9a8cc38363bb7c5b81d6a4b3405aed1711f1d4fb602414
|
||||
updated: 2018-07-03T10:07:34.800484175+08:00
|
||||
updated: 2018-09-26T17:14:10.602779665+08:00
|
||||
imports:
|
||||
- name: github.com/bitly/go-simplejson
|
||||
version: aabad6e819789e569bd6aabf444c935aa9ba1e44
|
||||
|
@ -75,6 +75,8 @@ imports:
|
|||
version: cdffdb33acae0e14efff2628f9bae377b597840e
|
||||
- name: github.com/xxtea/xxtea-go
|
||||
version: 35c4b17eecf6c3c2350f8cecaf1b3f9f7fafc242
|
||||
subpackages:
|
||||
- xxtea
|
||||
- name: golang.org/x/crypto
|
||||
version: 0fcca4842a8d74bfddc2c96a073bd2a4d2a7a2e8
|
||||
subpackages:
|
||||
|
|
|
@ -251,6 +251,7 @@ func removeAllNode(status AT_CMD_RSP) {
|
|||
func respTimeoutcallback() {
|
||||
log.Println(log.WarningLog, "respTimeoutcallback")
|
||||
removeNode(AT_CMD_RSP_WAIT_TIMEOUT, nil)
|
||||
resetRevData()
|
||||
}
|
||||
|
||||
func atDataRev(rev []byte) {
|
||||
|
@ -308,7 +309,7 @@ func atDataRev(rev []byte) {
|
|||
atCmdRxDataInfo.checkSumCalc += uint16(waitDataSizeChar)
|
||||
atCmdRxDataInfo.dataLen += (uint16(waitDataSizeChar) << 8)
|
||||
atCmdRxDataInfo.rxState = AT_PKG_RX_GET_DATA
|
||||
//log.Println(atCmdDataInfo.dataLen)
|
||||
//log.Println(log.WarningLog, atCmdRxDataInfo.dataLen)
|
||||
case AT_PKG_RX_GET_DATA:
|
||||
remainBytes := (int(atCmdRxDataInfo.dataLen) - atCmdRxDataInfo.atDataBuffer.Len())
|
||||
atCmdRxDataInfo.atDataBuffer.Write(revDataBuffer.Next(remainBytes))
|
||||
|
|
|
@ -56,7 +56,15 @@ func uartInit() error {
|
|||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
go uartReadStart()
|
||||
sPort.Close()
|
||||
sPort, err = serial.OpenPort(c)
|
||||
if err != nil {
|
||||
log.Println(log.ErrorLog, err)
|
||||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
go uartReadStart()
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
@ -150,5 +158,7 @@ func flushUart() error {
|
|||
log.Println(log.ErrorLog, err)
|
||||
}
|
||||
|
||||
log.Println(log.WarningLog, "flash the uart.................")
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
devpath = "/dev/input/event2"
|
||||
devpath = "/dev/input/event1"
|
||||
)
|
||||
|
||||
var curVol uint8 = 0
|
||||
|
|
Loading…
Reference in New Issue