From 7b21f8ef45a487a01f05146e8fa8c1b4793d4db5 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 29 Oct 2021 11:13:29 +0200 Subject: [PATCH] Bump esptool from 2.8 to 3.2 (#71) --- 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 @@ class MockEsptoolArgs(object): 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 @@ BACK_COLORS = {**COLORS, None: wx.BLACK} # 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 @@ class RedirectText: 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 7ad27a8..61200b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ wxpython>=4.1.1,<5.0 -esptool==2.8 +esptool==3.2 requests>=2.24.0,<3