5858SETTING_FIS_LOCATION = 'fis_location'
5959SETTING_FIRMWARE_LOCATION = 'firmware_location'
6060SETTING_BAUD_RATE = 'baud'
61+ SETTING_UPDATE_BAUD_RATE = 'update_baud'
6162
6263guiVersion = 'v1.0'
6364
@@ -108,8 +109,8 @@ def __init__(self, parent: QWidget = None) -> None:
108109 self .fis_browse_btn .setEnabled (True )
109110 self .fis_browse_btn .pressed .connect (self .on_browse_fis_btn_pressed )
110111
111- # Clear Button
112- self .clear_fis_btn = QPushButton (self .tr ('Clear ' ))
112+ # Clear (Default FIS) Button
113+ self .clear_fis_btn = QPushButton (self .tr ('Default FIS ' ))
113114 self .clear_fis_btn .clicked .connect (self .on_clear_fis_btn_pressed )
114115
115116 # Port Combobox
@@ -122,16 +123,22 @@ def __init__(self, parent: QWidget = None) -> None:
122123 self .refresh_btn = QPushButton (self .tr ('Refresh' ))
123124 self .refresh_btn .clicked .connect (self .on_refresh_btn_pressed )
124125
125- # Baudrate Combobox
126- self .baud_label = QLabel (self .tr ('Baud Rate:' ))
126+ # Current Baudrate Combobox
127+ self .baud_label = QLabel (self .tr ('Current Baud Rate:' ))
127128 self .baud_combobox = QComboBox ()
128129 self .baud_label .setBuddy (self .baud_combobox )
129- self .update_baud_rates ()
130+ self .update_baud_rates (self .baud_combobox )
131+
132+ # Update Baudrate Combobox
133+ self .update_baud_label = QLabel (self .tr ('Update Baud Rate:' ))
134+ self .update_baud_combobox = QComboBox ()
135+ self .update_baud_label .setBuddy (self .update_baud_combobox )
136+ self .update_baud_rates (self .update_baud_combobox , 115200 )
130137
131138 # Upload Button
132139 myFont = QFont ()
133140 myFont .setBold (True )
134- self .upload_btn = QPushButton (self .tr (' Update Firmware ' ))
141+ self .upload_btn = QPushButton (self .tr ('Update Firmware' ))
135142 self .upload_btn .setFont (myFont )
136143 self .upload_btn .clicked .connect (self .on_upload_btn_pressed )
137144
@@ -149,13 +156,17 @@ def __init__(self, parent: QWidget = None) -> None:
149156 self .training_btn .setChecked (True )
150157
151158 # Reset After Button
152- self .reset_btn = QCheckBox (self .tr ('Reset After' ))
159+ self .reset_btn = QCheckBox (self .tr ('Reset After Update ' ))
153160 self .reset_btn .setChecked (True )
154161
155162 # Chip Erase Button
156163 self .chip_erase_btn = QCheckBox (self .tr ('Chip Erase' ))
157164 self .chip_erase_btn .setChecked (False )
158165
166+ # No FIS Button
167+ self .no_fis_btn = QCheckBox (self .tr ('No FIS' ))
168+ self .no_fis_btn .setChecked (True )
169+
159170 # Override Button
160171 self .override_btn = QCheckBox (self .tr ('Override' ))
161172 self .override_btn .setChecked (False )
@@ -175,29 +186,33 @@ def __init__(self, parent: QWidget = None) -> None:
175186 layout .addWidget (self .firmware_label , 1 , 0 )
176187 layout .addWidget (self .firmwareLocation_lineedit , 1 , 1 )
177188 layout .addWidget (self .firmware_browse_btn , 1 , 2 )
189+ layout .addWidget (self .override_btn , 1 , 4 )
178190
179191 layout .addWidget (self .fis_label , 2 , 0 )
180192 layout .addWidget (self .fisLocation_lineedit , 2 , 1 )
181193 layout .addWidget (self .fis_browse_btn , 2 , 2 )
182194 layout .addWidget (self .clear_fis_btn , 2 , 3 )
195+ layout .addWidget (self .no_fis_btn , 2 , 4 )
183196
184197 layout .addWidget (self .port_label , 3 , 0 )
185198 layout .addWidget (self .port_combobox , 3 , 1 )
186199 layout .addWidget (self .refresh_btn , 3 , 2 )
200+ layout .addWidget (self .packet_dump_btn , 3 , 4 )
187201
188202 layout .addWidget (self .baud_label , 4 , 0 )
189203 layout .addWidget (self .baud_combobox , 4 , 1 )
190- layout .addWidget (self .upload_btn , 4 , 2 )
204+ layout .addWidget (self .safeboot_btn , 4 , 4 )
205+
206+ layout .addWidget (self .update_baud_label , 5 , 0 )
207+ layout .addWidget (self .update_baud_combobox , 5 , 1 )
208+ layout .addWidget (self .training_btn , 5 , 4 )
191209
192- layout .addWidget (self .packet_dump_btn , 4 , 3 )
193- layout .addWidget (self .safeboot_btn , 5 , 3 )
194- layout .addWidget (self .training_btn , 6 , 3 )
195- layout .addWidget (self .reset_btn , 7 , 3 )
196- layout .addWidget (self .chip_erase_btn , 8 , 3 )
197- layout .addWidget (self .override_btn , 9 , 3 )
210+ layout .addWidget (self .chip_erase_btn , 6 , 4 )
211+ layout .addWidget (self .reset_btn , 7 , 4 )
198212
199- layout .addWidget (self .messages_label , 9 , 0 )
200- layout .addWidget (self .messageBox , 10 , 0 , 5 , 4 )
213+ layout .addWidget (self .messages_label , 7 , 0 )
214+ layout .addWidget (self .upload_btn , 7 , 2 , 1 , 2 )
215+ layout .addWidget (self .messageBox , 8 , 0 , 5 , 5 )
201216
202217 self .setLayout (layout )
203218
@@ -249,20 +264,30 @@ def _load_settings(self) -> None:
249264 if index > - 1 :
250265 self .baud_combobox .setCurrentIndex (index )
251266
267+ baud = self .settings .value (SETTING_UPDATE_BAUD_RATE )
268+ if baud is not None :
269+ index = self .update_baud_combobox .findData (baud )
270+ if index > - 1 :
271+ self .update_baud_combobox .setCurrentIndex (index )
272+
252273 lastFile = self .settings .value (SETTING_FIRMWARE_LOCATION )
253274 if lastFile is not None :
254275 self .firmwareLocation_lineedit .setText (lastFile )
255276
256277 lastFile = self .settings .value (SETTING_FIS_LOCATION )
257278 if lastFile is not None :
258279 self .fisLocation_lineedit .setText (lastFile )
280+ if self .theFisName != '' :
281+ self .no_fis_btn .setChecked (False )
259282 else :
260283 self .fisLocation_lineedit .clear ()
284+ self .no_fis_btn .setChecked (True )
261285
262286 def _save_settings (self ) -> None :
263287 """Save settings on shutdown."""
264288 self .settings .setValue (SETTING_PORT_NAME , self .port )
265289 self .settings .setValue (SETTING_BAUD_RATE , self .baudRate )
290+ self .settings .setValue (SETTING_UPDATE_BAUD_RATE , self .updateBaudRate )
266291 self .settings .setValue (SETTING_FIRMWARE_LOCATION , self .theFirmwareName )
267292 self .settings .setValue (SETTING_FIS_LOCATION , self .theFisName )
268293
@@ -296,16 +321,19 @@ def update_com_ports(self) -> None:
296321 if indexOfPrevious > - 1 : # Restore the previous port if it still exists
297322 self .port_combobox .setCurrentIndex (indexOfPrevious )
298323
299- def update_baud_rates (self ) -> None :
324+ def update_baud_rates (self , comboBox , minBaud = 9600 ) -> None :
300325 """Update baud rate list in GUI."""
301326 # Lowest speed first so code defaults to that
302327 # if settings.value(SETTING_BAUD_RATE) is None
303- self .baud_combobox .clear ()
304- self .baud_combobox .addItem ("9600" , 9600 )
305- self .baud_combobox .addItem ("38400" , 38400 )
306- self .baud_combobox .addItem ("115200" , 115200 )
307- self .baud_combobox .addItem ("230400" , 230400 )
308- self .baud_combobox .addItem ("460800" , 460800 )
328+ comboBox .clear ()
329+ if minBaud <= 9600 :
330+ comboBox .addItem ("9600" , 9600 )
331+ if minBaud <= 38400 :
332+ comboBox .addItem ("38400" , 38400 )
333+ comboBox .addItem ("115200" , 115200 )
334+ comboBox .addItem ("230400" , 230400 )
335+ comboBox .addItem ("460800" , 460800 )
336+ comboBox .addItem ("921600" , 921600 )
309337
310338 @property
311339 def port (self ) -> str :
@@ -317,6 +345,11 @@ def baudRate(self) -> str:
317345 """Return the current baud rate."""
318346 return str (self .baud_combobox .currentData ())
319347
348+ @property
349+ def updateBaudRate (self ) -> str :
350+ """Return the update baud rate."""
351+ return str (self .update_baud_combobox .currentData ())
352+
320353 @property
321354 def theFirmwareName (self ) -> str :
322355 """Return the firmware file name."""
@@ -363,10 +396,12 @@ def on_browse_fis_btn_pressed(self) -> None:
363396 options = options )
364397 if fileName :
365398 self .fisLocation_lineedit .setText (fileName )
399+ self .no_fis_btn .setChecked (False )
366400
367401 def on_clear_fis_btn_pressed (self ) -> None :
368402 """Clear the FIS filename."""
369403 self .fisLocation_lineedit .clear ()
404+ self .no_fis_btn .setChecked (False )
370405
371406 def update_finished (self ) -> None :
372407 """The update QProcess has finished."""
@@ -495,16 +530,23 @@ def on_upload_btn_pressed(self) -> None:
495530 self .writeMessage ("\n Updating firmware\n " )
496531
497532 command = []
533+
498534 command .extend (["-p" ,self .port ])
499- command .extend (["-b" ,self .baudRate + ":" + self .baudRate + ":115200" ])
500- if self .fisLocation_lineedit .text () != '' :
501- command .extend (["-F" , self .theFisName ])
502- else :
535+
536+ command .extend (["-b" ,self .baudRate + ":" + self .baudRate + ":" + self .updateBaudRate ])
537+
538+ if self .no_fis_btn .isChecked () == True :
539+ command .extend (["--no-fis" , "1" ])
540+ elif self .fisLocation_lineedit .text () == '' :
503541 command .extend (["-F" , resource_path ("flash.xml" )])
542+ else :
543+ command .extend (["-F" , self .theFisName ])
544+
504545 if self .packet_dump_btn .isChecked () == True :
505546 command .extend (["-v" ,"2" ])
506547 else :
507548 command .extend (["-v" ,"1" ])
549+
508550 if self .safeboot_btn .isChecked () == True :
509551 command .extend (["-s" ,"1" ])
510552 if self .training_btn .isChecked () == True :
@@ -513,14 +555,17 @@ def on_upload_btn_pressed(self) -> None:
513555 command .extend (["-t" ,"0" ])
514556 else :
515557 command .extend (["-s" ,"0" ])
558+
516559 if self .reset_btn .isChecked () == True :
517560 command .extend (["-R" ,"1" ])
518561 else :
519562 command .extend (["-R" ,"0" ])
563+
520564 if self .chip_erase_btn .isChecked () == True :
521565 command .extend (["-C" ,"1" ])
522566 else :
523567 command .extend (["-C" ,"0" ])
568+
524569 command .append (self .theFirmwareName )
525570
526571 self .writeMessage ("ubxfwupdate.exe %s\n \n " % " " .join (command ))
0 commit comments