Skip to content

Commit

Permalink
image_info: Print chip ID's name if known
Browse files Browse the repository at this point in the history
Example:

Flash pins drive settings: clk_drv: 0x0, q_drv: 0x0, d_drv: 0x0, cs0_drv: 0x0, hd_drv: 0x0, wp_drv: 0x0
Chip ID: 5 (ESP32-C3)
Minimal chip revision: v0.0, (legacy min_rev = 0)
Maximal chip revision: v655.35

An unknown ID will be printed as:

Chip ID: 42 (Unknown ID)
  • Loading branch information
xyzzy42 committed Apr 20, 2023
1 parent de2fa6b commit df721e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion esptool/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,11 @@ def get_key_from_value(dict, val):
image.wp_drv,
)
)
print("Chip ID: {}".format(image.chip_id))
try:
chip = next(chip for chip in CHIP_DEFS.values() if getattr(chip, "IMAGE_CHIP_ID", None) == image.chip_id)
print(f"Chip ID: {image.chip_id} ({chip.CHIP_NAME})")
except StopIteration:
print(f"Chip ID: {image.chip_id} (Unknown ID)")
print(
"Minimal chip revision: "
f"v{image.min_rev_full // 100}.{image.min_rev_full % 100}, "
Expand Down

0 comments on commit df721e5

Please sign in to comment.