@@ -266,7 +266,7 @@ def on_worker_callback(self, *args): #msg_type, arg):
266266 elif msg_type == AUxWorker .TYPE_FINISHED :
267267 # finished takes 3 args - status, job type, and job id
268268 if len (args ) < 4 :
269- self .writeMessage ("Invalid parameters from the uploader." );
269+ self .writeMessage ("Invalid parameters from the uploader." )
270270 return ;
271271
272272 self .sig_finished .emit (args [1 ], args [2 ], args [3 ])
@@ -635,33 +635,46 @@ def do_upload(self) -> None:
635635 else :
636636 self .writeMessage ("Flash size is " + str (self .flashSize ) + "MB\n " )
637637
638- thePartitionFileName = ''
638+ thePartitionFileName = resource_path ( "RTK_Surveyor_Partitions_16MB.bin" )
639639 firmwareSizeCorrect = True
640- if self .flashSize == 16 :
641- thePartitionFileName = resource_path ("RTK_Surveyor_Partitions_16MB.bin" )
642- # if self.theFileName.find("16MB") < 0:
643- # firmwareSizeCorrect = False
644- else :
640+ if self .flashSize == 16 : # Could be RTK Firmware or RTK Everywhere
641+ pass # Nothing to do
642+ elif self .flashSize == 8 : # RTK Postcard (ESP32 Pico Mini)
643+ thePartitionFileName = resource_path ("RTK_Everywhere_Partitions_8MB.bin" )
644+ if self .theFileName .find ("RTK_Everywhere_Firmware" ) < 0 :
645+ self .writeMessage ("Flash size is 8MB. RTK Everywhere Firmware not detected\n " )
646+ firmwareSizeCorrect = False
647+ elif self .flashSize == 4 : # Original RTK Surveyor
645648 thePartitionFileName = resource_path ("RTK_Surveyor_Partitions_4MB.bin" )
646- # if self.theFileName.find("4MB") < 0:
647- # firmwareSizeCorrect = False
649+ if self .theFileName .find ("RTK_Surveyor_Firmware" ) < 0 :
650+ self .writeMessage ("Flash size is 4MB. RTK Surveyor Firmware not detected\n " )
651+ firmwareSizeCorrect = False
652+ else :
653+ firmwareSizeCorrect = False
648654
649655 if firmwareSizeCorrect == False :
650- reply = QMessageBox .warning (self , "Firmware size mismatch" , "Do you want to continue?" , QMessageBox .Yes | QMessageBox .No , QMessageBox .No )
656+ reply = QMessageBox .warning (self , "Firmware and flash size mismatch" , "Do you want to continue?" , QMessageBox .Yes | QMessageBox .No , QMessageBox .No )
651657 if reply == QMessageBox .No :
652658 self .disable_interface (False )
653659 return
654660
655- sleep (1.0 );
661+ theBootloaderFileName = resource_path ("RTK_Surveyor.ino.bootloader.bin" )
662+ if self .theFileName .find ("RTK_Everywhere_Firmware" ) >= 0 :
663+ theBootloaderFileName = resource_path ("RTK_Everywhere.ino.bootloader.bin" )
664+ self .writeMessage ("RTK Everywhere Firmware detected. Using RTK_Everywhere.ino.bootloader.bin\n " )
665+ else :
666+ self .writeMessage ("Using RTK_Surveyor.ino.bootloader.bin\n " )
667+
668+ sleep (1.0 )
656669 self .writeMessage ("Uploading firmware\n " )
657670
658671 baud = self .baudRate
659672 if baud == "921600" :
660673 if (platform .system () == "Darwin" ): # 921600 fails on MacOS
661674 self .writeMessage ("MacOS detected. Limiting baud to 460800\n " )
662675 baud = "460800"
663- if (str (self .port_combobox .currentText ()).find ("CH342" ) >= 0 ): # 921600 fails on CH342
664- self .writeMessage ("CH342 detected. Limiting baud to 460800\n " )
676+ if (( str (self .port_combobox .currentText ()).find ("CH342" ) >= 0 ) and ( self . flashSize == 16 )) : # 921600 fails on CH342 + 16MB ESP32 (ie, RTK Torch)
677+ self .writeMessage ("RTK Torch detected. Limiting baud to 460800\n " )
665678 baud = "460800"
666679
667680 command = []
@@ -670,7 +683,7 @@ def do_upload(self) -> None:
670683 command .extend (["--port" ,self .port ])
671684 command .extend (["--baud" ,baud ])
672685 command .extend (["--before" ,"default_reset" ,"--after" ,"no_reset" ,"write_flash" ,"-z" ,"--flash_mode" ,"dio" ,"--flash_freq" ,"80m" ,"--flash_size" ,"detect" ])
673- command .extend (["0x1000" ,resource_path ( "RTK_Surveyor.ino.bootloader.bin" ) ])
686+ command .extend (["0x1000" ,theBootloaderFileName ])
674687 command .extend (["0x8000" ,thePartitionFileName ])
675688 command .extend (["0xe000" ,resource_path ("boot_app0.bin" )])
676689 command .extend (["0x10000" ,self .theFileName ])
@@ -704,7 +717,7 @@ def esptool_reset(self) -> None:
704717 except :
705718 pass
706719
707- sleep (1.0 );
720+ sleep (1.0 )
708721 self .writeMessage ("Resetting ESP32\n " )
709722
710723 # ---- The esptool method -----
0 commit comments