S&B Volcano vaporizer remote control with Pi Pico W
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

flash.sh 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # ----------------------------------------------------------------------------
  3. # Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # See <http://www.gnu.org/licenses/>.
  16. # ----------------------------------------------------------------------------
  17. set -euo pipefail
  18. SERIAL=/dev/serial/by-id/usb-xythobuz_VolcanoRC_*
  19. DISK=/dev/disk/by-label/RPI-RP2
  20. MOUNT=/mnt/tmp
  21. if [ ! -e $DISK ]
  22. then
  23. echo Resetting Raspberry Pi Pico
  24. echo -n -e "\\x18" > $SERIAL
  25. fi
  26. echo -n Waiting for disk to appear
  27. until [ -e $DISK ]
  28. do
  29. echo -n .
  30. sleep 1
  31. done
  32. echo
  33. echo Mounting bootloader disk
  34. sudo mount $DISK $MOUNT
  35. echo Copying binary
  36. sudo cp $1 $MOUNT
  37. echo Done