These are chat archives for esp8266/Arduino

6th
Sep 2015
Holger Lembke
@holgerlembke
Sep 06 2015 08:04
@Juppit that worked. thanks.
personally I think the need to install bonjour is a major pain in corporate environments. I would prefer something with edible hostname or ip... something like a lowest common working solution: before uploading, a input box pops up and asks for hostname/ip (and remembers this the next time it pops up).
Ivan Grokhotkov
@igrr
Sep 06 2015 08:37
you still need some service discovery mechanism to find the board's IP address. this is either mDNS or SSDP if you are in a Windows environment.
Arduino IDE uses mDNS, but perhaps they can add SSDP support
also you can run python upload script manually bif you happen to know the IP address somehow.
brutzler
@brutzler
Sep 06 2015 09:41
Hi, just starting to work with the ESP8266Webserver library. Want to transfer an old software from an arduino with ethernet-shield. Have seen, there are some examples. But is there a matching doc? Especially difference between "server.send" <> "server.sendcontent". The second one I only found in the SD-Example, and in the header of the src. No keyword for this. On github and in the doc of Neil Kolban I didn't find anything :worried:
Markus
@Links2004
Sep 06 2015 10:01
server.send generates the HTTP header and server.sendcontent does not
brutzler
@brutzler
Sep 06 2015 10:04
Does this mean I do not need any more to send the following (from my arduino code)?
// send a standard http response header
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));
client.println(F("Connnection: close"));
client.println(F("Refresh: 60")); // refresh the page automatically every 60 sec
client.println();
Markus
@Links2004
Sep 06 2015 10:04
yes :)
brutzler
@brutzler
Sep 06 2015 10:04
but does server.send contain e.g. the refresh command?
hmmm... If I only use the send.content, I could replace it in every line against the client.println?? Is this right?
brutzler
@brutzler
Sep 06 2015 10:11
Why is there an extra sendHeader? Is this needed? With client.println in my old software, I didnt make any difference between sending header or body lines
Markus
@Links2004
Sep 06 2015 10:13
you can still use client.println the sendHeader and sendcontent is there to optimist the data rate and make it easyer to use.
the println and print send a tcp package on every call so you generate a loots of overhead.
Holger Lembke
@holgerlembke
Sep 06 2015 10:16
@igrr I don't have much confident in arduino-ide-development team... (is there a team? like in ppl having a concept and working structured together?). last thing they did was bundeling the ide with their local java installation. brings back old times with ctrl3d.dll. having at least two java engines on a system, probably both outdated.
brutzler
@brutzler
Sep 06 2015 10:16
ah ok. thx for feedback. will try. is there a limit of characters on every "sendContent"?
Markus
@Links2004
Sep 06 2015 10:18
no limit
the TCP MTU limit is handled automatically
brutzler
@brutzler
Sep 06 2015 10:23
oh sounds good. propably only a limit with the char(temp)-string in the SRAM
Markus
@Links2004
Sep 06 2015 10:24
you can use progmem and sendContent_P :)
brutzler
@brutzler
Sep 06 2015 10:26
Is there somewhere an example for this? And I consider every sendContenten will cause an extra TCP-telegram?
....sendContent....
Markus
@Links2004
Sep 06 2015 10:27
yes, 1 minimum
the sendContent_P is used like sendContent but the data is decelerated like
const char data[] PROGMEM = "TEST1234 PROGMEM DATA";
brutzler
@brutzler
Sep 06 2015 10:28
ok thx so far. will try...brb
Jens J.
@zerog2k
Sep 06 2015 17:35
anybody know how to use PROGMEM decoration on an include file? I know with avr arduino i had to include <avr/pgmspace.h>, wondering what the equivalent for esp
Markus
@Links2004
Sep 06 2015 17:35
#include <pgmspace.h>
Jens J.
@zerog2k
Sep 06 2015 17:35
aww... so easy thanks !
Holger Lembke
@holgerlembke
Sep 06 2015 21:08
is there anything I have to do if I want to use
udp.parsePacket();
I took the ntp sample and divided the loop-parts into two parts: on that sends the request and on that waits for the request.
the waiter is called from loop with something like that:
void receiverWorkerNTP(void)
{
  int cb = udp.parsePacket();
  if (cb == NTP_PACKET_SIZE) {
  ....
}
problem is: ntp sample instantly works, my things randomly works....
I didn't change any code. Only removed the delays and converted it to ticker-counts.
Holger Lembke
@holgerlembke
Sep 06 2015 21:44
Not really helping, but I suggest to add to the ntpclient.code:
void loop()
{
  //get a random server from the pool
  if (!WiFi.hostByName(ntpServerName, timeServerIP)) {
    Serial.println("Hostname lookup failed"); 
    return;
  }
Holger Lembke
@holgerlembke
Sep 06 2015 21:53
And what seems to solve my problem: I now count the failed requests and after 3 fails I do
udp.stopAll();
udp.begin(localPort);
And now I go to bed.