From 13311da7e95fda9de7552b949704f255cbfff93a Mon Sep 17 00:00:00 2001 From: sago35 Date: Thu, 14 Jul 2022 22:41:03 +0900 Subject: [PATCH] main: change to ignore PortReset failures --- main.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index bb7354f4..dfcefa5f 100644 --- a/main.go +++ b/main.go @@ -350,16 +350,14 @@ func Flash(pkgName, port string, options *compileopts.Options) error { // do we need port reset to put MCU into bootloader mode? if config.Target.PortReset == "true" && flashMethod != "openocd" { port, err := getDefaultPort(port, config.Target.SerialPort) - if err != nil { - return err + if err == nil { + err = touchSerialPortAt1200bps(port) + if err != nil { + return &commandError{"failed to reset port", result.Binary, err} + } + // give the target MCU a chance to restart into bootloader + time.Sleep(3 * time.Second) } - - err = touchSerialPortAt1200bps(port) - if err != nil { - return &commandError{"failed to reset port", result.Binary, err} - } - // give the target MCU a chance to restart into bootloader - time.Sleep(3 * time.Second) } // this flashing method copies the binary data to a Mass Storage Device (msd)