thinger-io / Arduino-Library

IOTMP Arduino Library for connecting devices to thinger.io #IoT
https://thinger.io
MIT License
114 stars 66 forks source link

Got Fatal exception 28(LoadProhibitedCause) when using ThingerSmartConfig #28

Open sindar225 opened 4 years ago

sindar225 commented 4 years ago

Hi, I'm building an MQ2 sensor on NodeMCU v3 board and I'd like to use deep sleep feature so that to run on low power profile. Having read many guides of how to build such a system with thinger IoT I came up with a code that (from my perspective) should run well, but it doesn't and I receive Fatal exception 28(LoadProhibitedCause) error.

One more note: I had to set #define _DISABLETLS because otherwise it would fail with [_SOCKET] Error while connecting! error.

My set-up: thinger-io 1.6.2 NodeMCU v3 LoLin 1.0

Arduino IDE 1.8.8 esp8266 2.5.2 thinger.io 2.13.0

ESP code https://justpaste.it/5gbmh

Stack trace: https://justpaste.it/1lig7

sindar225 commented 4 years ago

From what I could get there are a few problems:

  1. Fatal exception 28(LoadProhibitedCause) goes away when following code is added to ThingerSmartHome.h:
    WiFi.persistent(false);
    WiFi.mode(WIFI_OFF);
    WiFi.mode(WIFI_STA);

    But then another issue turns up.

  2. client_.available() always returns 0; To solve this problem we need to set a constant delay(50);
  3. Another issue occurs when using write_bucket() method and ESP.deepsleep(). With confirm_write set to false (default value) the board ESP8266 goes sleep before data has been written. confirm_write=true by default solves the problem.