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.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM