|
@@ -3,10 +3,15 @@
|
3
|
3
|
# Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo
|
4
|
4
|
#
|
5
|
5
|
Import("env")
|
6
|
|
-import os,requests,zipfile,tempfile,shutil
|
|
6
|
+import os,requests,zipfile,tempfile,shutil,pioutil
|
7
|
7
|
|
8
|
|
-url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip"
|
9
|
|
-zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip")
|
|
8
|
+# Detect that 'vscode init' is running
|
|
9
|
+if pioutil.is_vscode_init():
|
|
10
|
+ env.Exit(0)
|
|
11
|
+
|
|
12
|
+url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip"
|
|
13
|
+deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR")
|
|
14
|
+zip_path = os.path.join(deps_path, "mks-assets.zip")
|
10
|
15
|
assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
|
11
|
16
|
|
12
|
17
|
def download_mks_assets():
|
|
@@ -14,8 +19,8 @@ def download_mks_assets():
|
14
|
19
|
r = requests.get(url, stream=True)
|
15
|
20
|
# the user may have a very clean workspace,
|
16
|
21
|
# so create the PROJECT_LIBDEPS_DIR directory if not exits
|
17
|
|
- if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False:
|
18
|
|
- os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR"))
|
|
22
|
+ if os.path.exists(deps_path) == False:
|
|
23
|
+ os.mkdir(deps_path)
|
19
|
24
|
with open(zip_path, 'wb') as fd:
|
20
|
25
|
for chunk in r.iter_content(chunk_size=128):
|
21
|
26
|
fd.write(chunk)
|