ESP8266莫名重启或者死机问题

多半是内存使用不当

   1. 如果你要用很大长度的数组,那么可以换用更小的数据类型。比如,int值要占用两个字节,你可以用byte(只占用一个字节)代替;
    2. esp8266有时会莫明重启,大部分情况是变量设置不当,虽然编译通过了,但变量在调用过程中出现异常,造成函数运行时变量内存溢出,写复杂代码时,
       最好是不要一次写了很多再编译调试。
    3. 尽量少用全局变量,全局变量在整个生命周期都会存在,非常耗内存,内存不足也是esp8266不稳定因素之一。长串的变量尽量作长度控制,设定边界,如果你的项目很大,一定要规划好变量。
    4. 尽量不要在loop循环中定义变量,尽量只放函数封装,貌似这里定义了变量不会像函数中的局变量用完就回收。

  5.The ESP8266 requires a good power supply as it produces current spikes of up to 170 mA during transmit (typical average consumption is around 70 mA when WiFi is on). Check the power supply first, if your ESP runs unstable, has a bad throughput, or reboots from time to time. A large capacitor between Vdd and Gnd can help if you experience problems here. It has been reported that there are sometimes severe throughput problems with the small power supply/serial-to-usb boards for the ESP01. These boards use an XC6206 voltage regulator labeled "662K". Maybe you try an alternative power supply first, if you experience these kind of problems.

 

posted @ 2019-01-08 15:49  半夏生  阅读(6533)  评论(0编辑  收藏  举报