40 lines
883 B
Bash
40 lines
883 B
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
# Show ESP32 board / variant selector menu
|
||
|
|
|
||
|
|
# Array of configurations
|
||
|
|
configs=(
|
||
|
|
"ESP32_GENERIC"
|
||
|
|
"ESP32_GENERIC SPIRAM"
|
||
|
|
"ESP32_GENERIC_S3"
|
||
|
|
"ESP32_GENERIC_S3 SPIRAM_OCT"
|
||
|
|
"M5STACK_CORE2"
|
||
|
|
)
|
||
|
|
|
||
|
|
# Function to display menu and get user choice
|
||
|
|
show_menu() {
|
||
|
|
echo "Select a configuration:"
|
||
|
|
for i in "${!configs[@]}"; do
|
||
|
|
echo "$((i+1)). ${configs[$i]}"
|
||
|
|
done
|
||
|
|
read -p "Enter your choice (1-${#configs[@]}): " choice
|
||
|
|
return $choice
|
||
|
|
}
|
||
|
|
|
||
|
|
# Display menu and get user choice
|
||
|
|
show_menu
|
||
|
|
choice=$?
|
||
|
|
|
||
|
|
# Validate user input
|
||
|
|
if [[ $choice -lt 1 || $choice -gt ${#configs[@]} ]]; then
|
||
|
|
echo "Invalid choice. Exiting."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Set BOARD and VARIANT based on user choice
|
||
|
|
selected_config=(${configs[$((choice-1))]})
|
||
|
|
BOARD=${selected_config[0]}
|
||
|
|
VARIANT=${selected_config[1]:-""}
|
||
|
|
|
||
|
|
echo "Selected configuration: BOARD=$BOARD, VARIANT=$VARIANT"
|