待机功能基本实现

This commit is contained in:
2024-11-06 15:44:35 +08:00
parent 8e2bf7f59b
commit ab0678aa3b
14 changed files with 317 additions and 151 deletions

View File

@@ -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