These are chat archives for esp8266/Arduino

9th
Mar 2016
Victor Tseng
@Palatis
Mar 09 2016 00:12
i always use screen back in the AVR days...
like, when Arduino is still 1.0.x, the integrated serial monitor just... suck.
duno, why isn't there "auto-baudrate uart" implementation? like guessing the buadrate based on data received...
Angus Gratton
@projectgus
Mar 09 2016 00:14
screen doesn't do non-POSIX baudrates
I have a half-finished patch for screen to do non-POSIX baudrates, but it turned into a bit of a pain to implement
the ESP can do autobauding, but if you have to send data to it to get that. the initial baud rate choice is still up for grabs
Aditya Tannu
@AdySan
Mar 09 2016 00:24
Is there a good central place (like a wiki) to list libraries for this esp8266/Arduino port? I see this but way too many interesting ones popping up, hard to keep track of.
Martin Ayotte
@martinayotte
Mar 09 2016 01:41
@projectgus , from what I remember CH340 and CP2301 didn work for me but FTDI did ... But maybe that depends, as you said, about the linux terminal used ( I'm always using picocom )
Angus Gratton
@projectgus
Mar 09 2016 02:21
only the very latest releases of picocom (2.1 or newer) can set non-POSIX baud rates
and ch340 has some baud rate setting bugs on older linux kernels
but with the right software/drivers those chips should do 74880
Michael Miller
@Makuna
Mar 09 2016 05:45
bad press alert, see https://www.youtube.com/watch?v=LQzoixcnFXw, LadyAda at Adafruit was trying to use a esp8266 using the new ssl support and failed with a simple example.
Ivan Grokhotkov
@igrr
Mar 09 2016 06:38
Yup, and the issue is not related to SSL actually
replacing delay(500) with
  while (client.available() == 0) {
    if (timeout - millis() < 0) {
      Serial.println(">>> Client Timeout !");
      client.stop();
      return;
    }
  }
and it works fine
tzapu
@tzapu
Mar 09 2016 08:21
bad lady ada, bad :thumbsdown:
tzapu
@tzapu
Mar 09 2016 08:44
anyone could take pity on me and tell me how to use esptool to erase flash ?
./esptool -ce -cp /dev/tty.wchusbserial1410 -bz 4M -vvv -cv nodemcu
esptool v0.4.6 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
that seems to do nothing
never mind, the order of params seems to matter
although i can t get much further anyway
./esptool -cp /dev/tty.wchusbserial1410 -cd none -ce -vvv
esptool v0.4.6 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
    setting port from /dev/tty.usbserial to /dev/tty.wchusbserial1410
    setting board to none
tried with nodemcu as board as well
ok…had an older esptool
tzapu
@tzapu
Mar 09 2016 08:54
yes, thanks, got a command line that tries now
but can t connect yet
this module will kill me in the end
Lars Englund
@larsenglund
Mar 09 2016 08:55
@igrr @Links2004 @me-no-dev I've added support for sending a query and receiving answers to ESP8266mDNS, wan't me to do a pull request?
tzapu
@tzapu
Mar 09 2016 09:15
@Links2004 after a few attempts, i have managed to wipe the flash, and it seems to run normally, at least for now. will update if anything else happens. this was one hell of a problem to have
Ivan Grokhotkov
@igrr
Mar 09 2016 09:18
@larsenglund sure, please do
any reason why you are using plain char* pointers instead of Strings in a struct?
Ivan Grokhotkov
@igrr
Mar 09 2016 09:25
This repeated part of code begs to be moved into a function:
  MDNSAnswer *answer = _answers;
  while (answer != 0) {
    numAnswers++;
    answer = answer->next;
  }
Ivan Grokhotkov
@igrr
Mar 09 2016 09:38
@larsenglund could you please also add an example sketch showing how to use this new feature?
Lars Englund
@larsenglund
Mar 09 2016 09:40
@igrr char* pointers mainly because I was getting alignment exceptions with String but also to reduce RAM usage
@igrr regarding the overload I just copied the style of the existing code, what is the problem with doing it that way?
Ivan Grokhotkov
@igrr
Mar 09 2016 09:53
Let's debug those alignment issues. From the language/compiler point of view you should be okay putting String into a struct
Me No Dev
@me-no-dev
Mar 09 2016 09:55
@igrr could you please explain why should we use String?
Ivan Grokhotkov
@igrr
Mar 09 2016 10:02
I'm not saying you should use String. You may use whatever you are comfortable with. However with libraries it is good to think about maintenance. For example, months later someone might be doing a minor change to the library, and will put a return into the wrong place, causing free not to be called. String gives you automatic storage duration enforced by the language itself, so your code becomes more robust. Yes, this comes with a price — an overhead of having extra members inside the String (length and capacity). Whether more robust code is worth this price is up to you, of course.
If you don't want the overhead of these extra members, consider using std::unique_ptr<char> instead.
Me No Dev
@me-no-dev
Mar 09 2016 10:04
how about heavy concatenation use?
what happens to the strig buffer when you add data to it?
Ivan Grokhotkov
@igrr
Mar 09 2016 10:05
If you're expecting heavy concatenation, then i guess using String and calling String::reserve is a good strategy
Me No Dev
@me-no-dev
Mar 09 2016 10:06
also how about time taken to do operations compared to more C approach
for example, the AsyncWebServer pareser relies havily on String and concatenation
and I see the time taken to parse larger request to be way too much
and in cases of massive network traffic, things seem to go to hell at some point
Lars Englund
@larsenglund
Mar 09 2016 10:13
@igrr I have moved the bit of redundant code out now and added an example
Ivan Grokhotkov
@igrr
Mar 09 2016 10:14
@me-no-dev i guess there are some hotspots that may be optimized... the trick is to identify them
i've been working on making a host-based environment where lwip would run
so that we can write tests for network libraries as well
i think that this may also open some room for profiling with, e.g., gprof
Lars Englund
@larsenglund
Mar 09 2016 10:17
@igrr regarding the return in the wrong place, that isn't ovecome by swapping char* to String since the struct is a manually managed linked list
Me No Dev
@me-no-dev
Mar 09 2016 10:21
@igrr you mean run lwip on linux? In that case getting it to work on a PI with ENC28j60 should be trivial
tzapu
@tzapu
Mar 09 2016 10:22
i have an out of nowhere question since you re all here, how are you runnign unit tests, are they running on actual devices or anything of that sorts?
Lars Englund
@larsenglund
Mar 09 2016 10:22
@igrr Also, handing the user a pointer to the internal String object is probably bad since it gets deleted upon making a new query. Handing back a new String object created from the internal char* seems safe
tzapu
@tzapu
Mar 09 2016 10:22
if i d like to start adding tests to my libs, where would i start?
Me No Dev
@me-no-dev
Mar 09 2016 10:23
I use examples and travis for my git based projects
though I see @igrr might have learned a new trick lately
tzapu
@tzapu
Mar 09 2016 10:24
but are they running on devices, or just testing function calls on whatever arch they run on?
sry for the noobish questions
Me No Dev
@me-no-dev
Mar 09 2016 10:25
it's testing if it will build on whtever travis is (ubuntu64 in my case)
Ivan Grokhotkov
@igrr
Mar 09 2016 10:26
@larsenglund you can hand the user a copy of String — that would be safe as well
Me No Dev
@me-no-dev
Mar 09 2016 10:26
there are better ways, but I'm not that far
tzapu
@tzapu
Mar 09 2016 10:26
ah ha, so in short, it s testing the units of code, you can t do stuff like test the whole chain, sdk and all, see wifi node, connect, see result, etc
Ivan Grokhotkov
@igrr
Mar 09 2016 10:26
@tzapu i'm working on that...
tzapu
@tzapu
Mar 09 2016 10:26
ooooo
Ivan Grokhotkov
@igrr
Mar 09 2016 10:27
@me-no-dev you can run lwip on linux as a tap, it will use an existing network interface
tzapu
@tzapu
Mar 09 2016 10:27
well ,looking forward to that, and i ll read more into unite testing then in the mean time
Me No Dev
@me-no-dev
Mar 09 2016 10:28
nice
Lars Englund
@larsenglund
Mar 09 2016 10:28
@igrr True. That aside, it's working fine with char* and I don't see any gain in converting to String so I'll go ahead and make a pull request in it's current state, ok?
Ivan Grokhotkov
@igrr
Mar 09 2016 10:29
@larsenglund yes, of course. please do.
Lars Englund
@larsenglund
Mar 09 2016 10:31
@igrr cool, done :)
@igrr hmm, it says "The Travis CI build failed"
tzapu
@tzapu
Mar 09 2016 10:53
  • /random i used to get reset reasons in serial debug a few days ago, now it see it s gone
