From c04b885250711e1ea2109388c05a9798104fcbbf Mon Sep 17 00:00:00 2001 From: Otto winter Date: Fri, 29 Oct 2021 10:49:34 +0200 Subject: [PATCH] Bump esptool to 3.2 --- esphomeflasher/common.py | 7 ++++++- esphomeflasher/gui.py | 10 +++++++--- requirements.txt | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/esphomeflasher/common.py b/esphomeflasher/common.py index a1c906c..4addf77 100644 --- a/esphomeflasher/common.py +++ b/esphomeflasher/common.py @@ -23,6 +23,7 @@ def __init__(self, flash_size, addr_filename, flash_mode, flash_freq): self.verify = False self.erase_all = False self.encrypt = False + self.encrypt_files = None class ChipInfo(object): @@ -193,7 +194,11 @@ def detect_chip(port, force_esp8266=False, force_esp32=False): try: chip = esptool.ESPLoader.detect_chip(port) except esptool.FatalError as err: - raise EsphomeflasherError("ESP Chip Auto-Detection failed: {}".format(err)) + if "Wrong boot mode detected" in str(err): + msg = "ESP is not in flash boot mode. If your board has a flashing pin, try again while keeping it pressed." + else: + msg = "ESP Chip Auto-Detection failed: {}".format(err) + raise EsphomeflasherError(msg) from err try: chip.connect() diff --git a/esphomeflasher/gui.py b/esphomeflasher/gui.py index cd9afae..8675927 100644 --- a/esphomeflasher/gui.py +++ b/esphomeflasher/gui.py @@ -1,4 +1,5 @@ # This GUI is a fork of the brilliant https://github.com/marcelstoer/nodemcu-pyflasher +from io import TextIOBase import re import sys import threading @@ -28,7 +29,7 @@ # See discussion at http://stackoverflow.com/q/41101897/131929 -class RedirectText: +class RedirectText(TextIOBase): def __init__(self, text_ctrl): self._out = text_ctrl self._i = 0 @@ -140,8 +141,11 @@ def write(self, string): self._line = '' continue - def flush(self): - pass + def writable(self): + return True + + def isatty(self) -> bool: + return True class FlashingThread(threading.Thread): diff --git a/requirements.txt b/requirements.txt index fa733cf..192abf3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ wxpython>=4.0,<5.0 -esptool==2.8 +esptool==3.2 requests>=2.24.0,<3