Skip to content

Commit 5c75ddb

Browse files
committed
Handle resetmethod field when esptoolpy is used as the uploader
Resolve #191
1 parent e39c688 commit 5c75ddb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

builder/main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ def _update_max_upload_size(env):
122122
env.BoardConfig().update("upload.maximum_size", ldsizes['app_size'])
123123

124124

125+
def get_esptoolpy_reset_flags(resetmethod):
126+
# no dtr, no_sync
127+
resets = ("no_reset_no_sync", "soft_reset")
128+
if resetmethod == "nodemcu":
129+
# dtr
130+
resets = ("default_reset", "hard_reset")
131+
elif resetmethod == "ck":
132+
# no dtr
133+
resets = ("no_reset", "soft_reset")
134+
135+
return ["--before", resets[0], "--after", resets[1]]
136+
137+
125138
########################################################
126139

127140
env = DefaultEnvironment()
@@ -305,6 +318,10 @@ def _update_max_upload_size(env):
305318
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE',
306319
)
307320

321+
env.Prepend(
322+
UPLOADERFLAGS=get_esptoolpy_reset_flags(env.subst("$UPLOAD_RESETMETHOD"))
323+
)
324+
308325
upload_actions = [
309326
env.VerboseAction(env.AutodetectUploadPort,
310327
"Looking for upload port..."),

0 commit comments

Comments
 (0)