[mesh_demo.c] - Strange piece of code - MESH_LOCAL and MESH_ONLINE

freebeans
Posts: 4
Joined: Wed Jun 29, 2016 4:11 am

[mesh_demo.c] - Strange piece of code - MESH_LOCAL and MESH_ONLINE

Postby freebeans » Fri Sep 02, 2016 3:37 am

Hello.

I can't understand how this piece of code works.

Does it force the current root node to give up from the online mode and let another one assume as the root node?

Code: Select all

    if (espconn_mesh_connect(&g_ser_conn)) {
        MESH_DEMO_PRINT("connect err\n");
        if (espconn_mesh_is_root())
            espconn_mesh_enable(mesh_enable_cb, MESH_LOCAL);
        else
            espconn_mesh_enable(mesh_enable_cb, MESH_ONLINE);
        return;
    }


How does MESH_LOCAL differ from MESH_ONLINE when non-root node tries to connect to the mesh?

Thank you!

ESP_Alen

Re: [mesh_demo.c] - Strange piece of code - MESH_LOCAL and MESH_ONLINE

Postby ESP_Alen » Tue Sep 06, 2016 8:38 pm

freebeans wrote:Hello.

I can't understand how this piece of code works.

Does it force the current root node to give up from the online mode and let another one assume as the root node?

Code: Select all

    if (espconn_mesh_connect(&g_ser_conn)) {
        MESH_DEMO_PRINT("connect err\n");
        if (espconn_mesh_is_root())
            espconn_mesh_enable(mesh_enable_cb, MESH_LOCAL);
        else
            espconn_mesh_enable(mesh_enable_cb, MESH_ONLINE);
        return;
    }


How does MESH_LOCAL differ from MESH_ONLINE when non-root node tries to connect to the mesh?

Thank you!


non-root must use MESH_ONLINE

Who is online

Users browsing this forum: No registered users and 294 guests