These are chat archives for esp8266/Arduino

6th
Jul 2016
Clemens Kirchgatterer
@everslick
Jul 06 2016 00:03
is it only me or does wifi_get_ip_info() leak memory?
Ivan Grokhotkov
@igrr
Jul 06 2016 02:54
@everslick shouldn't leak, no dynamic allocations in there...
Michael Miller
@Makuna
Jul 06 2016 06:11
@skorokithakis Do you have a link or name of the product? I can't tell if its a NeoPixel or not but it sure looks like one.
Clemens Kirchgatterer
@everslick
Jul 06 2016 08:05
@igrr hmm, then it must be fragmentation, that is eating away on my heap. i call a function that returns a String, which calls a function, that returns a String which calls wifi_get_ip_info().
Ivan Grokhotkov
@igrr
Jul 06 2016 08:18
#include <ESP8266WiFi.h>
void setup() {
  Serial.begin(115200);
  WiFi.persistent(false);
  WiFi.mode(WIFI_STA);
  WiFi.begin("#!/bin/test", "test_bin");
}
String getMyIp() {
  return String("My IP is: ") + WiFi.localIP().toString();
}
void loop() {
  String s = getMyIp();
  Serial.printf("%p %8d\r\n", s.c_str(), ESP.getFreeHeap());
}
@everslick is this equivalent to what you have?
This doesn't exhibit any leaking on my side.
Stavros Korokithakis
@skorokithakis
Jul 06 2016 09:35
@Makuna I figured it out, it was 11 12 15
Me No Dev
@me-no-dev
Jul 06 2016 10:05
11? that is used by the flash
Martin Ayotte
@martinayotte
Jul 06 2016 12:51
@skorokithakis , Witty board has REG on 12,13,15 : https://blog.the-jedi.co.uk/2016/01/02/wifi-witty-esp12f-board/
SteveToulouse
@SteveToulouse
Jul 06 2016 13:54
Hi @igrr @me-no-dev would you consider accepting modifications astyle'd with --break-elseifs as well as --style=otbs? I was trying to do a clean correct of #2188 (the block is ~100 lines long) and it was easier to see what to do (it was even easier with style=whitesmith, but I'm old and my neuron stack is shallow).
I get the feeling the absence of --break-elsifs may have been why the coder missed the problem in the first place. L51 makes the following lines visually attached to the else rather than the "if" of the "} else if {" imho.
Me No Dev
@me-no-dev
Jul 06 2016 13:55
i personally do not like the breaks for functions also
all those breaks make my neuron function funny
i have to scroll to read a single function and so on :D
SteveToulouse
@SteveToulouse
Jul 06 2016 13:57
:-D
Me No Dev
@me-no-dev
Jul 06 2016 14:01
@SteveToulouse if it's any help, I dev in the style I'm comfortable with, then a single shell command astyles all for commiting
SteveToulouse
@SteveToulouse
Jul 06 2016 14:03
That looks like the best way. Everyone'll be happy :-)
Stavros Korokithakis
@skorokithakis
Jul 06 2016 14:56
@martinayotte ah, thanks martin, i didn't know they were called witty
Clemens Kirchgatterer
@everslick
Jul 06 2016 15:57
@igrr yes, but i already know, that the leak is related to the arduinowebsocket library
on each new websocket connection ~180bytes are lost.
184 bytes to be exact
Clemens Kirchgatterer
@everslick
Jul 06 2016 16:30
websocket uses WifiClient
WifiClient creates a ClientContext
clientContext is ref counted
Stavros Korokithakis
@skorokithakis
Jul 06 2016 16:37
i'm not sure about the terms on this, but is it possible to write an ESP sketch that will listen for multicast udp packets?
i want to send packets to the entire network, the packets will contain a few bytes of info
if possible, is there an example on this anywhere?
Clemens Kirchgatterer
@everslick
Jul 06 2016 18:01
is there a specific reason for multicast? or could you just use a broadcast?
Stavros Korokithakis
@skorokithakis
Jul 06 2016 18:21
@everslick hmm, what's the difference? it sounds like i need a broadcast instead
@forkineye thank you
i want to send a packet to the entire home subnet
Clemens Kirchgatterer
@everslick
Jul 06 2016 18:41
then broadcast is simpler
just listen on the UDP port of your joice (on the ESP) and send your UDP packets to the broadcast address of your network
Me No Dev
@me-no-dev
Jul 06 2016 18:59
@everslick those 184 bytes return back after some time though right?
Clemens Kirchgatterer
@everslick
Jul 06 2016 18:59
you can test this with netcat: echo test | nc -u -b 10.0.0.255 1234
@me-no-dev no
does not seem so
Me No Dev
@me-no-dev
Jul 06 2016 18:59
are you sure?
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:00
no ;-P
Me No Dev
@me-no-dev
Jul 06 2016 19:00
like a minute
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:00
i check...
Me No Dev
@me-no-dev
Jul 06 2016 19:00
if they return after a minute, that means that the connection is in close_wait state
I had this issue with async sockets
this same 184 bytes one :D
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:02
that's at least a good hint
Me No Dev
@me-no-dev
Jul 06 2016 19:03
@skorokithakis I'm looking into UDP currently, trying to figure out the best way to wrap an async lib with multicasts and all
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:03
BINGO!
your are (as always) completely right
Me No Dev
@me-no-dev
Jul 06 2016 19:04
@everslick on my side the "fix" was to force abort the connection after it's closed (in the TCP lib, not the WebSocket one)
@everslick I actually have asolution for you
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:06
i see a WifiClient object in the websocketsserver class
Me No Dev
@me-no-dev
Jul 06 2016 19:06
update your version of the WebSocket lib and get if you do not have the latest AsyncTCP lib
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:06
i should switch to async websockets?
Me No Dev
@me-no-dev
Jul 06 2016 19:06
then in the WebSocket lib activate Async
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:06
ok
Me No Dev
@me-no-dev
Jul 06 2016 19:07
that way your code stays the same and you will get the proper close from the AsyncTCP lib
@everslick if you get your code async ready, the async web server has web sockets already in
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:12
yes, i realized that. another reason for me to get async ASAP
Martin Ayotte
@martinayotte
Jul 06 2016 19:17
Hi guys ! I've recently upgraded to stable 2.3.0, and I've just discover something funny (not really fun, but ...) with deepSleep(). It seem that after deepSleep() the UART is kind of blocking mode while after a plain Reset it is not. So, since there are many prints in Setup(), it get blocked and never reach WiFi setup until I plug the USB on my Wemos. Again, with a plain Reset, I don't have to do that.
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:21
@me-no-dev hmpf, still not working. i made sure i have the latest origin/master of arduinoWebSockets and changed WebSockets.h:
//#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266
#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266_ASYNC
Me No Dev
@me-no-dev
Jul 06 2016 19:23
did you get the latest AsyncTCP also?
I fixed it like a week ago
@martinayotte maybe the ueart chip is at fault?
the uart on the ESP does not care if anyone receives
Martin Ayotte
@martinayotte
Jul 06 2016 19:27
@me-no-dev , but it only occurs after wakeup from deepSleep()
It was working with older versions
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:27
that could be...
ahhh... better :)
Me No Dev
@me-no-dev
Jul 06 2016 19:32
@everslick did it work?
@martinayotte but there is nothing to stop the uart from sending it's data (block it)
there is no flow control implemented or anything like that
plus nothing has recently changed in UART
and it's all registers work that has been working since day one
Martin Ayotte
@martinayotte
Jul 06 2016 19:39
Effectively, I've just checked, but I still have the symptom, my Wemos is stuck after deepSleep until I open picocom session. I'm pulling my hairs ... But no issue after normal reset.
I've tried with a second Wemos, samething ...
Me No Dev
@me-no-dev
Jul 06 2016 19:42
other boards?
Martin Ayotte
@martinayotte
Jul 06 2016 19:47
I've found the issue : using another computer, it worked, so my USB port is probably in a strange health, I will reboot my PC later.
In fact, it is only one USB port, the others are working
Sorry for the noise ...
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:51
@me-no-dev yes works. unfortunatly i'm already so out of heap, that asynctcp does not work well in genaral, because it needs a little bit more of it
i really have to cut back on debug fatures
Me No Dev
@me-no-dev
Jul 06 2016 19:53
@martinayotte nah, we will know for next time a new possible cause
@everslick out of heap? :D
you will need it if you want async ;)
Clemens Kirchgatterer
@everslick
Jul 06 2016 19:59
yes, i'm VERY tight on heap
i guess i have to refactor a little before i can switch
anyway, your 'fix' for the 'socket close wait state': shouldn't that be handled nicly in the WiFiClient class?
Clemens Kirchgatterer
@everslick
Jul 06 2016 20:06
for the sync server i mean
Me No Dev
@me-no-dev
Jul 06 2016 20:28
will look into it
do not know what apple did, but my nodemcu crashes my computer
and I just updated whatever they had in line
when I hook it up I can see it trying to enumerate over and over again untill the port is forbiden
or just freezes the whole thing and on unplug reboots
Mehrdad K
@mkeyno
Jul 06 2016 20:39
@me-no-dev r u still awake
Me No Dev
@me-no-dev
Jul 06 2016 20:40
yes @mkeyno
Mehrdad K
@mkeyno
Jul 06 2016 20:41
I have problem using websoket along with software serial
Me No Dev
@me-no-dev
Jul 06 2016 20:41
async web socket?
Mehrdad K
@mkeyno
Jul 06 2016 20:42
no sync , I have attached the SIM module to ESP and command it by websocket
Me No Dev
@me-no-dev
Jul 06 2016 20:42
then you should take it to the relevant devs of the said libs
Mehrdad K
@mkeyno
Jul 06 2016 20:44
Markus not visit very much lately , but it is ok if you not prefer to discuss
this is Links2004/arduinoWebSockets#105 issue address , and really appreciated if you have time and look at it
Me No Dev
@me-no-dev
Jul 06 2016 21:10
@mkeyno what is the SIM speed?
SoftSerial baud
Mehrdad K
@mkeyno
Jul 06 2016 21:19
115200
Stavros Korokithakis
@skorokithakis
Jul 06 2016 21:23
@everslick ah, thanks for the broadcast solution, that should be much simpler indeed, and no weird code necessary