MCPcopy
hub / github.com/tinygo-org/tinygo / flashHexUsingMSD

Function flashHexUsingMSD

main.go:1070–1089  ·  view source on GitHub ↗
(volumes []string, tmppath string, options *compileopts.Options)

Source from the content-addressed store, hash-verified

1068}
1069
1070func flashHexUsingMSD(volumes []string, tmppath string, options *compileopts.Options) error {
1071 for start := time.Now(); time.Since(start) < options.Timeout; {
1072 // Find all mount points.
1073 mounts, err := findFATMounts(options)
1074 if err != nil {
1075 return err
1076 }
1077 for _, mount := range mounts {
1078 for _, volume := range volumes {
1079 if mount.name != volume {
1080 continue
1081 }
1082 // Found the filesystem, so flash the device!
1083 return moveFile(tmppath, filepath.Join(mount.path, "flash.hex"))
1084 }
1085 }
1086 time.Sleep(500 * time.Millisecond)
1087 }
1088 return errors.New("unable to locate any volume: [" + strings.Join(volumes, ",") + "]")
1089}
1090
1091const (
1092 defaultReset = "default"

Callers 1

FlashFunction · 0.85

Calls 4

findFATMountsFunction · 0.85
moveFileFunction · 0.85
NowMethod · 0.80
SleepMethod · 0.65

Tested by

no test coverage detected