-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Sometimes bytes from fmt.Printf () disappear.
temperature: 70.699997
temperature: 70.699997
temperature: 70.699997
tmperature: 70.699997
temperature: 70.699997
temperature: 70.699997
temperature: 70.587494
temperature: 70.587494
temperature: 70.925003
temperature: 70.925003
tmperature: 70.925003
temperature: 72.274994
temperature: 72.274994
temperature: 73.625000
The reason is that there is no retry after a timeout.
However, increasing the number of busy loops will have an impact on performance.
// src/machine/machine_atsamd51.go
func (usbcdc USBCDC) WriteByte(c byte) error {
if usbLineInfo.lineState > 0 {
// set the data
// ...
// wait for transfer to complete
timeout := 3000
for (getEPINTFLAG(usb_CDC_ENDPOINT_IN) & sam.USB_DEVICE_ENDPOINT_EPINTFLAG_TRCPT1) == 0 {
timeout--
if timeout == 0 {
return errors.New("USBCDC write byte timeout")
}
}
}
return nil
}
// src/machine/usb.go
func (usbcdc USBCDC) Write(data []byte) (n int, err error) {
for _, v := range data {
usbcdc.WriteByte(v)
// !!! If err! = nil, go to the next byte !!!
}
return len(data), nil
}torntrousers
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working