eric6/MicroPython/EspDevices.py

Sat, 20 Feb 2021 14:23:22 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 20 Feb 2021 14:23:22 +0100
changeset 8119
1653972f2de5
parent 8117
aaa5e0eacd4e
child 8143
2c730d5fd177
permissions
-rw-r--r--

EspDevices: fixed a typo and a little issue.

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 """
8119
1653972f2de5 EspDevices: fixed a typo and a little issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
7 Module implementing the device interface class for ESP32 and ESP8266 based
1653972f2de5 EspDevices: fixed a typo and a little issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
8 boards.
7059
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 """
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
30 def __init__(self, microPythonWidget, deviceType, parent=None):
7059
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
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
36 @param deviceType device type assigned to this device interface
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
37 @type str
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param parent reference to the parent object
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @type QObject
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
41 super(EspDevice, self).__init__(microPythonWidget, deviceType, parent)
7059
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 def setButtons(self):
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 Public method to enable the supported action buttons.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 super(EspDevice, self).setButtons()
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.microPython.setActionButtons(
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 run=True, repl=True, files=True, chart=HAS_QTCHART)
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 def forceInterrupt(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 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
54 serial connection.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 @return flag indicating an interrupt is needed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @rtype bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 return True
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
61 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
62 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
63 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
64
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
65 @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
66 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
67 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7115
diff changeset
68 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
69
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 def canStartRepl(self):
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 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
73
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 @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
75 and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 """
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
78 return True, ""
7059
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 def canStartPlotter(self):
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 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
83
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @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
85 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 """
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
88 return True, ""
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 def canRunScript(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 """
7091
84d2a73b448a EspDevices, MicroPythonDevices: fixed a wrong source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7077
diff changeset
92 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
93
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 @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
95 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 """
8119
1653972f2de5 EspDevices: fixed a typo and a little issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
98 return True, ""
7059
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 def runScript(self, 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 Public method to run the given Python script.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @param script script to be executed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 @type str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 pythonScript = script.split("\n")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.sendCommands(pythonScript)
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 def canStartFileManager(self):
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 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
113
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 @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
115 File Manager and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 """
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
118 return True, ""
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
120 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
121 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
122 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
123
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
124 @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
125 @type QMenu
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 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
128
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
129 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
130 self.__eraseFlash)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
131 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
132 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
133 self.__flashMicroPython)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
134 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
135 menu.addSeparator()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
136 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
137 self.__flashAddons)
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
138 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
139 menu.addSeparator()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
140 act = menu.addAction(self.tr("Backup Firmware"),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
141 self.__backupFlash)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
142 act.setEnabled(not connected)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
143 act = menu.addAction(self.tr("Restore Firmware"),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
144 self.__restoreFlash)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
145 act.setEnabled(not connected)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
146 menu.addSeparator()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
147 act = menu.addAction(self.tr("Show Chip ID"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
148 self.__showChipID)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
149 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
150 act = menu.addAction(self.tr("Show Flash ID"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
151 self.__showFlashID)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
152 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
153 act = menu.addAction(self.tr("Show MAC Address"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
154 self.__showMACAddress)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
155 act.setEnabled(not connected)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
156 menu.addSeparator()
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
157 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
158 menu.addSeparator()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
159 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
160
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
161 def hasFlashMenuEntry(self):
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 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
164
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
165 @return flag indicating a specific flash menu entry
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
166 @rtype bool
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
167 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
168 return True
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
169
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
170 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
171 def __eraseFlash(self):
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 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
174 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
175 ok = E5MessageBox.yesNo(
7173
f611c3b7313f EspDevices, MicrobitDevices: fixed a few omissions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
176 self.microPython,
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
177 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
178 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
179 """ erased?"""))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
180 if ok:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
181 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
182 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
183 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
184 "--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
185 "erase_flash",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
186 ]
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
187 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
188 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
189 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
190 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
191 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
192 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
193
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
194 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
195 def __flashMicroPython(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
196 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
197 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
198
fe89c98430b6 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7114
diff changeset
199 @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
200 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
201 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
202 dlg = EspFirmwareSelectionDialog()
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
203 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
204 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
205 if chip == "esp8266":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
206 flashAddress = "0x0000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
207 elif chip == "esp32":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
208 flashAddress = "0x1000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
209 else:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
210 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
211 .format(chip))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
212 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
213 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
214 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
215 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
216 "--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
217 "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
218 ]
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 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
220 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
221 "--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
222 ])
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
223 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
224 flashAddress,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
225 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
226 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
227 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
228 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
229 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
230 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
231 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
232 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
233
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
234 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
235 def __flashAddons(self):
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 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
238 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
239 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
240 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
241 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
242 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
243 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
244 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
245 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
246 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
247 "--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
248 "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
249 ]
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 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
251 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
252 "--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
253 ])
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
254 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
255 flashAddress.lower(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
256 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
257 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
258 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
259 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
260 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
261 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
262 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
263 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
264
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
265 @pyqtSlot()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
266 def __backupFlash(self):
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 Private slot to backup the currently flashed firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
269 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
270 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
271 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
272 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
273 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
274 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
275 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
276 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
277 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
278 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
279 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
280 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
281 "read_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
282 "0x0", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
283 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
284 ]
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
285 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
286 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
287 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
288 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
289 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
290 dlg.exec()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
291
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
292 @pyqtSlot()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
293 def __restoreFlash(self):
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 Private slot to restore a previously saved firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
296 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
297 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
298 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
299 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
300 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
301 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
302 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
303 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
304 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
305 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
306 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
307 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
308 "write_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
309 "--flash_mode", flashMode,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
310 ]
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
311 if bool(flashSize):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
312 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
313 "--flash_size", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
314 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
315 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
316 "0x0",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
317 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
318 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
319 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
320 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
321 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
322 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
323 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
324 dlg.exec()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
325
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
326 @pyqtSlot()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
327 def __showChipID(self):
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 Private slot to show the ID of the ESP chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
330 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
331 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
332 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
333 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
334 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
335 "chip_id"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
336 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
337 dlg = E5ProcessDialog(self.tr("'esptool chip_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
338 self.tr("Show Chip ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
339 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
340 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
341 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
342
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
343 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
344 def __showFlashID(self):
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 Private slot to show the ID of the ESP flash chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
347 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
348 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
349 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
350 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
351 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
352 "flash_id"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
353 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
354 dlg = E5ProcessDialog(self.tr("'esptool flash_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
355 self.tr("Show Flash ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
356 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
357 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
358 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
359
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
360 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
361 def __showMACAddress(self):
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 Private slot to show the MAC address of the ESP chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
364 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
365 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
366 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
367 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
368 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
369 "read_mac"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
370 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
371 dlg = E5ProcessDialog(self.tr("'esptool read_mac' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
372 self.tr("Show MAC Address"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
373 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
374 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
375 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
376
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
377 @pyqtSlot()
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
378 def __resetDevice(self):
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
379 """
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
380 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
381 """
7353
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
382 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
383 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
384 "import machine",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
385 "machine.reset()",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
386 ])
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
387 else:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
388 # 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
389 # the output
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
390 args = [
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
391 "-u",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
392 "-m", "esptool",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
393 "--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
394 "flash_id"
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
395 ]
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
396 proc = QProcess()
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
397 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
398 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
399 if procStarted:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
400 proc.waitForFinished(10000)
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
401
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
402 @pyqtSlot()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
403 def __installEspTool(self):
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 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
406 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
407 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
408 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
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 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
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 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
413
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 @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
415 @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
416 """
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
417 return Preferences.getMicroPython("MicroPythonDocuUrl")
7328
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 def getFirmwareUrl(self):
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 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
422
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
423 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
424 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
425 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
426 return Preferences.getMicroPython("MicroPythonFirmwareUrl")

eric ide

mercurial