完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我对 esp8266 和微控制器世界很陌生,它非常有趣,即使它可能有点令人沮丧。
我目前正在开发一个简单的程序,该程序转到 coingecko api 并获取加密历史价格以使用 tft_espi 库在 TFT 显示器上绘制图表。 一切都很好,但是看门狗会随机重置我的 esp(总是在执行相同的 http.get 时)但在不同的时间(不要认为它的内存,因为我正在检查)。 我尝试过的事情:在任何地方添加 yield()(或者只是在需要很长时间的地方前面)改变了电缆改变了 esp8266(我改变了两次)我经常检查免费堆内存以确保我没有用完。 有人有什么建议吗? 不要对代码中 Serial.println() 的数量感到惊讶,我曾试图找到它消失的地方。 代码:全选void getChartDataFromApi(String ids, String vs_curry, String days, String interval){ Serial.println("started sh*t method"); if(WiFi.status() == WL_CONNECTED){ String host = "https://api.coingecko.com/api/v3/coins/" + ids + "/market_chart?vs_currency=" + vs_curry + "&days=" + days + "&interval=" + interval; WiFiClientSecure chartClient; HTTPClient chartHttp; Serial.println("Setup 1"); chartClient.setinsecure(); //the magic line, use with caution chartClient.connect(host, 443); Serial.println("After client connect"); //chartClient.setTimeout(10); chartHttp.begin(chartClient, host); chartHttp.useHTTP10(true); Serial.println("After http begin"); //chartHttp.setTimeout(10); Serial.print("free memory before get: "); Serial.println(ESP.getFreeHeap(),DEC); yield(); int http_code = chartHttp.GET(); Serial.print("free memory after get: "); Serial.println(ESP.getFreeHeap(),DEC); Serial.println("http code: " || String(http_code)); if (http_code == HTTP_CODE_OK){ Serial.println("after get"); DynamicJsonDocument filter(16); filter["prices"] = true; DynamicJsonDocument doc(1024); Serial.println("after creation of doc"); DeserializationError error = deserializeJson(doc, chartHttp.getStream(), DeserializationOption::Filter(filter)); Serial.println("after deserialization"); if (error) { Serial.print(F("deserializeJson() failed: ")); Serial.println(error.f_str()); return; } Serial.println("after error if"); JsonArray prices = doc["prices"]; Serial.println("Saving prices"); //todo make this better(don't judge this is temporary) currentChartPrices[0] = prices[0][1].as(); // 16422.562273279298 currentChartPrices[1] = prices[1][1].as(); // 16899.331969046758 currentChartPrices[2] = prices[2][1].as(); // 16816.85370118997 currentChartPrices[3] = prices[3][1].as(); // 16824.790162441503 currentChartPrices[4] = prices[4][1].as(); // 16791.45543916491 currentChartPrices[5] = prices[5][1].as(); // 16848.568708323422 currentChartPrices[6] = prices[6][1].as(); // 16842.177039905502 currentChartPrices[7] = prices[7][1].as(); // 16838.576336989227 Serial.println("after saving prices"); chartHttp.end(); chartClient.stop(); filter.clear(); doc.clear(); Serial.println("after closing everything"); } else{ Serial.println("Failed to get chart api data"); delay(300); } } Serial.println("outside of if"); } 堆栈跟踪已解码,包括显示重要信息的最后几个 serial.println: 代码:全选 Free Memory after chart data: 43056 Y: 116 X: 0 X: 46.00 Y: 120.00 Price: 16899.33 X: 77.00 Y: 196.46 Price: 16816.85 X: 108.00 Y: 189.10 Price: 16824.79 X: 139.00 Y: 220.00 Price: 16791.46 X: 170.00 Y: 167.06 Price: 16848.57 X: 201.00 Y: 172.98 Price: 16842.18 X: 232.00 Y: 123.32 Price: 16895.75 Loopcounter: 5 Free Memory: 43384 Symbol: btc Price: 16957.33 Change: 0.71 Free Memory before chart data: 43384 started sh*t method Setup 1 After client connect After http begin free memory before get: 36648 free memory after get: 15112 1 after get after creation of doc after deserialization after error if Saving prices after saving prices after closing everything outside of if Price: 16899.33 Price: 16816.85 Price: 16824.79 Price: 16791.46 Price: 16848.57 Price: 16842.18 Price: 16895.75 Free Memory after chart data: 43056 Y: 116 X: 0 X: 46.00 Y: 120.00 Price: 16899.33 X: 77.00 Y: 196.46 Price: 16816.85 X: 108.00 Y: 189.10 Price: 16824.79 X: 139.00 Y: 220.00 Price: 16791.46 X: 170.00 Y: 167.06 Price: 16848.57 X: 201.00 Y: 172.98 Price: 16842.18 X: 232.00 Y: 123.32 Price: 16895.75 Loopcounter: 6 Free Memory: 43384 Symbol: btc Price: 16957.33 Change: 0.71 Free Memory before chart data: 43384 started sh*t method Setup 1 After client connect After http begin free memory before get: 36648 --------------- CUT HERE FOR EXCEPTION DECODER --------------- Soft WDT reset 0x40100571 in millis at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_wiring.cpp:188 0x40100555 in millis at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_wiring.cpp:185 0x40223d56 in optimistic_yield at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:150 (discriminator 1) 0x40217538 in esp8266::polledTimeout::timeoutTemplate >::checkExpired(unsigned long) const at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/PolledTimeout.h:238 (inlined by) esp8266::polledTimeout::timeoutTemplate >::expiredOneShot() const at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/PolledTimeout.h:263 (inlined by) esp8266::polledTimeout::timeoutTemplate >::expired() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/PolledTimeout.h:163 (inlined by) esp8266::polledTimeout::timeoutTemplate >::operator bool() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/PolledTimeout.h:169 (inlined by) BearSSL::WiFiClientSecureCtx::_run_until(unsigned int, bool) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp:468 0x40249e2a in br_ssl_engine_hs_reset at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/ssl/bearssl/src/ssl/ssl_engine.c:1320 0x40217678 in BearSSL::WiFiClientSecureCtx::_wait_for_handshake() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp:585 0x402179bd in BearSSL::WiFiClientSecureCtx::_connectSSL(char const*) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp:1170 0x402433bf in ip_chksum_pseudo at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/inet_chksum.c:395 0x4023ea2e in tcp_output at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/tcp_out.c:1361 0x4010601d in ets_timer_arm_new at ??:? 0x4022463a in __delay at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_wiring.cpp:54 0x40215c9a in ClientContext::connect(ip4_addr*, unsigned short) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/include/ClientContext.h:148 (inlined by) WiFiClient::connect(IPAddress, unsigned short) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClient.cpp:162 0x40217b4c in BearSSL::WiFiClientSecureCtx::connect(char const*, unsigned short) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp:232 0x40233140 in std::function::function(std::function const&) at ??:? 0x40233140 in std::function::function(std::function const&) at ??:? 0x40230c8e in BearSSL::WiFiClientSecure::connect(char const*, unsigned short) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:245 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x4021f02f in HTTPClient::connect() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.cpp:867 0x40224645 in __delay at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_wiring.cpp:57 0x4021fa83 in HTTPClient::sendRequest(char const*, unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.cpp:436 0x402265ad in uart_write at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/uart.cpp:544 0x402265ad in uart_write at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/uart.cpp:544 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x402206f4 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:194 0x40100458 in ets_post at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:181 0x4021fc4e in HTTPClient::GET() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.cpp:356 0x4020bc03 in getChartDataFromApi(String, String, String, String) at src/main.cpp:370 0x40240fd8 in etharp_output_LWIP2 at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/ipv4/etharp.c:885 0x402427d0 in ip4_output_if_opt_src at /home/earle/src/esp-quick-toolchain/arduino/tools/sdk/lwip2/builder/lwip2-src/src/core/ipv4/ip4.c:1765 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40100d5d in malloc at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:821 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40100d26 in free at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:595 0x4023aa28 in operator delete(void*) at /workdir/repo/gcc-gnu/libstdc++-v3/libsupc++/del_op.cc:50 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40100d26 in free at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:595 0x402220f4 in String::init() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:289 (inlined by) String::invalidate() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.cpp:147 0x4020d9d8 in getPriceFromAPI(String, String) at src/main.cpp:302 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40220073 in EspClass::flashWrite(unsigned int, unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Esp.cpp:884 0x402265ad in uart_write at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/uart.cpp:544 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x402206f4 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:194 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x40221718 in Print::write(char const*) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Print.h:59 (inlined by) unsigned int Print::printNumber(unsigned long, unsigned char) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Print.cpp:264 0x40232b30 in std::function::function(std::function const&) at ??:? 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x402206f4 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:194 0x402206e8 in HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/HardwareSerial.h:191 0x402223e9 in String::copy(char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.cpp:226 0x4020fbb3 in String::~String() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:79 (inlined by) loop at src/main.cpp:731 0x401032ec in wDev_ProcessFiq at ??:? 0x40210da4 in TFT_eSPI::drawChar(unsigned short, int, int, unsigned char) at .pio\libdeps\d1_mini\TFT_eSPI/TFT_eSPI.cpp:4624 0x40222880 in String::isSSO() const at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:262 (inlined by) String::setLen(int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:267 (inlined by) String::concat(char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.cpp:309 0x40100b39 in umm_free_core at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:549 0x40213d00 in TFT_eSPI::drawString(char const*, int, int, unsigned char) at .pio\libdeps\d1_mini\TFT_eSPI/TFT_eSPI.cpp:5066 0x40213d00 in TFT_eSPI::drawString(char const*, int, int, unsigned char) at .pio\libdeps\d1_mini\TFT_eSPI/TFT_eSPI.cpp:5066 0x402265ad in uart_write at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/uart.cpp:544 0x40220031 in EspClass::flashWrite(unsigned int, unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Esp.cpp:834 0x40220031 in EspClass::flashWrite(unsigned int, unsigned char const*, unsigned int) at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Esp.cpp:834 0x40223da2 in loop_wrapper() at C:\Users\Sadfiesch\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:201 |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
523浏览 6评论
433浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
421浏览 5评论
413浏览 4评论
387浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-1 04:44 , Processed in 0.598655 second(s), Total 72, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号