eric6/MicroPython/EspDevices.py

Fri, 12 Feb 2021 16:15:18 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 12 Feb 2021 16:15:18 +0100
changeset 8096
5425a9072300
parent 7923
91e843545d9a
child 8117
aaa5e0eacd4e
permissions
-rw-r--r--

MicroPython
- added a generic dialog for flashing UF2 capable devices (with device detection)

7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing some utility functions and the MicroPythonDevice base
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 class.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
11 import sys
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
12
7353
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
13 from PyQt5.QtCore import pyqtSlot, QProcess
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
14 from PyQt5.QtWidgets import QDialog
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
15
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
16 from E5Gui import E5MessageBox
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
17 from E5Gui.E5ProcessDialog import E5ProcessDialog
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
18 from E5Gui.E5Application import e5App
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7059
diff changeset
19
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from .MicroPythonDevices import MicroPythonDevice
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
21 from .MicroPythonWidget import HAS_QTCHART
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
23 import Preferences
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
24
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 class EspDevice(MicroPythonDevice):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Class implementing the device for ESP32 and ESP8266 based boards.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 def __init__(self, microPythonWidget, parent=None):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 Constructor
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
35 @type MicroPythonWidget
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param parent reference to the parent object
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @type QObject
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 super(EspDevice, self).__init__(microPythonWidget, parent)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 def setButtons(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Public method to enable the supported action buttons.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 super(EspDevice, self).setButtons()
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.microPython.setActionButtons(
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 run=True, repl=True, files=True, chart=HAS_QTCHART)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 def forceInterrupt(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Public method to determine the need for an interrupt when opening the
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 serial connection.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @return flag indicating an interrupt is needed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @rtype bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 return True
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
59 def deviceName(self):
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
60 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
61 Public method to get the name of the device.
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
62
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
63 @return name of the device
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
64 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
65 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
66 return self.tr("ESP8266, ESP32")
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
67
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 def canStartRepl(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 Public method to determine, if a REPL can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 @return tuple containing a flag indicating it is safe to start a REPL
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
7095
8e10acb1cd85 Refactored and improved the MicroPython code to be able to show the file manager and the REPL simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7091
diff changeset
76 return True, ""
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 def canStartPlotter(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 Public method to determine, if a Plotter can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
7095
8e10acb1cd85 Refactored and improved the MicroPython code to be able to show the file manager and the REPL simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7091
diff changeset
86 return True, ""
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 def canRunScript(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 """
7091
84d2a73b448a EspDevices, MicroPythonDevices: fixed a wrong source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7077
diff changeset
90 Public method to determine, if a script can be executed.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 return self.canStartRepl()
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 def runScript(self, script):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 Public method to run the given Python script.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 @param script script to be executed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 @type str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 pythonScript = script.split("\n")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.sendCommands(pythonScript)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 def canStartFileManager(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 Public method to determine, if a File Manager can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 File Manager and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
7095
8e10acb1cd85 Refactored and improved the MicroPython code to be able to show the file manager and the REPL simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7091
diff changeset
116 return True, ""
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
118 def addDeviceMenuEntries(self, menu):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
119 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
120 Public method to add device specific entries to the given menu.
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
121
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
122 @param menu reference to the context menu
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
123 @type QMenu
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
124 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
125 connected = self.microPython.isConnected()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
126
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
127 act = menu.addAction(self.tr("Erase Flash"),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
128 self.__eraseFlash)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
129 act.setEnabled(not connected)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
130 act = menu.addAction(self.tr("Flash MicroPython Firmware"),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
131 self.__flashMicroPython)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
132 act.setEnabled(not connected)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
133 menu.addSeparator()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
134 act = menu.addAction(self.tr("Flash Additional Firmware"),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
135 self.__flashAddons)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
136 act.setEnabled(not connected)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
137 menu.addSeparator()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
138 act = menu.addAction(self.tr("Backup Firmware"),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
139 self.__backupFlash)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
140 act.setEnabled(not connected)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
141 act = menu.addAction(self.tr("Restore Firmware"),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
142 self.__restoreFlash)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
143 act.setEnabled(not connected)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
144 menu.addSeparator()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
145 act = menu.addAction(self.tr("Show Chip ID"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
146 self.__showChipID)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
147 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
148 act = menu.addAction(self.tr("Show Flash ID"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
149 self.__showFlashID)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
150 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
151 act = menu.addAction(self.tr("Show MAC Address"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
152 self.__showMACAddress)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
153 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
154 menu.addSeparator()
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
155 act = menu.addAction(self.tr("Reset Device"), self.__resetDevice)
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
156 menu.addSeparator()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
157 menu.addAction(self.tr("Install 'esptool.py'"), self.__installEspTool)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
158
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
159 def hasFlashMenuEntry(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
160 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
161 Public method to check, if the device has its own flash menu entry.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
162
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
163 @return flag indicating a specific flash menu entry
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
164 @rtype bool
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
165 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
166 return True
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
167
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
168 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
169 def __eraseFlash(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
170 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
171 Private slot to erase the device flash memory.
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
172 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
173 ok = E5MessageBox.yesNo(
7173
f611c3b7313f EspDevices, MicrobitDevices: fixed a few omissions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
174 self.microPython,
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
175 self.tr("Erase Flash"),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
176 self.tr("""Shall the flash of the selected device really be"""
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
177 """ erased?"""))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
178 if ok:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
179 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
180 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
181 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
182 "--port", self.microPython.getCurrentPort(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
183 "erase_flash",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
184 ]
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
185 dlg = E5ProcessDialog(self.tr("'esptool erase_flash' Output"),
7355
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
186 self.tr("Erase Flash"),
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
187 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
188 res = dlg.startProcess(sys.executable, flashArgs)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
189 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
190 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
191
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
192 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
193 def __flashMicroPython(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
194 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
195 Private slot to flash a MicroPython firmware to the device.
7115
fe89c98430b6 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7114
diff changeset
196
fe89c98430b6 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7114
diff changeset
197 @exception ValueError raised to indicate an unsupported chip type
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
198 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
199 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
200 dlg = EspFirmwareSelectionDialog()
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
201 if dlg.exec() == QDialog.Accepted:
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
202 chip, firmware, flashMode, _ = dlg.getData()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
203 if chip == "esp8266":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
204 flashAddress = "0x0000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
205 elif chip == "esp32":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
206 flashAddress = "0x1000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
207 else:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
208 raise ValueError(self.tr("Unsupported chip type '{0}'.")
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
209 .format(chip))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
210 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
211 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
212 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
213 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
214 "--port", self.microPython.getCurrentPort(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
215 "write_flash",
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
216 ]
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
217 if flashMode:
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
218 flashArgs.extend([
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
219 "--flash_mode", flashMode
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
220 ])
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
221 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
222 flashAddress,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
223 firmware,
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
224 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
225 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"),
7355
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
226 self.tr("Flash MicroPython Firmware"),
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
227 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
228 res = dlg.startProcess(sys.executable, flashArgs)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
229 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
230 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
231
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
232 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
233 def __flashAddons(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
234 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
235 Private slot to flash some additional firmware images.
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
236 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
237 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
238 dlg = EspFirmwareSelectionDialog(addon=True)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
239 if dlg.exec() == QDialog.Accepted:
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
240 chip, firmware, flashMode, flashAddress = dlg.getData()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
241 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
242 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
243 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
244 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
245 "--port", self.microPython.getCurrentPort(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
246 "write_flash",
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
247 ]
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
248 if flashMode:
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
249 flashArgs.extend([
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
250 "--flash_mode", flashMode
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
251 ])
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
252 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
253 flashAddress.lower(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
254 firmware,
7595
5db6bfeff23e MicroPython: added code to allow the user to select the flash mod for flashing the MicroPython firmware for ESP32/ESP8266 devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
255 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
256 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"),
7355
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
257 self.tr("Flash Additional Firmware"),
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
258 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
259 res = dlg.startProcess(sys.executable, flashArgs)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
260 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
261 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
262
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
263 @pyqtSlot()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
264 def __backupFlash(self):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
265 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
266 Private slot to backup the currently flashed firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
267 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
268 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
269 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
270 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
271 dlg = EspBackupRestoreFirmwareDialog(backupMode=True)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
272 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
273 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
274 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
275 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
276 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
277 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
278 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
279 "read_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
280 "0x0", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
281 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
282 ]
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
283 dlg = E5ProcessDialog(self.tr("'esptool read_flash' Output"),
7355
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
284 self.tr("Backup Firmware"),
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
285 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
286 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
287 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
288 dlg.exec()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
289
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
290 @pyqtSlot()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
291 def __restoreFlash(self):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
292 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
293 Private slot to restore a previously saved firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
294 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
295 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
296 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
297 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
298 dlg = EspBackupRestoreFirmwareDialog(backupMode=False)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
299 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
300 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
301 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
302 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
303 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
304 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
305 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
306 "write_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
307 "--flash_mode", flashMode,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
308 ]
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
309 if bool(flashSize):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
310 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
311 "--flash_size", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
312 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
313 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
314 "0x0",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
315 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
316 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
317 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"),
7355
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
318 self.tr("Restore Firmware"),
c7146f7e06aa EspDevices: modified to show the process progress for flash reading and writing operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7353
diff changeset
319 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
320 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
321 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
322 dlg.exec()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
323
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
324 @pyqtSlot()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
325 def __showChipID(self):
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
326 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
327 Private slot to show the ID of the ESP chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
328 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
329 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
330 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
331 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
332 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
333 "chip_id"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
334 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
335 dlg = E5ProcessDialog(self.tr("'esptool chip_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
336 self.tr("Show Chip ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
337 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
338 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
339 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
340
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
341 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
342 def __showFlashID(self):
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
343 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
344 Private slot to show the ID of the ESP flash chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
345 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
346 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
347 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
348 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
349 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
350 "flash_id"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
351 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
352 dlg = E5ProcessDialog(self.tr("'esptool flash_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
353 self.tr("Show Flash ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
354 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
355 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
356 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
357
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
358 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
359 def __showMACAddress(self):
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
360 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
361 Private slot to show the MAC address of the ESP chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
362 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
363 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
364 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
365 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
366 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
367 "read_mac"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
368 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
369 dlg = E5ProcessDialog(self.tr("'esptool read_mac' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
370 self.tr("Show MAC Address"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
371 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
372 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
373 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
374
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
375 @pyqtSlot()
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
376 def __resetDevice(self):
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
377 """
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
378 Private slot to reset the connected device.
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
379 """
7353
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
380 if self.microPython.isConnected():
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
381 self.microPython.commandsInterface().execute([
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
382 "import machine",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
383 "machine.reset()",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
384 ])
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
385 else:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
386 # perform a reset via esptool using flash_id command ignoring
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
387 # the output
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
388 args = [
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
389 "-u",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
390 "-m", "esptool",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
391 "--port", self.microPython.getCurrentPort(),
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
392 "flash_id"
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
393 ]
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
394 proc = QProcess()
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
395 proc.start(sys.executable, args)
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
396 procStarted = proc.waitForStarted(10000)
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
397 if procStarted:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
398 proc.waitForFinished(10000)
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
399
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
400 @pyqtSlot()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
401 def __installEspTool(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
402 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
403 Private slot to install the esptool package via pip.
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
404 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
405 pip = e5App().getObject("Pip")
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
406 pip.installPackages(["esptool"], interpreter=sys.executable)
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
407
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
408 def getDocumentationUrl(self):
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
409 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
410 Public method to get the device documentation URL.
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
411
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
412 @return documentation URL of the device
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
413 @rtype str
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
414 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
415 return Preferences.getMicroPython("MicroPythonDocuUrl")
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
416
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
417 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
418 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
419 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
420
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
421 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
422 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
423 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
424 return Preferences.getMicroPython("MicroPythonFirmwareUrl")

eric ide

mercurial