eric6/MicroPython/EspDevices.py

Wed, 27 Jan 2021 18:27:52 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 27 Jan 2021 18:27:52 +0100
branch
jsonfiles
changeset 8011
630a173cb137
parent 7923
91e843545d9a
child 8096
5425a9072300
permissions
-rw-r--r--

Implemented the JSON based tasks files.

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
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
159 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
160 def __eraseFlash(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
161 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
162 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
163 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
164 ok = E5MessageBox.yesNo(
7173
f611c3b7313f EspDevices, MicrobitDevices: fixed a few omissions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
165 self.microPython,
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
166 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
167 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
168 """ erased?"""))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
169 if ok:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
170 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
171 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
172 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
173 "--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
174 "erase_flash",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
175 ]
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
176 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
177 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
178 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
179 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
180 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
181 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
182
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
183 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
184 def __flashMicroPython(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
185 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
186 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
187
fe89c98430b6 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7114
diff changeset
188 @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
189 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
190 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
191 dlg = EspFirmwareSelectionDialog()
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
192 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
193 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
194 if chip == "esp8266":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
195 flashAddress = "0x0000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
196 elif chip == "esp32":
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
197 flashAddress = "0x1000"
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
198 else:
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
199 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
200 .format(chip))
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
201 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
202 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
203 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
204 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
205 "--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
206 "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
207 ]
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
208 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
209 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
210 "--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
211 ])
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
212 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
213 flashAddress,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
214 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
215 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
216 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
217 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
218 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
219 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
220 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
221 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
222
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
223 @pyqtSlot()
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
224 def __flashAddons(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
225 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
226 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
227 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
228 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
229 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
230 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
231 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
232 flashArgs = [
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
233 "-u",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
234 "-m", "esptool",
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
235 "--chip", chip,
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
236 "--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
237 "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
238 ]
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
239 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
240 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
241 "--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
242 ])
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
243 flashArgs.extend([
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
244 flashAddress.lower(),
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
245 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
246 ])
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
247 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
248 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
249 showProgress=True)
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
250 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
251 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
252 dlg.exec()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
253
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
254 @pyqtSlot()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
255 def __backupFlash(self):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
256 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
257 Private slot to backup the currently flashed firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
258 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
259 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
260 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
261 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
262 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
263 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
264 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
265 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
266 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
267 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
268 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
269 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
270 "read_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
271 "0x0", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
272 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
273 ]
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
274 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
275 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
276 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
277 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
278 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
279 dlg.exec()
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
280
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
281 @pyqtSlot()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
282 def __restoreFlash(self):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
283 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
284 Private slot to restore a previously saved firmware.
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
285 """
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
286 from .EspBackupRestoreFirmwareDialog import (
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
287 EspBackupRestoreFirmwareDialog
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
288 )
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
289 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
290 if dlg.exec() == QDialog.Accepted:
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
291 chip, flashSize, flashMode, firmware = dlg.getData()
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
292 flashArgs = [
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
293 "-u",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
294 "-m", "esptool",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
295 "--chip", chip,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
296 "--port", self.microPython.getCurrentPort(),
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
297 "write_flash",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
298 "--flash_mode", flashMode,
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 if bool(flashSize):
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
301 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
302 "--flash_size", flashSize,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
303 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
304 flashArgs.extend([
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
305 "0x0",
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
306 firmware,
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
307 ])
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
308 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
309 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
310 showProgress=True)
7352
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
311 res = dlg.startProcess(sys.executable, flashArgs)
5f69f55b919f MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7346
diff changeset
312 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
313 dlg.exec()
7352
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 @pyqtSlot()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
316 def __showChipID(self):
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
317 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
318 Private slot to show the ID of the ESP chip.
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
319 """
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
320 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
321 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
322 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
323 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
324 "chip_id"
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
325 ]
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
326 dlg = E5ProcessDialog(self.tr("'esptool chip_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
327 self.tr("Show Chip ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
328 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
329 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
330 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
331
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
332 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
333 def __showFlashID(self):
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 Private slot to show the ID of the ESP flash chip.
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 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
338 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
339 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
340 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
341 "flash_id"
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 dlg = E5ProcessDialog(self.tr("'esptool flash_id' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
344 self.tr("Show Flash ID"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
345 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
346 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
347 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
348
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
349 @pyqtSlot()
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
350 def __showMACAddress(self):
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 Private slot to show the MAC address of the ESP chip.
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 args = [
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
355 "-u",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
356 "-m", "esptool",
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
357 "--port", self.microPython.getCurrentPort(),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
358 "read_mac"
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 dlg = E5ProcessDialog(self.tr("'esptool read_mac' Output"),
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
361 self.tr("Show MAC Address"))
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
362 res = dlg.startProcess(sys.executable, args)
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
363 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7595
diff changeset
364 dlg.exec()
7346
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
365
9108d26211f7 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7337
diff changeset
366 @pyqtSlot()
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
367 def __resetDevice(self):
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
368 """
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
369 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
370 """
7353
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
371 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
372 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
373 "import machine",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
374 "machine.reset()",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
375 ])
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
376 else:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
377 # 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
378 # the output
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
379 args = [
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
380 "-u",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
381 "-m", "esptool",
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
382 "--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
383 "flash_id"
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 proc = QProcess()
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
386 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
387 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
388 if procStarted:
caa2ccd5677c EspDevices: fixed an issue resetting the attached device when not connected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7352
diff changeset
389 proc.waitForFinished(10000)
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
390
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7173
diff changeset
391 @pyqtSlot()
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
392 def __installEspTool(self):
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
393 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
394 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
395 """
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
396 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
397 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
398
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
399 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
400 """
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
401 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
402
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
403 @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
404 @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
405 """
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
406 return Preferences.getMicroPython("MicroPythonDocuUrl")
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
407
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
408 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
409 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
410 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
411
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
412 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
413 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
414 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
415 return Preferences.getMicroPython("MicroPythonFirmwareUrl")

eric ide

mercurial