PhracturedBlue / ESP8266MQTTMesh

Self-assembling Mesh network built around the MQTT protocol supporting OTA
GNU General Public License v3.0
265 stars 79 forks source link

Callback calls with lastest commit restarts ESP #19

Closed alexiszecharies closed 6 years ago

alexiszecharies commented 6 years ago

Continuing this issue https://github.com/PhracturedBlue/ESP8266MQTTMesh/issues/18

Description of problem:

Despite succeeding to delay the broker IP set, when I tried to set the callback as i used to before this fix and testing it in the ESP I am getting this error:

Exception (9): epc1=0x4020dfb5 epc2=0x00000000 epc3=0x00000000 excvaddr=0xfe090016 depc=0x00000000

ctx: sys sp: 3ffffaa0 end: 3fffffb0 offset: 01a0

stack>>> 3ffffc40: 3fff03cc 000006da 000006da 3fff03cc
3ffffc50: 00000010 3ffffce0 00000000 4010053d
3ffffc60: 00000034 000036d0 000006da 3fff1f18
3ffffc70: 00000030 00000001 3ffe863e 402111cc
3ffffc80: 00000010 fe090016 00000000 4020e080
3ffffc90: 3fff362c 00000047 3ffef1f4 40201651
3ffffca0: 3fff03cc 3fff1f18 3fff1c48 402094fc
3ffffcb0: 3fff362c 3fff1c44 00000001 40209648
3ffffcc0: 3ffe90e2 3fff1c44 3ffffcf8 3ffffcf8
3ffffcd0: 3fff362c 3fff1c44 3fff1f18 4020c19f
3ffffce0: 00000000 00000000 00000000 00000000
3ffffcf0: 00000000 00000000 00000000 00000000
3ffffd00: 00000000 00000000 00000000 00000000
3ffffd10: ffffffff 00000000 3ffe9b01 00000008
3ffffd20: 40213a32 3ffed120 3fff0ccc 00000000
3ffffd30: 00000000 3fff173c 00000000 4020c1dd
3ffffd40: 00000000 00000000 00000020 40201e70
3ffffd50: 3f000000 40212e87 3ffed120 40208b87
3ffffd60: 3f000000 3fff172c 00000000 402118c2
3ffffd70: 00000002 00000000 00000000 4020f8c4
3ffffd80: 00000000 40222edc 3fff427e 3fff4244
3ffffd90: 3fff1444 3fff1584 40208b64 4020c1bc
3ffffda0: 3f000000 000001e8 000001e8 00000002
3ffffdb0: 3fff174c 3fff362c 00000000 3ffedb30
3ffffdc0: 401009c2 00000001 00000000 00000000
3ffffdd0: 3ffea2d6 00000026 3fff4244 40211781
3ffffde0: 00000000 00000000 00000000 00000000
3ffffdf0: 00000005 00000000 00000020 40210c14
3ffffe00: 00000000 00000000 00000000 00000000
3ffffe10: 40101b41 00000026 3fff4244 40210cb9
3ffffe20: 00007fff 00000026 3fff1ce4 4020f6b9
3ffffe30: 3fff1b04 00000000 4020ea84 402116f0
3ffffe40: 3fff13fc 05bb82b2 4020ea3c 40211748
3ffffe50: 00000026 3ffea230 3ffea230 00000001
3ffffe60: 3fff1e51 3fff4244 4000050c 3fffc278
3ffffe70: 40229a8d 05bb82b2 00000000 3fff1d38
3ffffe80: 00000001 3fff13e4 3fff1ce4 4020f6ec
3ffffe90: 3ffea23c 3fff0ce4 3fff1ce4 4020e2e8
3ffffea0: 3fff1584 00000030 0000000f ffffffff
3ffffeb0: 3fff0af0 3fff0af8 00000006 3fff09b8
3ffffec0: 3fff1584 3fff09c0 3fff09bc 4020e33b
3ffffed0: 3fff1584 3fff09c0 3fff09bc 40226d10
3ffffee0: 00000026 6a01a8c0 00000018 00000026
3ffffef0: 00000018 00000000 3ffec20d 40107404
3fffff00: 40220000 00000000 0000007d 3fff0af4
3fffff10: 3ffea2ae 3fff0af8 3fff13e4 40224101
3fffff20: 3fff08c0 3fff144c 3fff144c 3ffeea40
3fffff30: 00000000 3fff13e4 0000001c 3fff144c
3fffff40: 3ffea2a0 00000000 3fff13e4 402234f9
3fffff50: 3201a8c0 00000074 00000000 00000041
3fffff60: 00000002 0000001a 40213343 3ffed3f0
3fffff70: 3ffea280 3fffdcc0 3ffe99f0 3ffe99f0
3fffff80: 402132b6 3ffed3f0 00000000 3fff14d4
3fffff90: 3fffdc80 00000000 3fff13e4 4021c287
3fffffa0: 40000f49 3fffdab0 3fffdab0 40000f49
<<<stack<<<

