193 |
193 |
194 @pyqtSlot() |
194 @pyqtSlot() |
195 def __flashMicroPython(self): |
195 def __flashMicroPython(self): |
196 """ |
196 """ |
197 Private slot to flash a MicroPython firmware to the device. |
197 Private slot to flash a MicroPython firmware to the device. |
198 |
|
199 @exception ValueError raised to indicate an unsupported chip type |
|
200 """ |
198 """ |
201 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
199 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
202 dlg = EspFirmwareSelectionDialog() |
200 dlg = EspFirmwareSelectionDialog() |
203 if dlg.exec() == QDialog.DialogCode.Accepted: |
201 if dlg.exec() == QDialog.DialogCode.Accepted: |
204 chip, firmware, baudRate, flashMode, _ = dlg.getData() |
202 chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() |
205 if chip not in ("esp8266", "esp32"): |
|
206 raise ValueError(self.tr("Unsupported chip type '{0}'.") |
|
207 .format(chip)) |
|
208 |
|
209 if chip == "esp8266": |
|
210 flashAddress = "0x0000" |
|
211 elif chip == "esp32": |
|
212 flashAddress = "0x1000" |
|
213 |
|
214 flashArgs = [ |
203 flashArgs = [ |
215 "-u", |
204 "-u", |
216 "-m", "esptool", |
205 "-m", "esptool", |
217 "--chip", chip, |
206 "--chip", chip, |
218 "--port", self.microPython.getCurrentPort(), |
207 "--port", self.microPython.getCurrentPort(), |