diff --git a/esptool/targets/esp32s2.py b/esptool/targets/esp32s2.py index 6af2842f7..6eed426e4 100644 --- a/esptool/targets/esp32s2.py +++ b/esptool/targets/esp32s2.py @@ -5,6 +5,7 @@ import os import struct +import warnings from typing import Dict from .esp32 import ESP32ROM @@ -296,15 +297,15 @@ 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( + warnings.warn( "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() - ) + ), + UserWarning ) - raise SystemExit(1) def hard_reset(self): uses_usb_otg = self.uses_usb_otg() diff --git a/esptool/targets/esp32s3.py b/esptool/targets/esp32s3.py index 06fb129eb..37b6efc3b 100644 --- a/esptool/targets/esp32s3.py +++ b/esptool/targets/esp32s3.py @@ -5,6 +5,7 @@ import os import struct +import warnings from typing import Dict from .esp32 import ESP32ROM @@ -358,15 +359,15 @@ 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( + warnings.warn( "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() - ) + ), + UserWarning ) - raise SystemExit(1) def hard_reset(self): uses_usb_otg = self.uses_usb_otg()