Skip to content

Getting issue when use ArduinoJson ESP8266, ap-wifi disappears after first connection attempt #2161

Open
@kalwinskidawid

Description

@kalwinskidawid

Hey, I come with a strange problem.

  • I initialize wifi in AP mode by default.
  • In the meantime, the program checks itself for outputs and inputs, calculates the data, and then serializes to JSON.
  • Scenario 1:
    • When I try to connect to the AP then it rejects me and disappears completely - in the console it throws no error, and there is no memory leak.
  • Scenario 2:
    • When, for example, I add more values to JsonDocument sensors then everything works fine, the AP creates itself, you can connect to it normally and read the data over HTTP.

What could be the problem here? A very similar topic has been created before #1512. However, there is no solution there. The strangest thing is that when the json is larger everything works, and when it is smaller it does not.

Environment
Here is the environment that I'm using':

  • Microconroller: ESP8266 (NodeMCU V2)
  • IDE: Platformio

Exmaple how I create a JsonDocument:

//simple example how  I prepare the object to serialize
JsonDocument head;

JsonDocument sensors;
sensors[0]["value"] = 55;
sensors[0]["time"] = 1351824120;

sensors[1]["value"] = 75;
sensors[1]["time"] = 1351824120;

JsonDocument anotherSensor;

anotherSensor["sensor"] = "gps";
anotherSensor["time"] = 1351824120;
anotherSensor["data"][0] = 48.756080;
anotherSensor["data"][1] = 2.302038;

JsonDocument inputs;

input[0]["value"] = "on";
input[1]["value"] = "off";
input[2]["value"] = "off";
input[3]["value"] = "on";

head["anotherSensor"] = anotherSensor;
head["inputs"]  = inputs;

serializeJson(head, newState);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions