完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我设法让基本的 OTA 示例代码在带有自定义分线板的 ESP-07 上运行,并且我可以轻松地通过我们的本地网络刷新我自己的固件。然后我尝试将代码刷写到其他一些板上,但我没有成功。固件的其余部分工作 - 我正在使用 MQTT 传输传感器数据,因此我可以连接到我们的 WiFi 和 MQTT 代理等。OTA 不起作用。
我正在使用 platformio,我的 ini 是: 代码:全选[env:esp07] platform = espressif8266 board = esp07 framework = arduino upload_port = COM16 upload_speed = 115200 build_flags = -Wl,-Tesp8266.flash.1m64.ld monitor_port = COM16 monitor_baud = 115200 OTA 设置代码如下。其余代码有效,所以我认为问题出在这里: 代码:全选void configure_OTA() { /** OTA CONFIG **/ ArduinoOTA.onStart([]() { String type; if (ArduinoOTA.getCommand() == U_FLASH) type = "sketch"; else // U_SPIFFS type = "filesystem"; // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end() Serial.println("Start updating " + type); }); ArduinoOTA.onEnd([]() { Serial.println("nEnd"); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { Serial.printf("Progress: %u%%r", (progress / (total / 100))); }); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); else if (error == OTA_END_ERROR) Serial.println("End Failed"); }); // Should be default, but let's be explicit. String chip_id = String(system_get_chip_id()); String hostname = "sensor_" + chip_id; ArduinoOTA.setHostname(hostname.c_str()); ArduinoOTA.setPassword("my_password"); ArduinoOTA.setPort(8266); ArduinoOTA.begin(); Serial.println("OTA setup"); /** OTA CONFIG **/ } 这不起作用,即使使用 Basic OTA 示例也是如此。芯片在启动时输出如下内容: 代码:全选Chip ID:4266305 Connecting.......Ready IP address: 192.168.1.6 4266305: Trying to connect to MQQT Broker 4266305: Connected to MQTT Broker |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
944 浏览 0 评论
1671 浏览 0 评论
请问一下我想用ESP8685直接替换ESP8266而不用写程序,可以让ESP8685直接通过之前ESP8266的外挂的flash运行程序吗
1330 浏览 1 评论
1233 浏览 1 评论
5015 浏览 2 评论
为blufi_device设置自定义名称,但是无法修改,为什么?
1250浏览 4评论
请问ESP32-S2-WROOM怎么获得ESP32-S2外接FLASH的唯一序列号?
927浏览 3评论
2329浏览 3评论
ESP-IDF的VScode插件的build按钮点击会报错的原因?
2525浏览 3评论
ESP-Jumpstart例程中第5个工程:5_cloud连接报错是哪里的问题?
1051浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 19:44 , Processed in 0.591429 second(s), Total 67, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
11763
