不知道什么仙人设计的arduino连接网络部分,死活下不下来。(真的沙口,第一次看到这么抽风的下载口)
操作
给爷惹火了我踏马解析json选zip直接全部下下来
把这个大家的开发板管理地址下下来跟后面python放在同一目录下,下载下来的东西也都在一起
https://espressif.github.io/arduino-esp32/package_esp32_index.json
import json
import os.pathimport requests as requests
from contextlib import closingwith open('package_esp32_index.json') as f:metadata = json.load(f)def download_with_prigress(url, store_path):with closing(requests.get(url, stream=True)) as response:chunk_size = 1024 # 单次请求最大值content_size = int(response.headers['content-length']) # 内容体总大小data_count = 0with open(store_path, "wb") as file:for data in response.iter_content(chunk_size=chunk_size):file.write(data)data_count = data_count + len(data)now_jd = (data_count / content_size) * 100print("\r 文件下载进度:%d%%(%d/%d) - %s" % (now_jd, data_count, content_size, url), end=" ")print("\n")for platform in metadata['packages'][0]['platforms']:if platform['url'][-4:] == '.zip':url = platform['url']target_name = platform['archiveFileName']if os.path.exists(target_name):print('exist', target_name)else:print('downloading', url)download_with_prigress(url, target_name)for tool in metadata['packages'][0]['tools']:for system in tool['systems']:# if system_or_platform['host'] == 'x86_64-mingw32' or system_or_platform['host'] == 'i686-mingw32':if system['url'][-4:] == '.zip':url = system['url']target_name = system['archiveFileName']if os.path.exists(target_name):print('exist', target_name)else:print('downloading', url)download_with_prigress(url, target_name)
直接运行把这些下完的zip通通滚去这软件的默认下载暂存的地方,再arduino
C:\Users\xxxxxxx\AppData\Local\Arduino15\staging\packages
整个文件夹:下好的全zip、代码、元数据json
github其实连接很快的,防谁还抽风我直接传百度云了,有需自取
链接:https://pan.baidu.com/s/1O8yZFpKJAHDlx6HJhzOaPA
提取码:ud1c
废弃的分析过程不用管
有幸等了半天下下来了部分包,经过观察:某一个包报错请求的是这个文件:https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip
发现通过浏览器可以直接下载该文件
然后我们直接干去首选项要我们填入的地址:https://espressif.github.io/arduino-esp32/package_esp32_index.json,看看里面是什么东西:
https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip 同时发现和下的url的对应关系,于是就可以拼接了,可以一个一个拼url把它下载,但是懒,试试url
https://github.com/espressif/crosstool-NG/releases
可以访问,再找到版本,发现对应列表在,检验发现list中文件url和上面报错要下载的是一样的,可以依此类推,但是好像还有些文件是不行的
https://github.com/espressif/crosstool-NG/releases/tag/esp-2021r2-patch5
本地的位置经过搜索得到:C:\Users\xxxxxxx\AppData\Local\Arduino15\staging\packages
把zip放到这个文件夹下就行了,然后再运行原来arduino包管理的ESP32的点击安装