-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
60 lines (52 loc) · 2.19 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
connect_string=""
# Display help message
function display_help {
echo "Usage: $0 [-p PORT]"
echo "Options:"
echo " -p PORT Specify the device port"
echo " -h Display this help message"
}
# Parse command-line options
while getopts ":p:h" opt; do
case $opt in
p)
# If -p is provided, set the port string
connect_string="connect $OPTARG"
;;
h)
display_help
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if command -v python3 &>/dev/null; then
python_command="python3"
else
# If python3 is not available, use python
python_command="python"
fi
# Uncomment the following line on windows machines
# python_command="python"
$python_command -m mpremote $connect_string fs mkdir lib
$python_command -m mpremote $connect_string fs mkdir lib/arduino_alvik
$python_command -m mpremote $connect_string fs cp arduino_alvik/__init__.py :lib/arduino_alvik/__init__.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/arduino_alvik.py :lib/arduino_alvik/arduino_alvik.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/constants.py :lib/arduino_alvik/constants.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/conversions.py :lib/arduino_alvik/conversions.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/pinout_definitions.py :lib/arduino_alvik/pinout_definitions.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/robot_definitions.py :lib/arduino_alvik/robot_definitions.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/stm32_flash.py :lib/arduino_alvik/stm32_flash.py
$python_command -m mpremote $connect_string fs cp arduino_alvik/uart.py :lib/arduino_alvik/uart.py
echo "Installing dependencies"
$python_command -m mpremote $connect_string mip install github:arduino/ucPack-mpy
$python_command -m mpremote $connect_string mip install github:arduino/arduino-runtime-mpy
$python_command -m mpremote $connect_string reset