From f23d040236e641f3271a3a7dd5548ff9aef1985b Mon Sep 17 00:00:00 2001
From: Jimmy <git@jimmy.nz>
Date: Wed, 11 Dec 2024 22:41:16 +1300
Subject: [PATCH] Upload files individually

---
 dev.sh | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/dev.sh b/dev.sh
index 753fbd8..dc64772 100755
--- a/dev.sh
+++ b/dev.sh
@@ -1,5 +1,21 @@
 #!/bin/bash
 
-mpremote reset
-mpremote cp -r src :
-mpremote run src/main.py
\ No newline at end of file
+# Reset the MicroPython device
+mpremote reset || { echo "Failed to reset device"; exit 1; }
+
+# Loop through all files in ./src recursively
+find ./src -type f | while read -r file; do
+  filename=$(basename "$file")  # Extract filename from full path
+  
+  # Skip copying settings.json
+  if [ "$filename" == "settings.json" ]; then
+    echo "Skipping $filename"
+    continue
+  fi
+  
+  echo "Copying $filename"
+  mpremote cp "$file" :$filename || { echo "Failed to copy $filename"; exit 1; }
+done
+
+# Run the main.py script on the MicroPython device
+mpremote run src/main.py || { echo "Failed to run main.py"; exit 1; }