Skip to content

Commit

Permalink
fix: Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Aug 25, 2024
1 parent 20c2943 commit 940e1dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/en/esptool/configuration-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Complete list configurable options:
+------------------------------+-----------------------------------------------------------+----------+
| custom_reset_sequence | Custom reset sequence for resetting into the bootloader | |
+------------------------------+-----------------------------------------------------------+----------+
| retry_open_serial | Retry opening the serial port indefinitely | False |
| retry_open_serial | Retry opening the serial port indefinitely | False |
+------------------------------+-----------------------------------------------------------+----------+

Custom Reset Sequence
Expand Down
25 changes: 11 additions & 14 deletions esptool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@
write_mem,
)
from esptool.config import load_config_file
from esptool.loader import DEFAULT_CONNECT_ATTEMPTS, StubFlasher, ESPLoader, list_ports, cfg
from esptool.loader import (
DEFAULT_CONNECT_ATTEMPTS,
StubFlasher,
ESPLoader,
list_ports,
cfg,
)
from esptool.targets import CHIP_DEFS, CHIP_LIST, ESP32ROM
from esptool.util import (
FatalError,
Expand Down Expand Up @@ -190,16 +196,6 @@ def main(argv=None, esp=None):
default=os.environ.get("ESPTOOL_CONNECT_ATTEMPTS", DEFAULT_CONNECT_ATTEMPTS),
)

parser.add_argument(
"--retry-open-serial",
help=(
"Retry opening the serial port indefinitely. "
"Default: %s" % DEFAULT_RETRY_OPEN_SERIAL
),
default=os.environ.get("ESPTOOL_RETRY_OPEN_SERIAL", DEFAULT_RETRY_OPEN_SERIAL),
action="store_true",
)

subparsers = parser.add_subparsers(
dest="operation", help="Run esptool.py {command} -h for additional help"
)
Expand Down Expand Up @@ -782,7 +778,9 @@ def add_spi_flash_subparsers(
port=args.port,
connect_attempts=args.connect_attempts,
initial_baud=initial_baud,
retry_open_serial=args.retry_open_serial,
retry_open_serial=os.environ.get(
"ESPTOOL_RETRY_OPEN_SERIAL", DEFAULT_RETRY_OPEN_SERIAL
),
chip=args.chip,
trace=args.trace,
before=args.before,
Expand Down Expand Up @@ -1142,7 +1140,6 @@ def get_default_specific_connected_device(
print(".", end="", flush=True)
time.sleep(0.1)
retry_attempts += 1
continue


def get_default_connected_device(
Expand Down Expand Up @@ -1171,7 +1168,7 @@ def get_default_connected_device(
trace,
before,
connect_attempts,
retry_open_serial,
retry_open_serial and port is not None,
)
break
except (FatalError, OSError) as err:
Expand Down

0 comments on commit 940e1dc

Please sign in to comment.