查看: 245|回复: 4

[未解决] ESP8266 Exception (28)

[复制链接]

该用户从未签到

发表于 2019-8-15 22:15 | 显示全部楼层 |阅读模式
使用ESP8266,定义了String数组 44个元素,程序中就是给这个数组反复赋值。执行过程中使用ESP.getFreeHeap()观察内存越来越少,最后出现如下报错,ESP8266重新启动,不知道是什么问题?不知ESP8266有没有内存清理的函数?




Exception (28):
epc1=0x402144fa epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffba0 end: 3fffffc0 offset: 01a0
3ffffd40:  0000002d 000000c8 3ffffe5c 4020d624  
3ffffd50:  3ffffd70 000000c8 3ffffe8c 4020d6ae  
3ffffd60:  0000002d 000000c8 00001a90 40207b23  
3ffffd70:  3035223d 6c612022 3d6e6769 6e656322  
3ffffd80:  22726574 6c617620 3d6e6769 64696d22  
3ffffd90:  22656c64 70733c3e 63206e61 7373616c  
3ffffda0:  6174223d 66656c62 22746e6f 8b8ee53e  
3ffffdb0:  e6a9bce7 83e7ba9c 9dbfe4ad e5a48ae6  
3ffffdc0:  2f3ca899 6e617073 742f3c3e 0a0d3e64  
3ffffdd0:  20202020 20202020 20202020 2064743c  
3ffffde0:  67696568 223d7468 20223035 67696c61  
3ffffdf0:  63223d6e 65746e65 76202272 67696c61  
3ffffe00:  6d223d6e 6c646469 3c3e2265 6e617073  
3ffffe10:  616c6320 223d7373 6c626174 6e6f6665  
3ffffe20:  253e2274 3c253032 6170732f 2f3c3e6e  
3ffffe30:  0d3e6474 2020200a 00000000 3fff4e74  
3ffffe40:  00000010 4020fa40 00000000 000003e8  
3ffffe50:  3ffe85a7 3fffa784 3fffb014 00000000  
3ffffe60:  00000000 00000000 00000000 00000000  
3ffffe70:  00000000 00000000 00000000 00000000  
3ffffe80:  00000000 00000000 00000000 3fffb5c4  
3ffffe90:  000000cf 00000000 00000b8c 401005c0  
3ffffea0:  00000001 00000001 3ffffee0 4020afb4  
3ffffeb0:  00000001 00000001 3fffa94c 4020f272  
3ffffec0:  ffffffff 3fffc6fc 3fffa94c 4020afaa  
3ffffed0:  3fffa94c 3fff4bb8 3fffff00 4020afe6  
3ffffee0:  00000000 00000000 00000000 4020d694  
3ffffef0:  3fffa94c 3fff4bb8 3fff4b74 4020b06d  
3fffff00:  3fffb14c 0000000f 00000001 00000000  
3fffff10:  00000000 3fff4dec 401001c0 00019274  
3fffff20:  3fff4bb8 00000001 3ffe8508 3fff4b9c  
3fffff30:  00000001 00000000 00000000 0000000e  
3fffff40:  00000000 3fffb75c 3fff4b74 3fff4dec  
3fffff50:  00000001 3fff4b9c 3fff4b74 4020b2c4  
3fffff60:  4020f970 00000000 00001388 4020e293  
3fffff70:  00000000 3fffb75c 3fffa79c 4020776a  
3fffff80:  3fffdad0 00000000 3fff4dbc 40208f64  
3fffff90:  00000000 00000000 00000001 40207787  
3fffffa0:  3fffdad0 00000000 3fff4dbc 4020e0c8  
3fffffb0:  feefeffe feefeffe 3ffe8508 40100a61  
<<<stack<<<

