待机功能基本实现
This commit is contained in:
@@ -37,7 +37,9 @@ func New(portName string, reader func(msg string)) (*Device, error) {
|
||||
for {
|
||||
r := bufio.NewReader(port)
|
||||
line, _, _ := r.ReadLine()
|
||||
reader(string(line))
|
||||
if reader != nil {
|
||||
reader(string(line))
|
||||
}
|
||||
}
|
||||
}()
|
||||
return &Device{port: port}, nil
|
||||
|
||||
Reference in New Issue
Block a user