cangrow.sh - add webupload

This commit is contained in:
Marcus 2024-06-15 01:17:44 +02:00
parent 57279d5818
commit 4ad16c97ce

View file

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
# #
TTY=/dev/ttyUSB0 TTY="/dev/ttyUSB0"
IP="192.168.30.212"
function help() { function help() {
echo "$0 [build|upload|monitor]" echo "$0 [build|upload|webupload|monitor]"
exit 1 exit 1
} }
@ -12,14 +13,21 @@ test -z $1 && help
case $1 in case $1 in
b|build) b|build)
echo "building firmware binary into $(pwd)/build/"
test -d build || mkdir build test -d build || mkdir build
~/.local/bin/arduino-cli --no-color compile -b esp8266:esp8266:d1_mini_clone "Arduino/CanGrow/CanGrow.ino" --output-dir build/ ~/.local/bin/arduino-cli --no-color compile -b esp8266:esp8266:d1_mini_clone "Arduino/CanGrow/CanGrow.ino" --output-dir build/
;; ;;
u|upload) u|upload)
echo "uploading to $TTY"
~/.local/bin/arduino-cli --no-color compile -v -b esp8266:esp8266:d1_mini_clone -u -p $TTY "Arduino/CanGrow/CanGrow.ino" ~/.local/bin/arduino-cli --no-color compile -v -b esp8266:esp8266:d1_mini_clone -u -p $TTY "Arduino/CanGrow/CanGrow.ino"
;; ;;
w|webupload)
echo "uploading to $IP"
curl -v http://$IP/system/applyUpdate -X POST -H 'Content-Type: multipart/form-data;' -F "image=@$(pwd)/build/CanGrow.ino.bin"
echo
;;
m|mon|monitor) m|mon|monitor)
echo "open monitor $TTY"
~/.local/bin/arduino-cli monitor -c baudrate=115200 -p $TTY ~/.local/bin/arduino-cli monitor -c baudrate=115200 -p $TTY
;; ;;
*) *)