|
1 | 1 | #!/bin/sh |
| 2 | +project_name="genericInstaller" |
| 3 | + |
2 | 4 | if [ -z "$1" ]; then |
3 | 5 | echo "Usage: sh build.sh <device>" |
4 | 6 | echo "esp32 is the default device" |
5 | 7 | exit 1 |
6 | 8 | fi |
| 9 | + |
7 | 10 | device_name=$(echo $1 | tr '[:lower:]' '[:upper:]') |
8 | | -tft_config_file="tft_config_$1.txt" |
9 | | -if [ -f "$tft_config_file" ]; then |
10 | | - user_tft_config=$(cat $tft_config_file | tr '\n' ' ' | sed -e "s/\ /\ -D/g" -e "s/-D$//") |
11 | | - tft_font="-DLOAD_GLCD=1 -DLOAD_FONT2=1 -DLOAD_FONT4=1 -DLOAD_FONT6=1 -DLOAD_FONT7=1 -DLOAD_FONT8=1 -DLOAD_GFXFF=1 -DSMOOTH_FONT=1" |
12 | | - tft_config=" -DTFT=1 -DUSER_SETUP_LOADED=1 -D${user_tft_config} ${tft_font}" |
| 11 | +config_file="./devices/$1.txt" |
| 12 | + |
| 13 | +if [ ! -f "$config_file" ]; then |
| 14 | + echo "Config file $config_file does not exist." |
| 15 | + exit 1 |
13 | 16 | fi |
14 | 17 |
|
| 18 | +device_config=$(cat $config_file | tr '\n' ' ' | sed -e "s/\ /\ -D/g" -e "s/-D$//") |
| 19 | + |
15 | 20 | # works for tdisplay and esp32 devmodule |
16 | 21 | board="esp32:esp32:ttgo-lora32" |
17 | | -flags="build.extra_flags.esp32=-DARDUINO_USB_CDC_ON_BOOT=0" |
| 22 | +flags="build.extra_flags.esp32=" |
18 | 23 |
|
19 | 24 | # if tdisplay_s3 use esp32s3 board |
20 | 25 | if [ "$1" = "tdisplay_s3" ]; then |
21 | 26 | board="esp32:esp32:lilygo_t_display_s3" |
22 | | - flags="build.extra_flags.esp32s3=-DARDUINO_USB_MODE={build.usb_mode} -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUINO_USB_MSC_ON_BOOT={build.msc_on_boot} -DARDUINO_USB_DFU_ON_BOOT={build.dfu_on_boot}" |
| 27 | + flags="build.extra_flags.esp32s3=" |
| 28 | +fi |
| 29 | + |
| 30 | +if [ "$1" = "guition_s3" ]; then |
| 31 | + board="esp32:esp32:lilygo_t_display_s3" |
| 32 | + flags="build.extra_flags.esp32s3=" |
23 | 33 | fi |
24 | 34 |
|
25 | | -extra_flags="${flags} -D${device_name}=1${tft_config}" |
| 35 | +extra_flags="${flags}-D${device_config}" |
26 | 36 | echo "Extra build flags: ${extra_flags}" |
27 | 37 |
|
28 | 38 | arduino-cli compile \ |
29 | 39 | --build-property "build.partitions=min_spiffs" \ |
30 | 40 | --build-property "upload.maximum_size=1966080" \ |
31 | 41 | --build-property "${extra_flags}" \ |
32 | 42 | --build-path build \ |
33 | | - --fqbn $board genericInstaller |
| 43 | + --fqbn $board $project_name |
0 commit comments