Transfer.

This commit is contained in:
Andrey Egorov 2024-07-22 20:37:02 +03:00
parent aa6f1b45d1
commit 620c98cbf1
3 changed files with 12 additions and 5 deletions

View File

@ -8,4 +8,10 @@ build:
# @$Env:GOOS="linux"; $Env:GOARCH="arm"; $Env:GOARM=5
# .profile
# cgo_enabled 0
# cgo_enabled 0
push:
git status
git add -A
git commit -m "Transfer."
git push origin master

View File

@ -92,6 +92,7 @@ func (p *atPort) makeReq(msg string) (string, error) {
}
// Read
readLen, err := p.port.Read(p.inputBuf)
log.Println("RAWREAD:", string(p.inputBuf[:readLen]))
if err != nil {
return "", fmt.Errorf("port read: %w", err)
}

View File

@ -107,11 +107,11 @@ func (m *modem) checkPort(portName string) error {
// Check serial connection
// Connect
port := at.New(portName, m.baudrate)
if err := port.Connect(); err != nil {
m.port = at.New(portName, m.baudrate)
if err := m.port.Connect(); err != nil {
return fmt.Errorf("connect: %w", err)
}
defer port.Disconnect() // Do not bother about errors...
defer m.port.Disconnect() // Do not bother about errors...
// Ping
log.Println("Ping...")
@ -121,7 +121,7 @@ func (m *modem) checkPort(portName string) error {
}
// Check model
model, err := port.Request(at.CmdGet, "CGMM")
model, err := m.port.Request(at.CmdGet, "CGMM")
if err != nil {
return fmt.Errorf("get model: %w", err)
}