eric7/MicroPython/EspBackupRestoreFirmwareDialog.py

branch
eric7
changeset 8924
7f2cad9900cf
parent 8881
54e42bc2437a
child 8945
b6be65111565
diff -r bbf9aa041116 -r 7f2cad9900cf eric7/MicroPython/EspBackupRestoreFirmwareDialog.py
--- a/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Sat Jan 15 18:40:57 2022 +0100
+++ b/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py	Sat Jan 15 18:42:21 2022 +0100
@@ -26,21 +26,52 @@
     Class implementing a dialog to select the ESP chip type and the backup and
     restore parameters.
     """
+    Chips = (
+        ("", ""),
+        ("ESP32", "esp32"),
+        ("ESP32-C3", "esp32c3"),
+        ("ESP32-S2", "esp32s2"),
+        ("ESP32-S3", "esp32s3"),
+        ("ESP8266", "esp8266"),
+    )
+    
     FlashModes = [
         ("Quad I/O", "qio"),
         ("Quad Output", "qout"),
         ("Dual I/O", "dio"),
         ("Dual Output", "dout"),
     ]
+    
     FlashSizes = {
-        "ESP32": [
+        "esp32": [
+            (" 1 MB", "0x100000"),
+            (" 2 MB", "0x200000"),
+            (" 4 MB", "0x400000"),
+            (" 8 MB", "0x800000"),
+            ("16 MB", "0x1000000"),
+        ],
+        "esp32c3": [
             (" 1 MB", "0x100000"),
             (" 2 MB", "0x200000"),
             (" 4 MB", "0x400000"),
             (" 8 MB", "0x800000"),
             ("16 MB", "0x1000000"),
         ],
-        "ESP8266": [
+        "esp32s2": [
+            (" 1 MB", "0x100000"),
+            (" 2 MB", "0x200000"),
+            (" 4 MB", "0x400000"),
+            (" 8 MB", "0x800000"),
+            ("16 MB", "0x1000000"),
+        ],
+        "esp32s3": [
+            (" 1 MB", "0x100000"),
+            (" 2 MB", "0x200000"),
+            (" 4 MB", "0x400000"),
+            (" 8 MB", "0x800000"),
+            ("16 MB", "0x1000000"),
+        ],
+        "esp8266": [
             ("256 KB", "0x40000"),
             ("512 KB", "0x80000"),
             (" 1 MB", "0x100000"),
@@ -66,7 +97,8 @@
         
         self.__isBackupMode = backupMode
         
-        self.espComboBox.addItems(["", "ESP32", "ESP8266"])
+        for text, chip in self.Chips:
+            self.espComboBox.addItem(text, chip)
         
         self.firmwarePicker.setFilters(
             self.tr("Firmware Files (*.img);;All Files (*)"))
@@ -108,9 +140,10 @@
         """
         selectedSize = self.sizeComboBox.currentText()
         self.sizeComboBox.clear()
-        if chip and chip in self.FlashSizes:
+        chipType = self.espComboBox.currentData()
+        if chipType and chipType in self.FlashSizes:
             self.sizeComboBox.addItem("")
-            for text, data in self.FlashSizes[chip]:
+            for text, data in self.FlashSizes[chipType]:
                 self.sizeComboBox.addItem(text, data)
             
             self.sizeComboBox.setCurrentText(selectedSize)
@@ -136,7 +169,7 @@
         @rtype tuple of (str, str, str, str)
         """
         return (
-            self.espComboBox.currentText().lower(),
+            self.espComboBox.currentData(),
             self.sizeComboBox.currentData(),
             self.modeComboBox.currentData(),
             self.firmwarePicker.text(),

eric ide

mercurial