浏览代码

🎨 Followup to #23462

Scott Lahteine 3 年前
父节点
当前提交
08b6597471
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6
    6
      buildroot/share/scripts/upload.py

+ 6
- 6
buildroot/share/scripts/upload.py 查看文件

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

正在加载...
取消
保存