Skip to content

Commit c6faf46

Browse files
committed
Revert "use -U method on all platforms"
This reverts commit 6ec3edd.
1 parent 8e340a9 commit c6faf46

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

main.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"github.com/mattn/go-shellwords"
77
"io"
8-
"io/ioutil"
98
"os"
109
"os/exec"
1110
"path/filepath"
@@ -65,26 +64,24 @@ func main_load(args []string) {
6564
}
6665
}
6766

68-
tmpfile, err := ioutil.TempFile(os.TempDir(), "dfu")
69-
dfu_search_command := []string{dfu, dfu_flags, "-U", tmpfile.Name(), "--alt", "4"}
70-
tmpfile.Close()
71-
os.Remove(tmpfile.Name())
72-
73-
fmt.Println(dfu_search_command)
67+
dfu_search_command := []string{dfu, dfu_flags, "-l"}
7468

7569
for counter < 100 && board_found == false {
7670
if counter%10 == 0 {
7771
PrintlnVerbose("Waiting for device...")
7872
}
79-
err, _ := launchCommandAndWaitForOutput(dfu_search_command, "", false)
73+
err, found := launchCommandAndWaitForOutput(dfu_search_command, "sensor_core", false)
74+
if err != nil {
75+
fmt.Println(err)
76+
os.Exit(1)
77+
}
8078
if counter == 40 {
8179
fmt.Println("Flashing is taking longer than expected")
8280
fmt.Println("Try pressing MASTER_RESET button")
8381
}
84-
if err == nil {
82+
if found == true {
8583
board_found = true
8684
PrintlnVerbose("Device found!")
87-
os.Remove(tmpfile.Name())
8885
break
8986
}
9087
time.Sleep(100 * time.Millisecond)
@@ -97,7 +94,7 @@ func main_load(args []string) {
9794
}
9895

9996
dfu_download := []string{dfu, dfu_flags, "-D", bin_file_name, "-v", "--alt", "7", "-R"}
100-
err, _ = launchCommandAndWaitForOutput(dfu_download, "", true)
97+
err, _ := launchCommandAndWaitForOutput(dfu_download, "", true)
10198

10299
if err == nil {
103100
fmt.Println("SUCCESS: Sketch will execute in about 5 seconds.")

0 commit comments

Comments
 (0)