Skip to content

Commit 654bf12

Browse files
authored
Merge pull request #68 from thepapermen/esp32support
Esp32support
2 parents e56376b + dfac477 commit 654bf12

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*.swp
44
.idea/**
55
_buildid.py
6-
6+
.python-version
77
build/
88
dist/
99

airrohr-flasher.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import json
1313

1414
import requests
15-
from esptool import ESPLoader, erase_flash, write_flash
15+
from esptool import ESPLoader, erase_flash, write_flash, NotSupportedError
1616

1717
import airrohrFlasher
1818
from airrohrFlasher.qtvariant import QtGui, QtCore, QtWidgets
@@ -34,6 +34,17 @@
3434
else:
3535
RESOURCES_PATH = os.path.dirname(os.path.realpath(__file__))
3636

37+
38+
def get_chip_id(esp):
39+
"""
40+
A shim to fix firmware flashing for ESP-32
41+
"""
42+
try:
43+
return esp.chip_id()
44+
except NotSupportedError:
45+
return esp.read_mac()
46+
47+
3748
class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
3849
uploadProgress = QtCore.Signal([str, int])
3950
configProgress = QtCore.Signal([str, int])
@@ -494,7 +505,7 @@ def write_config(self, progress, device, path, baudrate=460800):
494505

495506
progress.emit(self.tr(
496507
'Finished in {time:.2f} seconds. Sensor ID: {sensor_id}').format(
497-
time=t, sensor_id=esp.chip_id()), 100)
508+
time=t, sensor_id=get_chip_id(esp)), 100)
498509

499510
esp.flash_finish(True)
500511

@@ -640,7 +651,7 @@ def flash_board(self, progress, device, binary_uri, baudrate=460800):
640651

641652
progress.emit(self.tr(
642653
'Finished in {time:.2f} seconds. Sensor ID: {sensor_id}').format(
643-
time=t, sensor_id=esp.chip_id()), 100)
654+
time=t, sensor_id=get_chip_id(esp)), 100)
644655

645656
esp.flash_finish(True)
646657

0 commit comments

Comments
 (0)