Skip to content

Commit 983338f

Browse files
committed
feat(espefuse): Use the esptool logger, more concise messages
1 parent e9f03ae commit 983338f

33 files changed

+931
-980
lines changed

espefuse/__init__.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,66 +39,67 @@
3939
chain=True, # allow using multiple commands in a single run
4040
no_args_is_help=True,
4141
context_settings=dict(help_option_names=["-h", "--help"], max_content_width=120),
42-
help=f"espefuse v{esptool.__version__} - ESP32xx eFuse get/set tool",
42+
help=f"espefuse v{esptool.__version__} - "
43+
"Utility for eFuse configuration in Espressif SoCs.",
4344
)
4445
@click.option(
4546
"--chip",
4647
"-c",
4748
type=ChipType(choices=["auto"] + list(SUPPORTED_CHIPS.keys())),
4849
default="auto",
4950
envvar="ESPTOOL_CHIP",
50-
help="Target chip type",
51+
help="Target chip type.",
5152
)
5253
@click.option(
5354
"--baud",
5455
"-b",
5556
type=int,
5657
default=esptool.ESPLoader.ESP_ROM_BAUD,
5758
envvar="ESPTOOL_BAUD",
58-
help="Serial port baud rate used when flashing/reading",
59+
help="Serial port baud rate used when flashing/reading.",
5960
)
6061
@click.option(
6162
"--port",
6263
"-p",
6364
envvar="ESPTOOL_PORT",
64-
help="Serial port device",
65+
help="Serial port device.",
6566
)
6667
@click.option(
6768
"--before",
6869
type=ResetModeType(
6970
choices=["default-reset", "usb-reset", "no-reset", "no-reset-no-sync"]
7071
),
7172
default="default-reset",
72-
help="What to do before connecting to the chip",
73+
help="Which reset to perform before connecting to the chip.",
7374
)
7475
@click.option(
75-
"--debug", "-d", is_flag=True, help="Show debugging information (loglevel=DEBUG)"
76+
"--debug", "-d", is_flag=True, help="Show debugging information (loglevel=DEBUG)."
7677
)
7778
@click.option(
7879
"--virt",
7980
is_flag=True,
80-
help="For host tests, work in virtual mode (no chip connection)",
81+
help="For host tests, work in virtual mode (no chip connection).",
8182
)
8283
@click.option(
8384
"--path-efuse-file",
8485
type=click.Path(),
85-
help="For host tests, saves efuse memory to file",
86+
help="For host tests, save eFuse memory to file.",
8687
)
8788
@click.option(
8889
"--do-not-confirm",
8990
is_flag=True,
90-
help="Do not pause for confirmation before permanently writing efuses. "
91-
"Use with caution.",
91+
help="Do not pause for confirmation before permanently writing eFuses. "
92+
"Use with caution!",
9293
)
9394
@click.option(
9495
"--postpone",
9596
is_flag=True,
96-
help="Postpone burning some efuses from BLOCK0 at the end",
97+
help="Postpone burning some eFuses from BLOCK0 at the end.",
9798
)
9899
@click.option(
99100
"--extend-efuse-table",
100101
type=click.File("r"),
101-
help="CSV file from ESP-IDF (esp_efuse_custom_table.csv)",
102+
help="CSV file from ESP-IDF (esp_efuse_custom_table.csv).",
102103
)
103104
@click.pass_context
104105
def cli(
@@ -114,7 +115,7 @@ def cli(
114115
postpone,
115116
extend_efuse_table,
116117
):
117-
print(f"espefuse v{esptool.__version__}")
118+
log.print(f"espefuse v{esptool.__version__}")
118119

119120
ctx.ensure_object(dict)
120121
esp = ctx.obj.get("esp", None)
@@ -127,7 +128,7 @@ def cli(
127128

128129
if not port and not external_esp and not is_help and not virt:
129130
raise click.BadOptionUsage(
130-
"--port", "Missing required argument. Please specify the --port option"
131+
"--port", "Missing required argument. Please specify the --port option."
131132
)
132133

133134
if not esp:
@@ -137,7 +138,7 @@ def cli(
137138
)
138139
except esptool.FatalError as e:
139140
raise esptool.FatalError(
140-
f"{e}\nPlease make sure you specified the right port with --port"
141+
f"{e}\nPlease make sure you specified the right port with --port."
141142
)
142143

143144
def close_port():
@@ -181,8 +182,8 @@ def close_port():
181182
def process_result(result, *args, **kwargs):
182183
if multiple_burn_commands:
183184
if not commands.burn_all(check_batch_mode=True):
184-
raise esptool.FatalError("BURN was not done")
185-
print("Successful")
185+
raise esptool.FatalError("BURN was not done.")
186+
log.print("Successful.")
186187

187188

188189
@cli.command("execute-scripts", hidden=True)

0 commit comments

Comments
 (0)