Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 2209f32

Browse files
committed
stop any sketch loaded via usb before replacing it
1 parent 1e83e64 commit 2209f32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ func addWatcherForManuallyAddedSketches(folderOrigin, folderDest string, status
230230
//name := filepath.Base(strings.TrimSuffix(event.Name, filepath.Ext(event.Name)))
231231
//filename := filepath.Join(folderDest, name)
232232
filename := filepath.Join(folderDest, "sketchLoadedThroughUSB")
233+
234+
// stop already running sketch if it exists
235+
if sketch, ok := status.Sketches["sketchLoadedThroughUSB"]; ok {
236+
err = applyAction(sketch, "STOP", status)
237+
}
238+
233239
err := os.Rename(event.Name, filename)
234240
if err != nil {
235241
// copy the file and remote the original

0 commit comments

Comments
 (0)