From bdbd33aecfa1f33216dfaef6a169c9b576db0e00 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 10 Aug 2022 14:11:47 +0200 Subject: [PATCH] fix `board` not defined --- pio-tools/post_esp32.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index f06fe0403..eb1da1285 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -171,6 +171,8 @@ def esp32_create_combined_bin(source, target, env): if(fs_offset != -1): fs_bin = join(env.subst("$BUILD_DIR"),"littlefs.bin") if exists(fs_bin): + before_reset = env.BoardConfig().get("upload.before_reset", "default_reset") + after_reset = env.BoardConfig().get("upload.after_reset", "hard_reset") print(f" - {hex(fs_offset)}| {fs_bin}") cmd += [hex(fs_offset), fs_bin] env.Replace( @@ -178,8 +180,8 @@ def esp32_create_combined_bin(source, target, env): "--chip", chip, "--port", '"$UPLOAD_PORT"', "--baud", "$UPLOAD_SPEED", - "--before", board.get("upload.before_reset", "default_reset"), - "--after", board.get("upload.after_reset", "hard_reset"), + "--before", before_reset, + "--after", after_reset, "write_flash", "-z", "--flash_mode", "${__get_board_flash_mode(__env__)}", "--flash_freq", "${__get_board_f_flash(__env__)}",