• Arduino中安装ESP32网络抽风无法下载 暴力解决办法 python


    不知道什么仙人设计的arduino连接网络部分,死活下不下来。(真的沙口,第一次看到这么抽风的下载口)

    操作

    给爷惹火了我踏马解析json选zip直接全部下下来
    把这个大家的开发板管理地址下下来跟后面python放在同一目录下,下载下来的东西也都在一起
    https://espressif.github.io/arduino-esp32/package_esp32_index.json

    import json
    import os.path
    
    import requests as requests
    from contextlib import closing
    
    with 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 = 0
            with 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) * 100
                    print("\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)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44

    直接运行把这些下完的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的点击安装

  • 相关阅读:
    ECCV2022|时尚领域的多模态预训练预训练模型FashionViL,在五个下游任务中SOTA!
    创业教学信息管理系统
    图论与网络模型——基于R
    进程间通信(管道/消息队列/共享内存/信号量)
    书签收藏难整理?这款书签工具管理超方便
    FSK/OOK 调制单发射芯片CMT2119A-ESR/CMT2119B-EQR
    算法与数据结构介绍
    Go Context 原理详解
    你和时间管理大师,就差一个开源工具「GitHub 热点速览」
    《痞子衡嵌入式半月刊》 第 55 期
  • 原文地址:https://blog.csdn.net/violet_ever_garden/article/details/136278282