34 ("ESP32-S3", "esp32s3"), |
34 ("ESP32-S3", "esp32s3"), |
35 ("ESP8266", "esp8266"), |
35 ("ESP8266", "esp8266"), |
36 ) |
36 ) |
37 |
37 |
38 FlashModes = [ |
38 FlashModes = [ |
|
39 ("", ""), |
39 ("Quad I/O", "qio"), |
40 ("Quad I/O", "qio"), |
40 ("Quad Output", "qout"), |
41 ("Quad Output", "qout"), |
41 ("Dual I/O", "dio"), |
42 ("Dual I/O", "dio"), |
42 ("Dual Output", "dout"), |
43 ("Dual Output", "dout"), |
43 ] |
44 ] |
98 self.__isBackupMode = backupMode |
99 self.__isBackupMode = backupMode |
99 |
100 |
100 for text, chip in self.Chips: |
101 for text, chip in self.Chips: |
101 self.espComboBox.addItem(text, chip) |
102 self.espComboBox.addItem(text, chip) |
102 |
103 |
|
104 self.baudRateComboBox.addItems([ |
|
105 "74.880", "115.200", "230.400", "460.800", "921.600", "1.500.000"]) |
|
106 self.baudRateComboBox.setCurrentIndex(3) |
|
107 |
103 self.firmwarePicker.setFilters( |
108 self.firmwarePicker.setFilters( |
104 self.tr("Firmware Files (*.img);;All Files (*)")) |
109 self.tr("Firmware Files (*.img);;All Files (*)")) |
105 if self.__isBackupMode: |
110 if self.__isBackupMode: |
106 self.firmwarePicker.setMode( |
111 self.firmwarePicker.setMode( |
107 EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) |
112 EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) |
|
113 self.sizeInfoLabel.clear() |
108 self.modeComboBox.setEnabled(False) |
114 self.modeComboBox.setEnabled(False) |
|
115 self.modeInfoLabel.setEnabled(False) |
109 self.setWindowTitle(self.tr("Backup Firmware")) |
116 self.setWindowTitle(self.tr("Backup Firmware")) |
110 else: |
117 else: |
111 self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
118 self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
112 for text, mode in self.FlashModes: |
119 for text, mode in self.FlashModes: |
113 self.modeComboBox.addItem(text, mode) |
120 self.modeComboBox.addItem(text, mode) |
149 self.sizeComboBox.setCurrentText(selectedSize) |
156 self.sizeComboBox.setCurrentText(selectedSize) |
150 |
157 |
151 self.__updateOkButton() |
158 self.__updateOkButton() |
152 |
159 |
153 @pyqtSlot(str) |
160 @pyqtSlot(str) |
|
161 def on_sizeComboBox_currentTextChanged(self, size): |
|
162 """ |
|
163 Private slot handling a change of the selected firmware size. |
|
164 |
|
165 @param size selected size text |
|
166 @type str |
|
167 """ |
|
168 self.__updateOkButton() |
|
169 |
|
170 @pyqtSlot(str) |
154 def on_firmwarePicker_textChanged(self, firmware): |
171 def on_firmwarePicker_textChanged(self, firmware): |
155 """ |
172 """ |
156 Private slot handling a change of the firmware path. |
173 Private slot handling a change of the firmware path. |
157 |
174 |
158 @param firmware path to the firmware |
175 @param firmware path to the firmware |
163 def getData(self): |
180 def getData(self): |
164 """ |
181 """ |
165 Public method to get the entered data. |
182 Public method to get the entered data. |
166 |
183 |
167 @return tuple containing the selected chip type, the firmware size, |
184 @return tuple containing the selected chip type, the firmware size, |
168 the flash mode and the path of the firmware file |
185 the baud rate or flashing, the flash mode and the path of the |
169 @rtype tuple of (str, str, str, str) |
186 firmware file |
170 """ |
187 @rtype tuple of (str, str, str, str, str) |
|
188 """ |
|
189 if self.__isBackupMode: |
|
190 flashSize = self.sizeComboBox.currentData() |
|
191 else: |
|
192 flashSize = self.sizeComboBox.currentText().replace(" ", "") |
|
193 |
171 return ( |
194 return ( |
172 self.espComboBox.currentData(), |
195 self.espComboBox.currentData(), |
173 self.sizeComboBox.currentData(), |
196 flashSize, |
|
197 self.baudRateComboBox.currentText().replace(".", ""), |
174 self.modeComboBox.currentData(), |
198 self.modeComboBox.currentData(), |
175 self.firmwarePicker.text(), |
199 self.firmwarePicker.text(), |
176 ) |
200 ) |