@@ -157,14 +157,14 @@ def _RollbackUpload(FirmwareFile):
157
157
marlin_string_config_h_author = _GetMarlinEnv (MarlinEnv , 'STRING_CONFIG_H_AUTHOR' )
158
158
159
159
# 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 ])
161
161
# Source firmware filename
162
162
upload_speed = env ['UPLOAD_SPEED' ] if 'UPLOAD_SPEED' in env else 115200
163
163
# baud rate of serial connection
164
164
upload_port = _GetUploadPort (env ) # Serial port to use
165
165
166
166
# 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 )
168
168
# Target firmware filename
169
169
upload_timeout = 1000 # Communication timout, lossy/slow connections need higher values
170
170
upload_blocksize = 512 # Transfer block size. 512 = Autodetect
@@ -216,7 +216,7 @@ def _RollbackUpload(FirmwareFile):
216
216
print (f' LONG_FILENAME_WRITE_SUPPORT : { marlin_longname_write } ' )
217
217
print (f' CUSTOM_FIRMWARE_UPLOAD : { marlin_custom_firmware_upload } ' )
218
218
print ('---- Upload parameters ------------------------' )
219
- print (f' Source : { upload_firmware_source_name } ' )
219
+ print (f' Source : { upload_firmware_source_path } ' )
220
220
print (f' Target : { upload_firmware_target_name } ' )
221
221
print (f' Port : { upload_port } @ { upload_speed } baudrate' )
222
222
print (f' Timeout : { upload_timeout } ' )
@@ -271,14 +271,14 @@ def _RollbackUpload(FirmwareFile):
271
271
# WARNING! The serial port must be closed here because the serial transfer that follow needs it!
272
272
273
273
# 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 } '" )
275
275
protocol = MarlinBinaryProtocol .Protocol (upload_port , upload_speed , upload_blocksize , float (upload_error_ratio ), int (upload_timeout ))
276
276
#echologger = MarlinBinaryProtocol.EchoProtocol(protocol)
277
277
protocol .connect ()
278
278
# Mark the rollback (delete broken transfer) from this point on
279
279
rollback = True
280
280
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 )
282
282
protocol .disconnect ()
283
283
284
284
# Notify upload completed
0 commit comments