eric7/MicroPython/EspFirmwareSelectionDialog.py

branch
eric7
changeset 8924
7f2cad9900cf
parent 8881
54e42bc2437a
child 8945
b6be65111565
equal deleted inserted replaced
8923:bbf9aa041116 8924:7f2cad9900cf
22 class EspFirmwareSelectionDialog(QDialog, Ui_EspFirmwareSelectionDialog): 22 class EspFirmwareSelectionDialog(QDialog, Ui_EspFirmwareSelectionDialog):
23 """ 23 """
24 Class implementing a dialog to select the ESP chip type and the firmware to 24 Class implementing a dialog to select the ESP chip type and the firmware to
25 be flashed. 25 be flashed.
26 """ 26 """
27 Chips = (
28 ("", ""),
29 ("ESP32", "esp32"),
30 ("ESP32-C3", "esp32c3"),
31 ("ESP32-S2", "esp32s2"),
32 ("ESP32-S3", "esp32s3"),
33 ("ESP8266", "esp8266"),
34 )
35
27 FlashModes = ( 36 FlashModes = (
28 ("", ""), 37 ("", ""),
29 ("Quad I/O", "qio"), 38 ("Quad I/O", "qio"),
30 ("Quad Output", "qout"), 39 ("Quad Output", "qout"),
31 ("Dual I/O", "dio"), 40 ("Dual I/O", "dio"),
32 ("Dual Output", "dout"), 41 ("Dual Output", "dout"),
33 ) 42 )
43
44 FlashAddresses = {
45 "esp8266": "0x0000",
46 "esp32": "0x1000",
47 "esp32c3": "0x0000",
48 "esp32s2": "0x1000",
49 "esp32s3": "0x1000",
50 }
34 51
35 def __init__(self, addon=False, parent=None): 52 def __init__(self, addon=False, parent=None):
36 """ 53 """
37 Constructor 54 Constructor
38 55
48 65
49 self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 66 self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
50 self.firmwarePicker.setFilters( 67 self.firmwarePicker.setFilters(
51 self.tr("Firmware Files (*.bin);;All Files (*)")) 68 self.tr("Firmware Files (*.bin);;All Files (*)"))
52 69
53 self.espComboBox.addItems(["", "ESP32", "ESP8266"]) 70 for text, chip in self.Chips:
71 self.espComboBox.addItem(text, chip)
54 72
55 self.baudRateComboBox.addItems([ 73 self.baudRateComboBox.addItems([
56 "74.880", "115.200", "230.400", "460.800", "921.600", "1.500.000"]) 74 "74.880", "115.200", "230.400", "460.800", "921.600", "1.500.000"])
57 self.baudRateComboBox.setCurrentIndex(1) 75 self.baudRateComboBox.setCurrentIndex(1)
58 76
110 @return tuple containing the selected chip type, the path of the 128 @return tuple containing the selected chip type, the path of the
111 firmware file, the baud rate, the flash mode and the flash 129 firmware file, the baud rate, the flash mode and the flash
112 address 130 address
113 @rtype tuple of (str, str, str, str, str) 131 @rtype tuple of (str, str, str, str, str)
114 """ 132 """
115 address = self.addressEdit.text() if self.__addon else "" 133 chip = self.espComboBox.currentData()
134 address = (
135 self.addressEdit.text()
136 if self.__addon else
137 self.FlashAddresses[chip])
116 138
117 return ( 139 return (
118 self.espComboBox.currentText().lower(), 140 chip,
119 self.firmwarePicker.text(), 141 self.firmwarePicker.text(),
120 self.baudRateComboBox.currentText().replace(".", ""), 142 self.baudRateComboBox.currentText().replace(".", ""),
121 self.modeComboBox.currentData(), 143 self.modeComboBox.currentData(),
122 address, 144 address,
123 ) 145 )

eric ide

mercurial