@@ -17,6 +17,10 @@ if [ ! -f $CH_HOME/make/cpphash.mk ]; then
17
17
return 1
18
18
fi
19
19
20
+ if [[ "$CH_BUILD" == "" ]]; then
21
+ CH_BUILD="build"
22
+ fi
23
+
20
24
if [[ "$ESPMAKE_PREFIX" == "" ]]; then
21
25
ESPMAKE_PREFIX="esp_"
22
26
fi
@@ -76,12 +80,11 @@ if [[ "$_ESPMAKE_DEV1" == "" ]]; then
76
80
_ESPMAKE_DEV1=/dev/ttyACM1
77
81
fi
78
82
79
-
80
83
# Helper function that returns the path to the build directory
81
84
# of the last project built. Example: $ESPMAKE_PRJ_HOME/build/espinit
82
85
83
86
_ESPMAKE_LAST_BUILD() {
84
- echo "${ESPMAKE_PRJ_HOME}/build /$(basename $(dirname $(cat $ESPMAKE_PRJ_LAST)))_$(basename $(cat $ESPMAKE_PRJ_LAST) .mk)"
87
+ echo "${ESPMAKE_PRJ_HOME}/$(CH_BUILD) /$(basename $(dirname $(cat $ESPMAKE_PRJ_LAST)))_$(basename $(cat $ESPMAKE_PRJ_LAST) .mk)"
85
88
}
86
89
87
90
# Helper function that returns the name of the esphome device as
@@ -100,12 +103,12 @@ alias _ESPMAKE_USB='function _ESPMAKE_USB { _VERB=${1}; _DEV=${2}; cd $(_ESPMAKE
100
103
# Helper alias to upload last project using OTA update to IP _ESPMAKE_IP<arg>
101
104
# Note the indirect variable reference ${!_IP} to choose the _IP
102
105
103
- alias _ESPMAKE_UPLOAD='function _ESPMAKE_UPLOAD { _IPNUM=${1}; _IP=_ESPMAKE_IP${_IPNUM}; esphome -v upload --device ${!_IP} --file $(_ESPMAKE_LAST_BUILD)/.esphome/build /$(_ESPMAKE_LAST_ESPNAME)/.pioenvs/$(_ESPMAKE_LAST_ESPNAME)/firmware.bin $(_ESPMAKE_LAST_BUILD)/espmake.yaml;}; _ESPMAKE_UPLOAD'
106
+ alias _ESPMAKE_UPLOAD='function _ESPMAKE_UPLOAD { _IPNUM=${1}; _IP=_ESPMAKE_IP${_IPNUM}; esphome -v upload --device ${!_IP} --file $(_ESPMAKE_LAST_BUILD)/.esphome/$(CH_BUILD) /$(_ESPMAKE_LAST_ESPNAME)/.pioenvs/$(_ESPMAKE_LAST_ESPNAME)/firmware.bin $(_ESPMAKE_LAST_BUILD)/espmake.yaml;}; _ESPMAKE_UPLOAD'
104
107
105
108
# _ESPMAKE_IDF_JTAG uses esp-idf directly to burn firmware to /dev/ttyACM0
106
109
107
110
export ESPTOOL_TESTING=1 # as per esptool/esp32s2.py
108
- alias _ESPMAKE_IDF_JTAG='(cd $(_ESPMAKE_LAST_BUILD)/.esphome/build /$(_ESPMAKE_LAST_ESPNAME)/.pioenvs/$(_ESPMAKE_LAST_ESPNAME) && esptool.py --before default_reset --after no_reset --baud 1500000 --port $_ESPMAKE_DEV0 --chip esp32s2 write_flash -z --flash_size detect 0x10000 firmware.bin 0x1000 bootloader.bin 0x8000 partitions.bin 0x9000 ota_data_initial.bin)'
111
+ alias _ESPMAKE_IDF_JTAG='(cd $(_ESPMAKE_LAST_BUILD)/.esphome/$(CH_BUILD) /$(_ESPMAKE_LAST_ESPNAME)/.pioenvs/$(_ESPMAKE_LAST_ESPNAME) && esptool.py --before default_reset --after no_reset --baud 1500000 --port $_ESPMAKE_DEV0 --chip esp32s2 write_flash -z --flash_size detect 0x10000 firmware.bin 0x1000 bootloader.bin 0x8000 partitions.bin 0x9000 ota_data_initial.bin)'
109
112
110
113
# Convenience aliases
111
114
@@ -154,7 +157,7 @@ alias ${ESPMAKE_PREFIX}esphome='view $(_ESPMAKE_LAST_BUILD)/esphome.yaml'
154
157
# Aliases to find strings including or excluding the build directory
155
158
156
159
alias ${ESPMAKE_PREFIX}search="find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' -type f -print0 | xargs -0 grep -i"
157
- alias ${ESPMAKE_PREFIX}search_home="find $ESPMAKE_PRJ_HOME ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/build /*' ! -path '*/cpphash/*' -type f -print0 | xargs -0 grep -i"
160
+ alias ${ESPMAKE_PREFIX}search_home="find $ESPMAKE_PRJ_HOME ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/$(CH_BUILD) /*' ! -path '*/cpphash/*' -type f -print0 | xargs -0 grep -i"
158
161
alias ${ESPMAKE_PREFIX}search_all="find $ESPMAKE_PRJ_HOME ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' -type f -print0 | xargs -0 grep -i"
159
162
160
163
# Aliases to search for arg1 and replace it with arg2 in all files.
@@ -163,13 +166,13 @@ alias ${ESPMAKE_PREFIX}search_all="find $ESPMAKE_PRJ_HOME ! -name '*.swp' ! -nam
163
166
# bash does not seem to allow these to be defined with ESPMAKE_PREFIX.
164
167
165
168
esp_replace_nohash() {
166
- find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/build /*' ! -path '*/cpphash/*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s#$1#$2#g"
169
+ find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/$(CH_BUILD) /*' ! -path '*/cpphash/*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s#$1#$2#g"
167
170
}
168
171
esp_replace_nocomma() {
169
- find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/build /*' ! -path '*/cpphash/*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s,$1,$2,g"
172
+ find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/$(CH_BUILD) /*' ! -path '*/cpphash/*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s,$1,$2,g"
170
173
}
171
174
esp_replace_noslash() {
172
- find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/build /*' ! -path '*/cpphash*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s/$1/$2/g"
175
+ find . ! -name '*.swp' ! -name '*.bak' ! -path '*/.git/*' ! -path '*/$(CH_BUILD) /*' ! -path '*/cpphash*' ! -path '*/.esphome/*' -type f -print0 | xargs -0 grep -l "$1" | xargs $SED --in-place=.bak "s/$1/$2/g"
173
176
}
174
177
alias esp_replace="esp_replace_noslash"
175
178
0 commit comments