ets Jan 8 2013,rst cause:1, boot mode:(1,7)

ethets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

I am referencing the callback at the top as all variables void callback(const char topic, const char msg);

And then implementing it below:

void callback(const char topic, const char msg) { // topic is the command and msg the payload Serial.println(topic); Serial.println(msg); }

This used to work before the fix in the issue. How should I declare the callback to make it global if it is not?

PhracturedBlue commented 6 years ago

'Same result' means you have this error:

This version of the ESP8266 library is not supported

?

Look in .piolibdeps/ESP8266MQTTMesh_ID1747/src/ESP8266MQTTMesh.cpp (from wherever your platformio.ini is, and make sure it contains:

#ifndef pgm_read_with_offset //Requires Arduino core 2.4.0
    #error "This version of the ESP8266 library is not supported"
#endif

If it doesn't have that, you don't have the right library. If it does have that you still don't have a compatible espressif8266 library.

I did a clean platformio install with features/stage and it does compile for me now. I had issues with the

platform = https://github.com/platformio/platform-espressif8266.git#feature/stage

line, and ended up needing this instead:

platform = espressif8266@4f59cef

I don't know why. platformio seems to make it difficult to point at the libraries I want to use

alexiszecharies commented 6 years ago

'Same result' means you have this error: yes.

I could make it compile!!!!!!!!!! I really do not understand the difference between .piolibdeps and .platformio/lib/ where aparently the code was being updated. Will look into this later. I will start with the tests with my code again. Thank you very much!!!!!!!!

alexiszecharies commented 6 years ago

I am having this problem with my code

.pioenvs/nossl/lib/libESP8266MQTTMesh_ID1747.a(ESP8266MQTTMesh.o): In function strlcat': ESP8266MQTTMesh.cpp:(.text.strlcat+0x8): multiple definition ofstrlcat' /home/alexis/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/tools/sdk/libc/xtensa-lx106-elf/lib/libc.a(lib_a-strlcat. o):/Users/igrokhotkov/e/newlib-xtensa/xtensa-lx106-elf/newlib/libc/string/../../../.././newlib/libc/string/strlcat.c:49: first defined here collect2: error: ld returned 1 exit status

Gonna check it out later. Thank you for your help!

PhracturedBlue commented 6 years ago

That specific issue should now be fixed. I have an alternate implementation of strlcat in the mesh code. It would collide with the libc variant. I've renamed mine to prevent that error. But please open new issues for things unrelated to the connectivity issue this thread has been about.

alexiszecharies commented 6 years ago

Ok, note taken. Today I had little time to do some testing, but after flashing the 3 ESPs and putting my software I could see that the are no disconnections as before and they got a different number for their subdomain in no time. It looks really promising.

PhracturedBlue commented 6 years ago

I'm closing this issue for now. If you see problems with nodes not properly communicating with the broker, please reopen or file a new ticket.