Skip to content

Commit c266fdd

Browse files
peterdragunradimkarnis
authored andcommitted
fix: pass error message to exception in OTG mode
Closes espressif#996 Closes espressif#997
1 parent 7cc35e4 commit c266fdd

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

esptool/targets/esp32s2.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,12 @@ def _check_if_can_reset(self):
296296
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
297297
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
298298
):
299-
print(
300-
"WARNING: {} chip was placed into download mode using GPIO0.\n"
301-
"esptool.py can not exit the download mode over USB. "
302-
"To run the app, reset the chip manually.\n"
303-
"To suppress this note, set --after option to 'no_reset'.".format(
304-
self.get_chip_description()
305-
)
299+
raise SystemExit(
300+
f"Error: {self.get_chip_description()} chip was placed into download "
301+
"mode using GPIO0.\nesptool.py can not exit the download mode over "
302+
"USB. To run the app, reset the chip manually.\n"
303+
"To suppress this note, set --after option to 'no_reset'."
306304
)
307-
raise SystemExit(1)
308305

309306
def hard_reset(self):
310307
uses_usb_otg = self.uses_usb_otg()

esptool/targets/esp32s3.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,12 @@ def _check_if_can_reset(self):
358358
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
359359
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
360360
):
361-
print(
362-
"WARNING: {} chip was placed into download mode using GPIO0.\n"
363-
"esptool.py can not exit the download mode over USB. "
364-
"To run the app, reset the chip manually.\n"
365-
"To suppress this note, set --after option to 'no_reset'.".format(
366-
self.get_chip_description()
367-
)
361+
raise SystemExit(
362+
f"Error: {self.get_chip_description()} chip was placed into download "
363+
"mode using GPIO0.\nesptool.py can not exit the download mode over "
364+
"USB. To run the app, reset the chip manually.\n"
365+
"To suppress this note, set --after option to 'no_reset'."
368366
)
369-
raise SystemExit(1)
370367

371368
def hard_reset(self):
372369
uses_usb_otg = self.uses_usb_otg()

0 commit comments

Comments
 (0)