These are chat archives for SmingHub/Sming

29th
Feb 2016
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 15:40
@rtos fans @hreintke As I promise I port all my contribution to nonos-Sming to SmingRTOS there are 3 PR.. Now I ask for help - My app ported to SmingRTOS works just partly, it crashes often and restarts and prints about heep too low etc.. The same app works rock stable ontop of nonos Sming. RTOS SDK 1.4.0 Latest SmingRTOS.. app crashes mostly on (HTTP) response.sendString and/or while working with rather large JSON objects.. If someone have a time do please peek at https://github.com/avr39-ripe/OctoTherm branch master has nonos version and branch rtos has rtos port.. they differ only by includes.. not a byte more.. master - works, rtos - just partly... What I doing wrong? :)
to compile this app you can use my SmingRTOS fork with all needed features https://github.com/avr39-ripe/SmingRTOS/tree/dev
alon24
@alon24
Feb 29 2016 17:00
Does rtos use wifi_set_sleep_type
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 17:17
@alon24 it was quesstion to me? If so, yes it uses sleep_none
hreintke
@hreintke
Feb 29 2016 17:36
@avr39-ripe :
I did see your PR's thanks.
On the rtos crash issue. I've seen that too. With me it was (until now) always caused by stack issues.
The RTOS version is (due to the nature of freertos) more sensitive to stack usage.
I've tried to limit the stack usage from the SmingRTOS core functions to a minimum, did not check libraries.
Can you check your app/used libraries for that ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 19:35
@hreintke as you said seems that problems with my app + SmingRTOS is due to stack.. but how to reduce stack usage?? I use StaticJsonBuffer in nonOS Sming, if I change it to DynamicJsonBuffer it works BIT better, but.. crashes again :(
so can you provide some good or must use practice for REAL, COMPLEX JSON etc aware app to surrrvive SmingRTOS (or simply ESP RTOS) stack etc problems?? thanks!
@hreintke I have many "tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
"tiT"(stack_size = 0,task handle = 3fff2238) overflow the heap_size.
errors and then Fatal exception (2):
epc1=0x3fff3110
epc2=0x00000000
epc3=0x4022d643
epcvaddr=0x3fff3110
depc=0x00000000
�tn_add=0x3fff3110
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 19:42
@hreintke again - not to offend you - but if SmingRTOS (or underlying ESP RTOS SDK) is such fragil vreature, may be we should stay with nonOS Sming bit longer?? I wish I can use "teasty" features of RTOS, but if my app become completely unstable it worth nothing...
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 19:49
@hreintke if you find some time please give some advice of how to change my app (links was provided above) to become more stable.. I think it needs some refactoring around here https://github.com/avr39-ripe/OctoTherm/blob/master/app/thermo.cpp#L260 and similar places
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 20:09
@hreintke :) answer myself.. THANKS TO YOU, I dive bit deeper in my code and found one stack hungry place - buffer.. buffer which was LOCAL variable to function.. I think it is bad architectural decision.. and I have several such buffers scattered among several functions.. and declared as LOCAL variable... after change localvar bufer to ONE GLOBAL variable buffer my app become more stable.. it surrvive some tests on which it crashes before..
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 20:31
@hreintke app become unaccessible by http after a while.. all other app logic seems to work at the same time :( heh RTOS is a biig puzzle :)
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 21:47
@hreintke when app becomes unaccessible by http it still answer to ping and if my observation are good - it even continue to receive data from remote http-aware sensors :(
hreintke
@hreintke
Feb 29 2016 21:50
@avr39-ripe :
I am almost sure that json staticbuffer is not on stack.
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 21:52
@hreintke with staticjsonbuffer it crashes immediately.. after changing to dynamicjsonbuffer + global file buffer it survives for about 1000-1300 seconds of fully normal work under "load".. but then http server became unaccessible..
hreintke
@hreintke
Feb 29 2016 21:52
I don't understand what the situation is that you are describing.
http server inaccessible but receiving data ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 21:53
yeh.. indeed..
hreintke
@hreintke
Feb 29 2016 21:54
sorry trying to get it clear. receive from what with what protocol ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 21:54
application via httpclient GETs some data from remote esp8266 + 18b20 tempsensor.. and POSTs command to another remote esp8266 + relay.. but itself become inaccessible by http..
check several times.. 1000-1300 seconds normal work... free heap is about 27000.. no crashes.. just continue to work, but web server do not respond...
the same application even with staticjsonbuffer and localvar file buffers works fine for more than 3..4 DAYS without an issue (then I simply reflash it wit newer version.. without reflash it will work longer :))
hreintke
@hreintke
Feb 29 2016 22:01
I will try to setup a test for that. Any rough numbers on how many gets/posts/http requests ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:03
every 5 second... often.. yes :(
hreintke
@hreintke
Feb 29 2016 22:04
every 5 seconds one get, one post, one http request ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:05
to be more precise - every 4 second http GET to remote tempsensor, every 5 second GET request to internal webserver from UI (webpage + ajax) every 30 second POST to remote relay..
hreintke
@hreintke
Feb 29 2016 22:09
could you switch debug on when the http server is not responding and see which part of httpserver might fail ?
no need to have it on continuous, only when "stalling" has occurred
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:12
@hreintke I turn it on via Serial.debugoutput.. but it spawns too much.. :( try to isolate it..
oh.. :( I do not use command console :( my fault.. will learn how to do it... :(
hreintke
@hreintke
Feb 29 2016 22:13
you mean debugf out correct ?
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:13
Serial.systemDebugOutput(true); yes.. debugf..
wil try to just run webserver part of the app and turn off GETter and POSTer part... may be it helps narrow up the problem..
hreintke
@hreintke
Feb 29 2016 22:15

command enable is easy
Just put :

    Serial.commandProcessing(true);
    commandHandler.registerSystemCommands();

in init()

and on your serial terminal you can type debugon of debugoff
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:16
bad news for me is that smingrtos is bit fragil.. with some mines scattered around.. and I/m luck one to step them...:(
hreintke
@hreintke
Feb 29 2016 22:17
But the luck is that you have support for your specific issues :smile:
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:17
YES!! indeed!!!
not simply support, but VIP one.. THANK YOU very much for it!!
hreintke
@hreintke
Feb 29 2016 22:19
And I know, there are not many high volume users, so I also appreciate your help in this
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:21
if you whant, you can checkout my app and see with you own eyes.. you do not need additional hardware.. if another two HW parts is inaccessible - application still tries to reach it, and respond to webserver requests, for a while, and then - BUM - stops responding to requests to its webserver..
@hreintke here is the app https://github.com/avr39-ripe/OctoTherm/tree/rtos
and here is SmingRTOS with my additions wifi events + raw http body + DS3232RTC..
May be it will be more convinient to you see reall app..
of course if you whant an have time etc :)
hreintke
@hreintke
Feb 29 2016 22:24
I will. This link, correct ? https://github.com/avr39-ripe/OctoTherm
@hreintke yeh, rtos branch...
master branch is or nonOS sming.. just to compare..
and link above for SmingRTOS already with all 3 additions to which I made PR..
hreintke
@hreintke
Feb 29 2016 22:25
When I run without hardware attack, I have no json usage ?
Does it need the PR's
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:26
@hreintke no, you WILL have json from and to UI..
yeh. app needs wifi events + rab http body.. do not need ds3232rtc..
without hardware you will always get 0 (zero) temperature from remote sensor and you cant successfuly post command to remote relay :)
but application is working as weekly thermostat... you can setup 4 thermostats from web :)
hreintke
@hreintke
Feb 29 2016 22:28
understand. Will create a test branch on the SmingRTOS and include the PR's.
We can then easily add changes if we need for testing without effects on others
Alexander V. Ribchansky
@avr39-ripe
Feb 29 2016 22:29
@hreintke ok :) good idea!
hreintke
@hreintke
Feb 29 2016 22:36
@alonewolfx2 :
Did you mention swap lately. Think I saw something but can't find.