src/eric7/MicroPython/UF2FlashDialog.py

branch
eric7
changeset 11167
a3f5af773bc7
parent 11122
9b2abac8e19f
child 11171
f7cb33253cbf
equal deleted inserted replaced
11166:fd914f897dcf 11167:a3f5af773bc7
536 ], 536 ],
537 (0x2886, 0x0044): [ 537 (0x2886, 0x0044): [
538 ("XIAO-BOOT", "XIAO nRF52840"), 538 ("XIAO-BOOT", "XIAO nRF52840"),
539 ], 539 ],
540 (0x2886, 0x0045): [ 540 (0x2886, 0x0045): [
541 ("XIAO-SENSE", "XIAO nRF52840"), 541 ("XIAO-SENSE", "XIAO nRF52840 Sense"),
542 ], 542 ],
543 (0x2886, 0x0057): [ 543 (0x2886, 0x0057): [
544 ("T1000-E", "T1000-E for Meshtastic"), 544 ("T1000-E", "T1000-E for Meshtastic"),
545 ], 545 ],
546 (0x2886, 0x8056): [ 546 (0x2886, 0x8056): [
767 " flash button.</li>" 767 " flash button.</li>"
768 "</ol>", 768 "</ol>",
769 ), 769 ),
770 "show_all": True, 770 "show_all": True,
771 "firmware": "CircuitPython", 771 "firmware": "CircuitPython",
772 },
773 "nrf52": {
774 "volumes": {
775 (0x2886, 0x0045): [
776 ("XIAO-SENSE", "XIAO nRF52840 Sense"),
777 ],
778 },
779 "instructions": QCoreApplication.translate(
780 "UF2FlashDialog",
781 "<h3>NRF52 Board</h3>"
782 "<p>In order to prepare the board for flashing follow these"
783 " steps:</p><ol>"
784 "<li>Switch your device to 'bootloader' mode by double-pressing"
785 " the reset button.</li>"
786 "<li>Wait until the device has entered 'bootloader' mode.</li>"
787 "<li>(If this does not happen, then try shorter or longer"
788 " pauses between presses.)</li>"
789 "<li>Ensure the boot volume is available (this may require"
790 " mounting it).</li>"
791 "<li>Select the firmware file to be flashed and click the"
792 " flash button.</li>"
793 "</ol>",
794 ),
795 "show_all": True,
796 "firmware": "MicroPython / CircuitPython",
772 }, 797 },
773 "rp2": { 798 "rp2": {
774 "volumes": { 799 "volumes": {
775 (0x0000, 0x0000): [ 800 (0x0000, 0x0000): [
776 ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID 801 ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID
961 self.devicesComboBox.addItem(self.tr("Manual Select")) 986 self.devicesComboBox.addItem(self.tr("Manual Select"))
962 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) 987 self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole)
963 self.on_devicesComboBox_currentIndexChanged(0) 988 self.on_devicesComboBox_currentIndexChanged(0)
964 else: 989 else:
965 for index, (boardType, description, vidpid) in enumerate(sorted(devices)): 990 for index, (boardType, description, vidpid) in enumerate(sorted(devices)):
966 self.devicesComboBox.addItem(description) 991 self.devicesComboBox.addItem(
992 self.tr("{0} ({1})", "board description, board type").format(
993 description, boardType
994 )
995 )
967 self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole) 996 self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole)
968 self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) 997 self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole)
969 self.devicesComboBox.addItem(self.tr("Manual Select")) 998 self.devicesComboBox.addItem(self.tr("Manual Select"))
970 self.devicesComboBox.setItemData( 999 self.devicesComboBox.setItemData(
971 index + 1, self.__manualType, self.DeviceTypeRole 1000 index + 1, self.__manualType, self.DeviceTypeRole
1013 def __showAllInstructions(self): 1042 def __showAllInstructions(self):
1014 """ 1043 """
1015 Private method to show instructions for resetting devices to bootloader 1044 Private method to show instructions for resetting devices to bootloader
1016 mode. 1045 mode.
1017 """ 1046 """
1018 self.infoLabel.setText(self.tr("Reset Instructions:")) 1047 self.infoLabel.setText(self.tr("Flash Instructions:"))
1019 1048
1020 htmlText = self.tr( 1049 htmlText = self.tr(
1021 "<h4>No known devices detected.</h4>" 1050 "<h4>No known devices detected.</h4>"
1022 "<p>Follow the appropriate instructions below to set <b>one</b>" 1051 "<p>Follow the appropriate instructions below to set <b>one</b>"
1023 " board into 'bootloader' mode. Press <b>Refresh</b> when ready." 1052 " board into 'bootloader' mode. Press <b>Refresh</b> when ready."
1036 @param devices list of detected devices 1065 @param devices list of detected devices
1037 @type list of str 1066 @type list of str
1038 """ 1067 """
1039 boardTypes = {x[0] for x in devices} 1068 boardTypes = {x[0] for x in devices}
1040 1069
1041 self.infoLabel.setText(self.tr("Reset Instructions:")) 1070 self.infoLabel.setText(self.tr("Flash Instructions:"))
1042 1071
1043 if self.__boardType: 1072 if self.__boardType:
1044 htmlText = self.tr( 1073 htmlText = self.tr(
1045 "<h4>Flash {0} Firmware</h4>" 1074 "<h4>Flash {0} Firmware</h4>"
1046 "<p>Follow the instructions below to set <b>one</b> board into" 1075 "<p>Follow the instructions below to set <b>one</b> board into"
1068 mode for a specific board type. 1097 mode for a specific board type.
1069 1098
1070 @param boardType type of the board to show instructions for 1099 @param boardType type of the board to show instructions for
1071 @type str 1100 @type str
1072 """ 1101 """
1073 self.infoLabel.setText(self.tr("Reset Instructions:")) 1102 self.infoLabel.setText(self.tr("Flash Instructions:"))
1074 1103
1075 htmlText = self.tr( 1104 htmlText = self.tr(
1076 "<h4>No known devices detected.</h4>" 1105 "<h4>No known devices detected.</h4>"
1077 "<p>Follow the instructions below to set <b>one</b> board into" 1106 "<p>Follow the instructions below to set <b>one</b> board into"
1078 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" 1107 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>"
1130 "<p>Press <b>Refresh</b> when ready.</p>" 1159 "<p>Press <b>Refresh</b> when ready.</p>"
1131 ).format("</li><li>".join(sorted(volumes))) 1160 ).format("</li><li>".join(sorted(volumes)))
1132 1161
1133 if boardType: 1162 if boardType:
1134 htmlText += self.tr( 1163 htmlText += self.tr(
1135 "<h4>Reset Instructions</h4>" 1164 "<h4>Flash Instructions</h4>"
1136 "<p>Follow the instructions below to set the board into" 1165 "<p>Follow the instructions below to set the board into"
1137 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" 1166 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>"
1138 ) 1167 )
1139 htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] 1168 htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"]
1140 1169

eric ide

mercurial