Ivan Grokhotkov
@igrr
Mar 09 2016 11:47
Yes, it seems Arduino-builder fails to generate forward declarations again
I'm taking a look
Ivan Grokhotkov
@igrr
Mar 09 2016 12:25
created arduino/ctags#9
tzapu
@tzapu
Mar 09 2016 13:57
if i wake up with WAKE_RF_DISABLED from deep sleep, can i enable the radio without having to do another deep sleep?
tzapu
@tzapu
Mar 09 2016 15:17
second or maybe even third random question: can you find out how much the esp actually spent in deep sleep, if it got awoken early rather than when the interval happened? (without using the wifi connection to get a new date)
Markus
@Links2004
Mar 09 2016 15:23
one of the timers/couters is not retested if i remember right
tzapu
@tzapu
Mar 09 2016 15:25
what s the structure to access taht data? if you have some link handy
Markus
@Links2004
Mar 09 2016 15:25
it where noted as issue some where but in you case its a feature ;) need to find it.
ok #259, there is not noted that its fixed.
tzapu
@tzapu
Mar 09 2016 15:30
:))
Markus
@Links2004
Mar 09 2016 15:31
millis depends on the SDK function system_get_time
the behavior in the SDK may has changed but give it a try.
tzapu
@tzapu
Mar 09 2016 15:33
i did
it resets
it s around 400ms each time it starts
so i guess it s reset
Markus
@Links2004
Mar 09 2016 15:36
in theory the RTC is running may the SDK function system_get_rtc_time helps
tzapu
@tzapu
Mar 09 2016 15:37
i ll try, thanks
Markus
@Links2004
Mar 09 2016 15:38
blob
tzapu
@tzapu
Mar 09 2016 15:40
seems to be reset
returns 72515
around there
which seems to also translate to about 400ms
Markus
@Links2004
Mar 09 2016 15:43
out of ideas then.
tzapu
@tzapu
Mar 09 2016 15:43
oh well, thank you
Harrison Mclean
@h4rm0n1c
Mar 09 2016 16:25
well, my port of DMD2 is broken again.
Is there any major changes around timer0 that I need to take account of? I’m also using PWM.
Michael Miller
@Makuna
Mar 09 2016 16:37
@h4rm0n1c servo stuff also uses timer0 if want to tset it aND compare. I am not near a esp8266 for a week so I can't test if it works.
Harrison Mclean
@h4rm0n1c
Mar 09 2016 16:38
Ok, I’ve also got a stack trace, I’m using the latest platformio for more info.
Michael Miller
@Makuna
Mar 09 2016 16:57
Ok, it seems that servo is broken as there is a new issue overnight on it.
Michael Miller
@Makuna
Mar 09 2016 17:19
But the servo issue is about making sure certain routines are ram cached so they can be called within an interrupt.
Ivan Grokhotkov
@igrr
Mar 09 2016 17:30
Oh damn, that was a close one... Arduino 1.6.8 nearly got released with broken ctags again
Downloading it now to test, but it looks like the fix was made in time...
Me No Dev
@me-no-dev
Mar 09 2016 18:22
1.6.7 almost got released with a major bug as well :)
ZaPpInG
@lrmoreno007
Mar 09 2016 20:13
can esp8266/Arduino work with Wiring??
surely it's a silly ask :)
Victor Tseng
@Palatis
Mar 09 2016 20:26
wow ESPAsyncWebServer works like magic!
now I only lack a AsyncClientSecure which does ssl over ESPAsyncTCP...
lets make it happen...
Me No Dev
@me-no-dev
Mar 09 2016 20:31
first a proper client needs to be written for HTTP
and @Links2004 has mentioned that he wants to do it :)
Victor Tseng
@Palatis
Mar 09 2016 20:40
what client?
Me No Dev
@me-no-dev
Mar 09 2016 20:40
oh you mean a simple ssl client?
Victor Tseng
@Palatis
Mar 09 2016 20:40
AsyncClient?
actually HTTPS client...
but HTTPS's actually HTTP over SSL
Me No Dev
@me-no-dev
Mar 09 2016 20:41
you are asking for SecureAsyncClient and I have SecureAsyncHTTPClient in my mind...
so I am correct then
Victor Tseng
@Palatis
Mar 09 2016 20:42
i actually want the latter
but can't be done without the the simple ssl client
strange, your AsyncWebServer actually made me have more free heap...
i think that's due to connection not blocked, so everything is processed asap.
Me No Dev
@me-no-dev
Mar 09 2016 20:52
yes
you do get peaks though ;) i have some optimizations lined up
i'm looking at the sync ssl client and i'm not exactly sure how the thing works
seems to be only able to do synchronous calls
i mean the ssl library is synchronous itself
@igrr @Links2004 can you confirm?
Victor Tseng
@Palatis
Mar 09 2016 21:06
no matter, we just drop in libdropbear and do the ssl stuff then XD

i just saw

 * This is a normally a blocking call - it will finish when the handshake is
 * complete (or has failed). To use in non-blocking mode, set
 * SSL_CONNECT_IN_PARTS in ssl_ctx_new().

in ssl_client_new()

should be able to do non-blocking ssl calls
Victor Tseng
@Palatis
Mar 09 2016 21:12
studying axTLS...
Harrison Mclean
@h4rm0n1c
Mar 09 2016 23:35

Ugh, DMD2 has a few digitalwrites, an analogwrite and an SPI write in my interrupt, it doesn’t crash straight away though, works for a good 8 seconds or so and then crashes with Exception 0.

I’m dreading the idea that it might be memory usage...

Harrison Mclean
@h4rm0n1c
Mar 09 2016 23:41
Or that I need half of my library in RAM...
Angus Gratton
@projectgus
Mar 09 2016 23:53
h4rm0n1c: heya
you're adding hardware SPI support?