@@ -157,14 +157,14 @@ def _RollbackUpload(FirmwareFile):
157157 marlin_string_config_h_author = _GetMarlinEnv (MarlinEnv , 'STRING_CONFIG_H_AUTHOR' )
158158
159159 # Get firmware upload params
160- upload_firmware_source_name = env ['PROGNAME' ] + ' .bin' if 'PROGNAME' in env else str (source [0 ])
160+ upload_firmware_source_path = os . path . join ( env ["PROJECT_BUILD_DIR" ], env [ "PIOENV" ], f" { env [ 'PROGNAME' ] } .bin" ) if 'PROGNAME' in env else str (source [0 ])
161161 # Source firmware filename
162162 upload_speed = env ['UPLOAD_SPEED' ] if 'UPLOAD_SPEED' in env else 115200
163163 # baud rate of serial connection
164164 upload_port = _GetUploadPort (env ) # Serial port to use
165165
166166 # Set local upload params
167- upload_firmware_target_name = os .path .basename (upload_firmware_source_name )
167+ upload_firmware_target_name = os .path .basename (upload_firmware_source_path )
168168 # Target firmware filename
169169 upload_timeout = 1000 # Communication timout, lossy/slow connections need higher values
170170 upload_blocksize = 512 # Transfer block size. 512 = Autodetect
@@ -216,7 +216,7 @@ def _RollbackUpload(FirmwareFile):
216216 print (f' LONG_FILENAME_WRITE_SUPPORT : { marlin_longname_write } ' )
217217 print (f' CUSTOM_FIRMWARE_UPLOAD : { marlin_custom_firmware_upload } ' )
218218 print ('---- Upload parameters ------------------------' )
219- print (f' Source : { upload_firmware_source_name } ' )
219+ print (f' Source : { upload_firmware_source_path } ' )
220220 print (f' Target : { upload_firmware_target_name } ' )
221221 print (f' Port : { upload_port } @ { upload_speed } baudrate' )
222222 print (f' Timeout : { upload_timeout } ' )
@@ -271,14 +271,14 @@ def _RollbackUpload(FirmwareFile):
271271 # WARNING! The serial port must be closed here because the serial transfer that follow needs it!
272272
273273 # Upload firmware file
274- debugPrint (f"Copy '{ upload_firmware_source_name } ' --> '{ upload_firmware_target_name } '" )
274+ debugPrint (f"Copy '{ upload_firmware_source_path } ' --> '{ upload_firmware_target_name } '" )
275275 protocol = MarlinBinaryProtocol .Protocol (upload_port , upload_speed , upload_blocksize , float (upload_error_ratio ), int (upload_timeout ))
276276 #echologger = MarlinBinaryProtocol.EchoProtocol(protocol)
277277 protocol .connect ()
278278 # Mark the rollback (delete broken transfer) from this point on
279279 rollback = True
280280 filetransfer = MarlinBinaryProtocol .FileTransferProtocol (protocol )
281- transferOK = filetransfer .copy (upload_firmware_source_name , upload_firmware_target_name , upload_compression , upload_test )
281+ transferOK = filetransfer .copy (upload_firmware_source_path , upload_firmware_target_name , upload_compression , upload_test )
282282 protocol .disconnect ()
283283
284284 # Notify upload completed
0 commit comments