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:
@@ -416,7 +416,7 @@ func readUartMessageUntil(sp *serialPort, deadline time.Time, want pb.MessageTyp
|
||||
if err := sp.port.SetReadTimeout(wait); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil)
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil, wait)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -536,7 +536,7 @@ func waitOtaStatus(sp *serialPort, want uint32, timeout time.Duration, onPrepari
|
||||
if err := sp.port.SetReadTimeout(readWait); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil)
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil, readWait)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -562,7 +562,7 @@ func waitOtaStatus(sp *serialPort, want uint32, timeout time.Duration, onPrepari
|
||||
}
|
||||
|
||||
func readOtaStatus(sp *serialPort) (*pb.OtaStatusPayload, error) {
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil)
|
||||
payload, err := uartframe.ReadFrame(sp.port, nil, readTimeout)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read response: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user