eric6/MicroPython/EspDevices.py

changeset 7595
5db6bfeff23e
parent 7360
9190402e4505
child 7759
51aa6c6b66f7
equal deleted inserted replaced
7594:ee35df230130 7595:5db6bfeff23e
189 @exception ValueError raised to indicate an unsupported chip type 189 @exception ValueError raised to indicate an unsupported chip type
190 """ 190 """
191 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog 191 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
192 dlg = EspFirmwareSelectionDialog() 192 dlg = EspFirmwareSelectionDialog()
193 if dlg.exec_() == QDialog.Accepted: 193 if dlg.exec_() == QDialog.Accepted:
194 chip, firmware, _ = dlg.getData() 194 chip, firmware, flashMode, _ = dlg.getData()
195 if chip == "esp8266": 195 if chip == "esp8266":
196 flashAddress = "0x0000" 196 flashAddress = "0x0000"
197 elif chip == "esp32": 197 elif chip == "esp32":
198 flashAddress = "0x1000" 198 flashAddress = "0x1000"
199 else: 199 else:
203 "-u", 203 "-u",
204 "-m", "esptool", 204 "-m", "esptool",
205 "--chip", chip, 205 "--chip", chip,
206 "--port", self.microPython.getCurrentPort(), 206 "--port", self.microPython.getCurrentPort(),
207 "write_flash", 207 "write_flash",
208 ]
209 if flashMode:
210 flashArgs.extend([
211 "--flash_mode", flashMode
212 ])
213 flashArgs.extend([
208 flashAddress, 214 flashAddress,
209 firmware, 215 firmware,
210 ] 216 ])
211 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), 217 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"),
212 self.tr("Flash MicroPython Firmware"), 218 self.tr("Flash MicroPython Firmware"),
213 showProgress=True) 219 showProgress=True)
214 res = dlg.startProcess(sys.executable, flashArgs) 220 res = dlg.startProcess(sys.executable, flashArgs)
215 if res: 221 if res:
221 Private slot to flash some additional firmware images. 227 Private slot to flash some additional firmware images.
222 """ 228 """
223 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog 229 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog
224 dlg = EspFirmwareSelectionDialog(addon=True) 230 dlg = EspFirmwareSelectionDialog(addon=True)
225 if dlg.exec_() == QDialog.Accepted: 231 if dlg.exec_() == QDialog.Accepted:
226 chip, firmware, flashAddress = dlg.getData() 232 chip, firmware, flashMode, flashAddress = dlg.getData()
227 flashArgs = [ 233 flashArgs = [
228 "-u", 234 "-u",
229 "-m", "esptool", 235 "-m", "esptool",
230 "--chip", chip, 236 "--chip", chip,
231 "--port", self.microPython.getCurrentPort(), 237 "--port", self.microPython.getCurrentPort(),
232 "write_flash", 238 "write_flash",
239 ]
240 if flashMode:
241 flashArgs.extend([
242 "--flash_mode", flashMode
243 ])
244 flashArgs.extend([
233 flashAddress.lower(), 245 flashAddress.lower(),
234 firmware, 246 firmware,
235 ] 247 ])
236 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), 248 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"),
237 self.tr("Flash Additional Firmware"), 249 self.tr("Flash Additional Firmware"),
238 showProgress=True) 250 showProgress=True)
239 res = dlg.startProcess(sys.executable, flashArgs) 251 res = dlg.startProcess(sys.executable, flashArgs)
240 if res: 252 if res:

eric ide

mercurial