@@ -26,14 +26,13 @@ import (
26
26
"math"
27
27
"time"
28
28
29
+ "github.com/cesanta/go-serial/serial"
29
30
"github.com/juju/errors"
30
- "github.com/mongoose-os/go-serial/serial"
31
- glog "k8s.io/klog/v2"
32
-
33
31
"github.com/mongoose-os/mos/cli/flash/common"
34
32
"github.com/mongoose-os/mos/cli/flash/esp"
35
33
"github.com/mongoose-os/mos/cli/flash/esp32"
36
34
"github.com/mongoose-os/mos/cli/flash/esp8266"
35
+ glog "k8s.io/klog/v2"
37
36
)
38
37
39
38
const (
@@ -200,7 +199,6 @@ func (rc *ROMClient) sendCommand(cmd romCmd, arg []byte, csum uint8) error {
200
199
binary .Write (cmdBuf , binary .LittleEndian , uint32 (csum )) // Yes, uint8 -> uint32
201
200
cmdBuf .Write (arg )
202
201
_ , err := rc .srw .Write (cmdBuf .Bytes ())
203
- rc .sd .Flush ()
204
202
return err
205
203
}
206
204
@@ -280,7 +278,6 @@ func (rc *ROMClient) trySync() error {
280
278
if err := rc .sendCommand (cmdSync , argBuf .Bytes (), 0 ); err != nil {
281
279
return errors .Trace (err )
282
280
}
283
- rc .sd .Flush ()
284
281
for i := 1 ; i <= 8 ; i ++ {
285
282
var r * romResponse
286
283
for {
@@ -308,7 +305,7 @@ func (rc *ROMClient) trySync() error {
308
305
func (rc * ROMClient ) sync () error {
309
306
var err error
310
307
// Usually there is no response to the first command, and the second is successful.
311
- for i := 0 ; i < 5 ; i ++ {
308
+ for i := 0 ; i < 2 ; i ++ {
312
309
err = rc .trySync ()
313
310
if err == nil {
314
311
return nil
0 commit comments