5858 cmds :
5959 - npm run build:dev --workspace @scratch/scratch-gui
6060
61+
6162 board:app:upload :
6263 desc : " Upload zip file to Arduino board, unzip and deploy to /home/arduino/ArduinoApps"
6364 cmds :
@@ -87,31 +88,38 @@ tasks:
8788 - echo "Creating zip with version {{.APP_VERSION}}"
8889 - cd build && zip -r scratch-arduino-app-{{.APP_VERSION}}.zip scratch-arduino-app && cd ..
8990
91+ watch :
92+ desc : " wath cfile changes for both python and sketch, and upload the changes to the board and restart"
93+ deps :
94+ - python:watch
95+ - sketch:watch
96+
97+
9098 python:watch :
9199 desc : " Watch Python folder for changes and auto-upload/restart"
100+ silent : true
92101 cmds :
93- - echo "Press Ctrl+C to stop watching"
94102 - |
95103 while true; do
96- echo "Waiting for changes in python/ folder..."
104+ echo "🐍 Waiting for changes in python folder..."
97105 inotifywait -r -e modify,create,delete,move python/ 2>/dev/null || {
98106 echo "inotifywait failed, retrying..."
99107 sleep 2
100108 continue
101109 }
102110
103- sleep 1 #W aiting 1 second for file writes to complete..."
104-
111+ sleep 1 # Waiting 1 second for file writes to complete..."
112+ echo "🐍 Change detected: uploading and restarting service..."
105113 task python:upload-and-restart || {
106114 echo "Upload/restart failed, continuing to watch..."
107115 continue
108116 }
109117
110- echo "[ok] Upload and restart completed!"
111118 done
112119
113120 python:upload-and-restart :
114121 desc : " Upload Python files and restart container"
122+ silent : true
115123 cmds :
116124 - |
117125 adb push ./python/ /home/arduino/ArduinoApps/scratch-arduino-app/
@@ -127,41 +135,45 @@ tasks:
127135
128136 sketch:watch :
129137 desc : " Watch sketch folder for changes and auto-compile/upload"
138+ silent : true
130139 cmds :
131140 - |
132- echo "Press Ctrl+C to stop watching"
133141 while true; do
134- echo "Waiting for changes in sketch folder..."
142+ echo "♾️ Waiting for changes in sketch folder..."
135143 inotifywait -r -e modify,create,delete sketch/ --include '\.(ino|cpp|h|c)$' 2>/dev/null || {
136144 echo "inotifywait failed, retrying..."
137145 sleep 2
138146 continue
139147 }
140148
141149 sleep 1 # Waiting 1 second for file writes to complete
142-
150+ echo "♾️ Change detected: compiling and uploading..."
143151 task sketch:compile-and-upload|| {
144152 echo "Compile/upload failed, continuing to watch..."
145153 continue
146154 }
155+ echo
147156 done
148157
149158 sketch:compile-and-upload :
150159 desc : " Compile and upload Arduino sketch"
160+ silent : true
151161 cmds :
152162 - arduino-cli compile --build-path .cache -b arduino:zephyr:unoq sketch/
153163 - arduino-cli upload -p /dev/ttyACM0 -b arduino:zephyr:unoq:flash_mode=ram --input-dir .cache sketch/
154164
155165 sketch:monitor :
156166 desc : " Open serial monitor for Arduino debugging"
167+ silent : true
157168 cmds :
158- - echo "Opening serial monitor (Press Ctrl+C to exit)..."
169+ - echo " ♾️ Opening serial monitor (Press Ctrl+C to exit)..."
159170 - arduino-cli monitor -p /dev/ttyACM0
160171
161172 python:monitor :
162173 desc : " Watch sketch folder for changes and auto-compile/upload"
163174 cmds :
164175 - |
176+ echo "🐍 Python container logs"
165177 while true; do
166178 CONTAINER_ID=$(adb shell "docker ps -q --filter 'ancestor=ghcr.io/arduino/app-bricks/python-apps-base:0.5.0'")
167179 if [ -n "$CONTAINER_ID" ]; then
0 commit comments