ESP8266 Developer Zone The Official ESP8266 Forum 2016-09-06T20:38:32+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=2730 2016-09-06T20:38:32+08:00 2016-09-06T20:38:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2730&p=9752#p9752 <![CDATA[Re: [mesh_demo.c] - Strange piece of code - MESH_LOCAL and MESH_ONLINE]]>
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:

    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

Statistics: Posted by Guest — Tue Sep 06, 2016 8:38 pm


]]>
2016-09-02T03:37:14+08:00 2016-09-02T03:37:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2730&p=9697#p9697 <![CDATA[[mesh_demo.c] - Strange piece of code - MESH_LOCAL and MESH_ONLINE]]>
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:

    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!

Statistics: Posted by freebeans — Fri Sep 02, 2016 3:37 am


]]>