|
@@ -14,7 +14,7 @@ Import("env")
|
14
|
14
|
# # Install heatshrink
|
15
|
15
|
# print("Installing 'heatshrink' python module...")
|
16
|
16
|
# env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink"))
|
17
|
|
-#
|
|
17
|
+#
|
18
|
18
|
# Not tested: If it's safe to install python libraries in PIO python try:
|
19
|
19
|
# env.Execute(env.subst("$PYTHONEXE -m pip install https://github.com/p3p/pyheatshrink/releases/download/0.3.3/pyheatshrink-pip.zip"))
|
20
|
20
|
|
|
@@ -92,7 +92,7 @@ def Upload(source, target, env):
|
92
|
92
|
raise Exception('Error getting firmware files')
|
93
|
93
|
if Debug: print('OK')
|
94
|
94
|
return Responses
|
95
|
|
-
|
|
95
|
+
|
96
|
96
|
def _FilterFirmwareFiles(FirmwareList):
|
97
|
97
|
Firmwares = []
|
98
|
98
|
for FWFile in FirmwareList:
|
|
@@ -185,7 +185,7 @@ def Upload(source, target, env):
|
185
|
185
|
if not marlin_custom_firmware_upload:
|
186
|
186
|
raise Exception(f"CUSTOM_FIRMWARE_UPLOAD must be enabled in 'Configuration_adv.h' for '{marlin_motherboard}'")
|
187
|
187
|
|
188
|
|
- # Generate a new 8.3 random filename
|
|
188
|
+ # Generate a new 8.3 random filename
|
189
|
189
|
# This board remember the last firmware filename and doesn't allow to flash from that filename
|
190
|
190
|
upload_firmware_target_name = f"fw-{''.join(random.choices('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=5))}.BIN"
|
191
|
191
|
print(f"Board {marlin_motherboard}: Overriding firmware filename to '{upload_firmware_target_name}'")
|
|
@@ -196,13 +196,13 @@ def Upload(source, target, env):
|
196
|
196
|
|
197
|
197
|
# Check SD card status
|
198
|
198
|
_CheckSDCard()
|
199
|
|
-
|
|
199
|
+
|
200
|
200
|
# Get firmware files
|
201
|
201
|
FirmwareFiles = _GetFirmwareFiles()
|
202
|
202
|
if Debug:
|
203
|
203
|
for FirmwareFile in FirmwareFiles:
|
204
|
204
|
print(f'Found: {FirmwareFile}')
|
205
|
|
-
|
|
205
|
+
|
206
|
206
|
# Get all 1st level firmware files (to remove)
|
207
|
207
|
OldFirmwareFiles = _FilterFirmwareFiles(FirmwareFiles[1:len(FirmwareFiles)-2]) # Skip header and footers of list
|
208
|
208
|
if len(OldFirmwareFiles) == 0:
|
|
@@ -220,7 +220,7 @@ def Upload(source, target, env):
|
220
|
220
|
if Debug: print('Cleanup completed')
|
221
|
221
|
|
222
|
222
|
# WARNING! The serial port must be closed here because the serial transfer that follow needs it!
|
223
|
|
-
|
|
223
|
+
|
224
|
224
|
# Upload firmware file
|
225
|
225
|
if Debug: print(f"Copy '{upload_firmware_source_name}' --> '{upload_firmware_target_name}'")
|
226
|
226
|
protocol = MarlinBinaryProtocol.Protocol(upload_port, upload_speed, upload_blocksize, float(upload_error_ratio), int(upload_timeout))
|