Fix UART hang after master restart from the dashboard.
ReadFrame now returns on serial timeout instead of looping forever, and serve closes and reopens the port after a master reboot so polling and API commands can resume. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -80,7 +80,7 @@ func (s *serialPort) exchangePayloadLocked(payload []byte, cmdName string, timeo
|
||||
}
|
||||
defer func() { _ = s.port.SetReadTimeout(readTimeout) }()
|
||||
|
||||
respPayload, err := uartframe.ReadFrame(s.port, nil)
|
||||
respPayload, err := uartframe.ReadFrame(s.port, nil, timeout)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read response: %w", err)
|
||||
}
|
||||
@@ -113,7 +113,7 @@ func (s *serialPort) exchangeLocked(cmdID byte, cmdName string) ([]byte, error)
|
||||
return nil, fmt.Errorf("write: %w", err)
|
||||
}
|
||||
|
||||
payload, err := uartframe.ReadFrame(s.port, nil)
|
||||
payload, err := uartframe.ReadFrame(s.port, nil, readTimeout)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read response: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user