Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Warning Handling in _check_if_can_reset Method (ESPTOOL-894) #997

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions esptool/targets/esp32s2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import struct
import warnings
from typing import Dict

from .esp32 import ESP32ROM
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 4 additions & 3 deletions esptool/targets/esp32s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import struct
import warnings
from typing import Dict

from .esp32 import ESP32ROM
Expand Down Expand Up @@ -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()
Expand Down