|
2 | 2 | set -e |
3 | 3 |
|
4 | 4 | # Create directory "modem_sim_esp32", go inside it |
5 | | -# Usage: ./install.sh [platform] [module] |
| 5 | +# Usage: ./install.sh [platform] [module] [uart_tx_pin] [uart_rx_pin] |
6 | 6 |
|
7 | 7 | SCRIPT_DIR=$(pwd) |
| 8 | +UPDATE_UART_PINS_SCRIPT="$(cd "$(dirname "$0")" && pwd)/update_uart_pins.py" |
8 | 9 | mkdir -p modem_sim_esp32 |
9 | 10 | cd modem_sim_esp32 |
10 | 11 |
|
@@ -39,6 +40,8 @@ mkdir -p build |
39 | 40 | # Default values for platform and module |
40 | 41 | platform="PLATFORM_ESP32" |
41 | 42 | module="WROOM-32" |
| 43 | +uart_tx_pin="" |
| 44 | +uart_rx_pin="" |
42 | 45 |
|
43 | 46 | # Override defaults if parameters are provided |
44 | 47 | if [ ! -z "$1" ]; then |
|
47 | 50 | if [ ! -z "$2" ]; then |
48 | 51 | module="$2" |
49 | 52 | fi |
| 53 | +if [ ! -z "$3" ]; then |
| 54 | + uart_tx_pin="$3" |
| 55 | +fi |
| 56 | +if [ ! -z "$4" ]; then |
| 57 | + uart_rx_pin="$4" |
| 58 | +fi |
| 59 | + |
| 60 | +# Use provided pins for description when present; otherwise keep defaults |
| 61 | +description="4MB, Wi-Fi + BLE, OTA, TX:17 RX:16" |
| 62 | +if [ -n "$uart_tx_pin" ] || [ -n "$uart_rx_pin" ]; then |
| 63 | + desc_tx=${uart_tx_pin:-17} |
| 64 | + desc_rx=${uart_rx_pin:-16} |
| 65 | + description="4MB, Wi-Fi + BLE, OTA, TX:${desc_tx} RX:${desc_rx}" |
| 66 | +fi |
50 | 67 |
|
51 | 68 | # Create file "build/module_info.json" with content |
52 | 69 | cat > build/module_info.json << EOF |
53 | 70 | { |
54 | 71 | "platform": "$platform", |
55 | 72 | "module": "$module", |
56 | | - "description": "4MB, Wi-Fi + BLE, OTA, TX:17 RX:16", |
| 73 | + "description": "$description", |
57 | 74 | "silence": 0 |
58 | 75 | } |
59 | 76 | EOF |
60 | 77 |
|
| 78 | +# Optionally update UART pins in factory_param_data.csv for the selected module |
| 79 | +if [ -n "$uart_tx_pin" ] || [ -n "$uart_rx_pin" ]; then |
| 80 | + csv_path="components/customized_partitions/raw_data/factory_param/factory_param_data.csv" |
| 81 | + if [ ! -f "$csv_path" ]; then |
| 82 | + echo "Warning: $csv_path not found; skipping UART pin update." |
| 83 | + else |
| 84 | + python3 "$UPDATE_UART_PINS_SCRIPT" "$platform" "$module" "$uart_tx_pin" "$uart_rx_pin" "$csv_path" |
| 85 | + echo "Updated UART pins in $csv_path" |
| 86 | + fi |
| 87 | +fi |
| 88 | + |
61 | 89 | cp "$SCRIPT_DIR/sdkconfig.defaults" "module_config/module_esp32_default/sdkconfig.defaults" |
62 | 90 |
|
63 | 91 | echo "Installation completed successfully!" |
|
0 commit comments