last failed alloc call: 4020D4E7(208)


  • TA的每日心情

    2019-8-21 09:01
  • 签到天数: 7 天

    [LV.3]偶尔看看II

    发表于 2019-8-16 10:21 | 显示全部楼层
    谁看的懂你的呀啊啊啊啊啊啊啊
  • TA的每日心情
    开心
    2019-8-14 08:23
  • 签到天数: 740 天

    [LV.9]以坛为家II

    发表于 2019-8-16 11:48 | 显示全部楼层
    一般这种问题都是内存分配不足了 或者你哪里抛异常了
    打赏作者鼓励一下!

    该用户从未签到

     楼主| 发表于 2019-8-17 22:45 | 显示全部楼层
    单片机菜鸟 发表于 2019-8-16 11:48
    一般这种问题都是内存分配不足了 或者你哪里抛异常了

    我程序中没有抛出异常,现在是开始内存开始够用,但越来越小,不知道有没内存清理的API函数?

    该用户从未签到

     楼主| 发表于 2019-8-17 22:47 | 显示全部楼层
    这里是程序代码

    void handleRoot()
    {
      char buffer[500];
      unsigned short BeginPos,EndPos,len;
      String htmlPage;
      String parameter[44];

      Serial.println("Enter:" + String(ESP.getFreeHeap()) +"--" + String(ESP.getHeapFragmentation()));

    //模式
      if ( RunState.SetMode == CoolMode )
        parameter[0] = F("制冷");
      else if ( RunState.SetMode == VentMode )
        parameter[0] = F("通风");
      else if ( RunState.SetMode == DryMode )
        parameter[0] = F("除湿");
      else if ( RunState.SetMode == HeatMode )
        parameter[0] = F("制热");
      else
        parameter[0] = F("关机");

    //风速
      if ( RunState.SetFanSpeed == InLowFan )
        parameter[1] = F("低速风");
      else if ( RunState.SetFanSpeed == InMidFan )
        parameter[1] = F("中速风");
      else if ( RunState.SetFanSpeed == InHighFan )
        parameter[1] = F("高速风");
      else if ( RunState.SetFanSpeed == InSuperFan )
        parameter[1] = F("强力风");
      else if ( RunState.SetFanSpeed == InAutoFan )
        parameter[1] = F("自动风");
      else
        parameter[1] = F("停风");

      //设定温度
      parameter[2] = String(RunState.SetTemp);

      //温度
      parameter[3] = String(RunState.OutAmbientTemp);
      parameter[4] = String(RunState.CondenserTemp);
      parameter[5] = String(RunState.ExhaustTemp);
      parameter[6] = String(RunState.RadiatorTemp);
      parameter[7] = String(RunState.InAmbientTemp);
      parameter[8] = String(RunState.EvaporatorTemp);

      //压缩机
      parameter[9] = String(RunState.MCRunFreq);
      parameter[10] = String(RunState.MCTargetFreq);
      parameter[11] = String(RunState.OutAmbientTempLevel);
      parameter[12] = String(RunState.RunLevel);
      parameter[13] = String(RunState.Power);
      parameter[14] = String(RunState.Voltage);

      //零部件
      parameter[15] = String(RunState.OutDCFanSpeed);

      if ( RunState.OutFanSpeed == OutLowFan )
        parameter[16] = F("低速风");
      else if ( RunState.OutFanSpeed == OutHighFan )
        parameter[16] = F("高速风");
      else
        parameter[16] = F("停风");

      if ( RunState.YV )
        parameter[17] = F("开");
      else
        parameter[17] = F("关");

      if ( RunState.Valve )
        parameter[18] = F("开");
      else
        parameter[18] = F("关");

      if ( RunState.MCShellOpen )
        parameter[19] = F("开");
      else
        parameter[19] = F("关");

      if ( RunState.DCPowerRelay )
        parameter[20] = F("开");
      else
        parameter[20] = F("关");

      if ( RunState.PFCWork )
        parameter[21] = F("开");
      else
        parameter[21] = F("关");

      //保护
      //排气温度保护
      if ( RunState.ExhaustNotRaiseLevel )
            parameter[22] = F("checked");
      else
            parameter[22] = F("");

      if ( RunState.ExhaustFallLevel )
            parameter[23] = F("checked");
      else
            parameter[23] = F("");

      if ( RunState.ExhaustProtect )
            parameter[24] = F("checked");
      else
            parameter[24] = F("");

      parameter[25] = String(RunState.ExhaustLevel);

      //制冷冷凝器温度保护
      if ( RunState.CondenserTempNotRaiseLevel )
            parameter[26] = F("checked");
      else
            parameter[26] = F("");

      if ( RunState.CondenserTempFallLevel )
            parameter[27] = F("checked");
      else
            parameter[27] = F("");

      if ( RunState.CondenserTempProtect )
            parameter[28] = F("checked");
      else
            parameter[28] = F("");

      parameter[29] = String(RunState.CondenserTempLevel);

      //制冷防冻结保护
      if ( RunState.FreezeNotRaiseLevel )
            parameter[30] = F("checked");
      else
            parameter[30] = F("");

      if ( RunState.FreezeFallLevel )
            parameter[31] = F("checked");
      else
            parameter[31] = F("");

      if ( RunState.FreezeProtect )
            parameter[32] = F("checked");
      else
            parameter[32] = F("");

      parameter[33] = String(RunState.FreezeLevel);

      //制热室内管温保护
      if ( RunState.EvaporatorTempNotRaiseLevel )
            parameter[34] = F("checked");
      else
            parameter[34] = F("");

      if ( RunState.EvaporatorTempFallLevel )
            parameter[35] = F("checked");
      else
            parameter[35] = F("");

      if ( RunState.EvaporatorTempProtect )
            parameter[36] = F("checked");
      else
            parameter[36] = F("");

      parameter[37] = String(RunState.EvaporatorTempLevel);

      //功率保护
      if ( RunState.PowerNotRaiseLevel )
            parameter[38] = F("checked");
      else
            parameter[38] = F("");

      if ( RunState.PowerFallLevel )
            parameter[39] = F("checked");
      else
            parameter[39] = F("");

      if ( RunState.PowerProtect )
            parameter[40] = F("checked");
      else
            parameter[40] = F("");

      parameter[41] = String(RunState.PowerLevel);

      //故障
      if ( RunState.ErrCode == EC_IPMErr )
      {
        parameter[42] = F("P0");
        parameter[43] = F("功率模块保护");
      }
      else if ( RunState.ErrCode == EC_UnderVoltage )
      {
        parameter[42] = F("P1");
        parameter[43] = F("欠压保护");
      }
      else if ( RunState.ErrCode == EC_OverVoltage )
      {
        parameter[42] = F("P1");
        parameter[43] = F("过压保护");
      }
      else if ( RunState.ErrCode == EC_OverCurrent )
      {
        parameter[42] = F("P2");
        parameter[43] = F("过电流保护");
      }
      else if ( RunState.ErrCode == EC_ExhaustTempHigh )
      {
        parameter[42] = F("P3");
        parameter[43] = F("排气温度过高保护");
      }
      else if ( RunState.ErrCode == EC_Freeze )
      {
        parameter[42] = F("P5");
        parameter[43] = F("制冷防冻结保护");
      }
      else if ( RunState.ErrCode == EC_CoolSuperHeat )
      {
        parameter[42] = F("P6");
        parameter[43] = F("制冷防过热保护");
      }
      else if ( RunState.ErrCode == EC_HeatSuperHeat )
      {
        parameter[42] = F("P7");
        parameter[43] = F("制热防过热保护");
      }
      else if ( RunState.ErrCode == EC_MCSpeedFeedBackErr )
      {
        parameter[42] = F("P9");
        parameter[43] = F("失步保护");
      }
      else if ( RunState.ErrCode == EC_FocDriveErr )
      {
        parameter[42] = F("P9");
        parameter[43] = F("FOC驱动异常保护");
      }
      else if ( RunState.ErrCode == EC_SoftwareErr )
      {
        parameter[42] = F("P9");
        parameter[43] = F("软件异常保护");
      }
      else if ( RunState.ErrCode == EC_MCStartupErr )
      {
        parameter[42] = F("P9");
        parameter[43] = F("压缩机启动失败");
      }
      else if ( RunState.ErrCode == EC_InOutCommErr )
      {
        parameter[42] = F("E0");
        parameter[43] = F("室内外通讯故障");
      }
      else if ( RunState.ErrCode == EC_InAmbientSensorErr )
      {
        parameter[42] = F("E1");
        parameter[43] = F("室内环温传感器故障");
      }
      else if ( RunState.ErrCode == EC_EvaporatorSensorErr )
      {
        parameter[42] = F("E2");
        parameter[43] = F("室内管温传感器故障");
      }
      else if ( RunState.ErrCode == EC_CondenserSensorErr )
      {
        parameter[42] = F("E3");
        parameter[43] = F("室外管温传感器故障");
      }
      else if ( RunState.ErrCode == EC_OutAmbientSensorErr )
      {
        parameter[42] = F("E7");
        parameter[43] = F("室外环温传感器故障");
      }
      else if ( RunState.ErrCode == EC_ExhaustSensorErr )
      {
        parameter[42] = F("E8");
        parameter[43] = F("排气温度传感器故障");
      }
      else if ( RunState.ErrCode == EC_MCShellSwitchOpen )
      {
        parameter[42] = F("E9");
        parameter[43] = F("压缩机过载保护");
      }
      else if ( RunState.ErrCode == EC_DebugCommErr )
      {
        parameter[42] = F("EA");
        parameter[43] = F("调试口通讯故障");
      }
      else
      {
        parameter[42] = F("无故障");
        parameter[43] = F("无故障");
      }

      File file = SPIFFS.open("/Default.html", "r");
      
      BeginPos = 0;
      if ( file.size() < 200 )
              len = file.size();
      else
              len = 200;

      server.setContentLength(CONTENT_LENGTH_UNKNOWN);
      do
      {
        ESP.wdtFeed();
        file.readBytes(buffer,len);
        buffer[len] = '\0';
        htmlPage = String(buffer);
        StringFormat(htmlPage,parameter,44);
        if ( BeginPos == 0 )
          server.send(200, "text/html", htmlPage);
        else
          server.sendContent(htmlPage);

        htmlPage = "";

        BeginPos = BeginPos + len;

        if ( (file.size()-BeginPos) < 200 )
          len = file.size()-BeginPos;
        else
          len = 200;
      }while(BeginPos < file.size());

      for (int i = 0; i < 44; i++)
      {
        parameter[i] = "";
      }

      file.close();

      Serial.println("Quit:" + String(ESP.getFreeHeap()) +"--" + String(ESP.getHeapFragmentation()));
    }
    您需要登录后才可以回帖 登录 | 立即注册  

    本版积分规则

    热门推荐

    一直显示'Serial' was not declared in this scope,求前辈解答谢谢
    一直显示'Serial'
    做了一个温控装置的蓝牙模块时遇到的问题,
    [限时福利]5分钟带你快速了解新一代开发板:M5STACK
    [限时福利]5分钟带你快速
    一、什么是M5Stack M5Stack是一种模块化、可堆叠扩展的开发板,每个模块
    【Arduino】108种传感器模块系列实验(97)---0.96寸OLED液晶屏
    【Arduino】108种传感器模
    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是
    【原创】全球最小口袋3D打印机mini one直播教程贴
    【原创】全球最小口袋3D打
    最近闲得蛋疼,没事搞个掌上3D打印机,先放效果图吧。 搞了半天,终于能正常打印,
    教你让OLED动起来!多重字符串版!
    教你让OLED动起来!多重字
    大家都知道:arduino单片机是单线程的 而上次教程中的多段字符串的运行速度必须一致
    Copyright   ©2015-2016  Arduino中文社区  Powered by©Discuz!   ( 蜀ICP备14017632号-3 )
    快速回复 返回顶部 返回列表