Skip to content

Commit 1262a28

Browse files
committed
v1.5.1 - auto port refresh when COM combo box is clicked
1 parent e5c041c commit 1262a28

File tree

8 files changed

+40
-24
lines changed

8 files changed

+40
-24
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ If you need to install the application, see the [Installation Section](#installa
1313
## Upload Firmware
1414

1515
* Attach the RTK product over USB
16-
* Click ```Refresh```
16+
* Click the ```COM Port``` combo box and select the correct COM port from the dropdown menu
1717

18-
![Select Firmware](images/RTK_Uploader_Windows_2.png)
18+
![Select COM Port](images/RTK_Uploader_Windows_2.png)
1919

20-
* Select the correct COM port from the dropdown menu
2120
* Adjust the Baud Rate if desired
22-
* Click ```Browse``` and select the firmware file you'd like to upload (should end in *.bin*)
21+
* Click ```Browse``` and select the firmware file you'd like to upload (the filename should end in *.bin*)
2322
* You can find the firmware in the [SparkFun_RTK_Firmware_Binaries repo on GitHub](https://github.com/sparkfun/SparkFun_RTK_Firmware_Binaries)
2423
* The older versions of the firmware are in a [separate folder](https://github.com/sparkfun/SparkFun_RTK_Firmware_Binaries/tree/main/PreviousVersions)
25-
* If you have one of the earliest RTK Surveyors with 4MB flash, please select v1_12
24+
* If you have one of the earliest RTK Surveyors with 4MB flash, please select **v1_12**
2625

2726
![Select Firmware](images/RTK_Uploader_Windows_4.png)
2827

@@ -34,7 +33,7 @@ The selected firmware is then uploaded to the connected SparkFun RTK product. Up
3433

3534
## Reset ESP32
3635

37-
Clicking the ```Reset ESP32``` button . This is helpful when the firmware update succeeds but does not reset the RTK correctly.
36+
Clicking the ```Reset ESP32``` button will reset the ESP32 processor. This is helpful when the firmware update succeeds but does not reset the RTK correctly.
3837
If your RTK 'freezes' after the update, pressing ```Reset ESP32``` will get it going again.
3938

4039
![Reset ESP32](images/RTK_Uploader_Windows_3.png)

RTK_Firmware_Uploader/RTK_Firmware_Uploader.py

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ def get_version(rel_path: str) -> str:
5151

5252
_APP_VERSION = get_version("_version.py")
5353

54+
# ----------------------------------------------------------------
55+
# hack to know when a combobox menu is being shown. Helpful if contents
56+
# of list are dynamic -- like serial ports.
57+
58+
class AUxComboBox(QComboBox):
59+
60+
popupAboutToBeShown = pyqtSignal()
61+
62+
def showPopup(self):
63+
self.popupAboutToBeShown.emit()
64+
super().showPopup()
65+
5466
#----------------------------------------------------------------
5567
# ux_is_darkmode()
5668
#
@@ -131,13 +143,14 @@ def __init__(self, parent: QWidget = None) -> None:
131143

132144
# Port Combobox
133145
self.port_label = QLabel(self.tr('COM Port:'))
134-
self.port_combobox = QComboBox()
146+
self.port_combobox = AUxComboBox()
135147
self.port_label.setBuddy(self.port_combobox)
136148
self.update_com_ports()
149+
self.port_combobox.popupAboutToBeShown.connect(self.on_port_combobox)
137150

138-
# Refresh Button
139-
self.refresh_btn = QPushButton(self.tr('Refresh'))
140-
self.refresh_btn.clicked.connect(self.on_refresh_btn_pressed)
151+
# Reset Button
152+
self.reset_btn = QPushButton(self.tr('Reset ESP32'))
153+
self.reset_btn.clicked.connect(self.on_reset_btn_pressed)
141154

142155
# Baudrate Combobox
143156
self.baud_label = QLabel(self.tr('Baud Rate:'))
@@ -152,10 +165,6 @@ def __init__(self, parent: QWidget = None) -> None:
152165
self.upload_btn.setFont(myFont)
153166
self.upload_btn.clicked.connect(self.on_upload_btn_pressed)
154167

155-
# Reset Button
156-
self.reset_btn = QPushButton(self.tr('Reset ESP32'))
157-
self.reset_btn.clicked.connect(self.on_reset_btn_pressed)
158-
159168
# Messages Bar
160169
self.messages_label = QLabel(self.tr('Status / Warnings:'))
161170

@@ -179,16 +188,14 @@ def __init__(self, parent: QWidget = None) -> None:
179188

180189
layout.addWidget(self.port_label, 2, 0)
181190
layout.addWidget(self.port_combobox, 2, 1)
182-
layout.addWidget(self.refresh_btn, 2, 2)
191+
layout.addWidget(self.reset_btn, 2, 2)
183192

184193
layout.addWidget(self.baud_label, 3, 0)
185194
layout.addWidget(self.baud_combobox, 3, 1)
186195
layout.addWidget(self.upload_btn, 3, 2)
187196

188-
layout.addWidget(self.reset_btn, 4, 2)
189-
190-
layout.addWidget(self.messages_label, 5, 0)
191-
layout.addWidget(self.messageBox, 6, 0, 6, 3)
197+
layout.addWidget(self.messages_label, 4, 0)
198+
layout.addWidget(self.messageBox, 5, 0, 5, 3)
192199

193200
self.setLayout(layout)
194201

@@ -278,16 +285,30 @@ def on_finished(self, status, action_type, job_id) -> None:
278285

279286
# If the flash detection is finished, trigger the upload
280287
if action_type == AUxEsptoolDetectFlash.ACTION_ID:
288+
self.writeMessage("Flash detection complete. Uploading firmware...")
281289
self.do_upload()
282290

283291
# If the upload is finished, trigger a reset
284292
elif action_type == AUxEsptoolUploadFirmware.ACTION_ID:
293+
self.writeMessage("Firmware upload complete. Resetting ESP32...")
285294
self.on_reset_btn_pressed()
286295

287296
# re-enable the UX
288297
else:
298+
self.writeMessage("Reset complete...")
289299
self.disable_interface(False)
290300

301+
# --------------------------------------------------------------
302+
# on_port_combobox()
303+
#
304+
# Called when the combobox pop-up menu is about to be shown
305+
#
306+
# Use this event to dynamically update the displayed ports
307+
#
308+
@pyqtSlot()
309+
def on_port_combobox(self):
310+
self.update_com_ports()
311+
291312
def _load_settings(self) -> None:
292313
"""Load settings on startup."""
293314
port_name = self.settings.value(SETTING_PORT_NAME)
@@ -386,10 +407,6 @@ def closeEvent(self, event: QCloseEvent) -> None:
386407

387408
event.accept()
388409

389-
def on_refresh_btn_pressed(self) -> None:
390-
self.update_com_ports()
391-
self.writeMessage("Ports Refreshed\n")
392-
393410
def on_browse_btn_pressed(self) -> None:
394411
"""Open dialog to select bin file."""
395412
options = QFileDialog.Options()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.5.0"
1+
__version__ = "1.5.1"

images/RTK_Uploader_Windows.gif

4.43 MB
Loading

images/RTK_Uploader_Windows_1.png

0 Bytes
Loading

images/RTK_Uploader_Windows_2.png

0 Bytes
Loading

images/RTK_Uploader_Windows_3.png

0 Bytes
Loading

images/RTK_Uploader_Windows_4.png

0 Bytes
Loading

0 commit comments

Comments
 (0)