Skip to content

Commit

Permalink
fix: pass error message to exception in OTG mode
Browse files Browse the repository at this point in the history
Closes #996
Closes #997
  • Loading branch information
peterdragun authored and radimkarnis committed Aug 23, 2024
1 parent 7cc35e4 commit c266fdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
13 changes: 5 additions & 8 deletions esptool/targets/esp32s2.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,12 @@ def _check_if_can_reset(self):
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
):
print(
"WARNING: {} chip was placed into download mode using GPIO0.\n"
"esptool.py can not exit the download mode over USB. "
"To run the app, reset the chip manually.\n"
"To suppress this note, set --after option to 'no_reset'.".format(
self.get_chip_description()
)
raise SystemExit(
f"Error: {self.get_chip_description()} chip was placed into download "
"mode using GPIO0.\nesptool.py can not exit the download mode over "
"USB. To run the app, reset the chip manually.\n"
"To suppress this note, set --after option to 'no_reset'."
)
raise SystemExit(1)

def hard_reset(self):
uses_usb_otg = self.uses_usb_otg()
Expand Down
13 changes: 5 additions & 8 deletions esptool/targets/esp32s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,12 @@ def _check_if_can_reset(self):
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
):
print(
"WARNING: {} chip was placed into download mode using GPIO0.\n"
"esptool.py can not exit the download mode over USB. "
"To run the app, reset the chip manually.\n"
"To suppress this note, set --after option to 'no_reset'.".format(
self.get_chip_description()
)
raise SystemExit(
f"Error: {self.get_chip_description()} chip was placed into download "
"mode using GPIO0.\nesptool.py can not exit the download mode over "
"USB. To run the app, reset the chip manually.\n"
"To suppress this note, set --after option to 'no_reset'."
)
raise SystemExit(1)

def hard_reset(self):
uses_usb_otg = self.uses_usb_otg()
Expand Down

0 comments on commit c266fdd

Please sign in to comment.