These are chat archives for esp8266/Arduino

6th
Dec 2015
Steve Nelson
@zenmanenergy
Dec 06 2015 02:33
Can anyone reproduce the 30 second delay I’m seeing with the WiFiAccessPoint example? issue 1153 I just want to make sure I’m not crazy.
Michael Graff
@skandragon
Dec 06 2015 06:26
Hey all. I'm having some issues with OTA updates via the ESPhttpUpdate.update() call. It seems like the TCP stream is being closed by the ESP very early, and for no reason I can discern. tcpdump shows that the ESP is closing a few seconds after data is sent from the server, then without any additional traffic, there is a pause, and the Updater reports a "Stream read timeout"
This is all in #1157
Alexandro Todeschini
@asetyde
Dec 06 2015 07:42
Hi , how can use ESP.flasherasesector to clean my eprom or all device , i need use a restore function that do this
torntrousers
@torntrousers
Dec 06 2015 09:06
@zenmanenergy i gave it a try, seems ok to me and had no big delay on the first request
rudi48
@rudi48
Dec 06 2015 10:38
Hi, I am trying to use the TelnetServer: WiFiServer TelnetServer(8266);
Unfortunately I could not find the suitable library.
What I am doing wrong?
Markus
@Links2004
Dec 06 2015 10:42
WiFiServer is part of ESP8266WiFi
rudi48
@rudi48
Dec 06 2015 10:46
Thank you Link2004, I have already "#include <WiFiServer.h>", but class "TelnetServer" is not found.
I have pulled the Arduino ESP8266 package from github at 2015-12-02.
Markus
@Links2004
Dec 06 2015 10:50
TelnetServer is no class its the name of the variable
the class name is WiFiServer
rudi48
@rudi48
Dec 06 2015 10:53
Sorry, my mistake, I could not found the variable "TelnetServer". My setup:
const uint16_t aport = 23; // standard port
WiFiServer TelnetServer(aport);
WiFiClient Telnet;
In the loop():
  if (Telnet && Telnet.connected()) {
    Telnet.println(strTime + ";" + strCelsius);
  }
rudi48
@rudi48
Dec 06 2015 11:06
I have also "#include <ESP8266WebServer.h>", maybe that is the problem. Searching...
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 11:25
good morning everyone

@Links2004 when i run my wificlient on my esp to send request to my server it's working fine but when i add an rfid to send rfid info it's also working but sometimes is prints some weird stuff Soft WDT reset

ctx: cont
sp: 3ffef920 end: 3ffefc50 offset: 01b0

stack>>>
3ffefad0: 0000001a 3ffeea18 3ffeeb04 00000030
3ffefae0: 00000008 3ffeea18 3ffeeb04 4020383f
3ffefaf0: 000004e9 3ffefbc0 3ffeea18 40203b35
3ffefb00: 3fff0938 00000000 00000000 000000ff
3ffefb10: 00000000 00000000 00000000 3ffefb90
3ffefb20: 00000001 00000007 00000000 00000000
3ffefb30: 0000001c 3ffeea18 3ffeeb04 3ffeea30
3ffefb40: 3ffeea18 3ffefbc0 3ffefbc2 40203c5a
3ffefb50: 3ffefbc2 3ffefb80 00000000 00000000
3ffefb60: 3ffeea18 3ffefbc0 3ffefbc2 40203ca9
3ffefb70: 00000000 00000000 3fff0d00 4020a822
3ffefb80: 00001107 3fff108c 3fff0d00 4020a4a1
3ffefb90: 3ffeea26 00000000 3fff0d00 3ffeea30
3ffefba0: 3fffdc20 00000000 3ffeea18 40203ce0
3ffefbb0: 402047d8 3fff0dc0 3fff0dc0 4020404c
3ffefbc0: 4002684c 3ffeea28 3fff0dc0 40202f56
3ffefbd0: 402012e6 3ffeebf4 3ffeea28 40202102
3ffefbe0: 3ffeea28 3ffeebf4 3ffeec21 402021ef
3ffefbf0: 3ffe8598 00000000 000003e8 00002cba
3ffefc00: 00000000 3fff0dc0 3fff0df8 0000000f
3ffefc10: 00000000 00000000 00000016 4010174d
3ffefc20: 40204895 0f00a8c0 00000000 3ffeec28
3ffefc30: 3fffdc20 00000000 3ffeec21 402048bd
3ffefc40: 00000000 00000000 3ffeec30 40100114
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

and everything starts over again
Markus
@Links2004
Dec 06 2015 11:33
@Hassanbenlebsir can you post you code, may there a some delay needed
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 11:50

/*

  • This sketch sends a message to a TCP server
    /

    include <SPI.h>

    include "MFRC522.h"

    include <ESP8266WiFi.h>

    include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti WiFiMulti;
// declaration
byte myCards[] = {0x06,0x28,0xFE,0xE5,
0x44,0x71,0x2D,0xA4};

int successRead; //if we get a succesful read of the card this variable turn to 1 and if we didn't 0

byte dummy = 0x00;

byte readCard[4]; // Stores scanned ID read from RFID Module

define RST_PIN 4 // RST-PIN für RC522 - RFID - SPI - Modul GPIO15

define SS_PIN 2 // SDA-PIN für RC522 - RFID - SPI - Modul GPIO2

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

//fonc
void setup() {
Serial.begin(115200);
delay(10);
SPI.begin();
mfrc522.PCD_Init(); // Init MFRC522
// We start by connecting to a WiFi network
WiFiMulti.addAP("virginmedia8953826", "pmafvcty");

Serial.println();
Serial.println();
Serial.print("Wait for WiFi... ");

while(WiFiMulti.run() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

delay(500);

}
int getID() {
// Getting ready for Reading PICCs
if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue
return 0;
}
if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and continue
return 0;
}

//Serial.println("Scanned UID:");
for (int i = 0; i < 4; i++) { //
readCard[i] = mfrc522.uid.uidByte[i];
//Serial.print(readCard[i], HEX);
}
//Serial.println("");
mfrc522.PICC_HaltA(); // Stop reading
return 1;
}

void Success(){

}

void Error(){
Serial.println("Stranger");

}

void loop() {
const uint16_t port = 2222;
const char * host = "192.168.0.21"; // ip or dns

 do{    
successRead = getID();
}
while (!successRead); 


Serial.print("connecting to ");
Serial.println(host);

// Use WiFiClient class to create TCP connections
WiFiClient client;

if (!client.connect(host, port)) {
    Serial.println("connection failed");
    Serial.println("wait 5 sec...");
    delay(5000);
    return;
}
if (readCard[0] == myCards[4] && readCard[1] == myCards[5] 

&& readCard2 == myCards[6] && readCard3 == myCards[7]) //checking for blue card
{

Serial.println("Jose Molina perez");

Success();

for(int i = 0; i<4; i++) dummy = readCard[i]; // removing previous stored value from the readCard variable

successRead = 0;
}else if(readCard[0] == myCards[0] && readCard1 == myCards1
&& readCard2 == myCards2 && readCard3 == myCards3) //checking for white card
{
client.print("username + :has connected.:Connect:+lastname+:+txt_Time.getText()");//normal message

Success();      //calling the success function

for(int i = 0; i<4; i++) dummy = readCard[i];  // removing previous stored value from the readCard variable

}
else {

Error();      //calling the error function

}
// This will send the request to the server

//read back one line from server
String line = client.readStringUntil('\r');
client.println(line);

Serial.println("closing connection");
//client.stop();

Serial.println("wait 5 sec...");
delay(5000);

}

Markus
@Links2004
Dec 06 2015 11:51
please use Markdown
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 11:51
oesp i'm sorry
Markus
@Links2004
Dec 06 2015 11:53
you can edit your post, so its no problem ;)
blob
blob
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 12:01
the code must be in the formatted section?
Markus
@Links2004
Dec 06 2015 12:01
the whole line is code
there who var code ... is you need to place your c++ code
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 12:04
sorry i'm not german i'm dutch haha
i clicked edit and after o the markdown
what should i do after?
Markus
@Links2004
Dec 06 2015 12:05
This message was deleted
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 12:06
should i write var code before the code or var code="code"
Markus
@Links2004
Dec 06 2015 12:06
no
the var code is an example
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 12:07
aah ok
can i send it true email is that not better?
by email
i add a delay here:
    do {
        successRead = getID();
        delay(0); // new 
    } while(!successRead);
brutzler
@brutzler
Dec 06 2015 12:15
Can I read out what radiochannel the ESP actually uses? Or more informations e.g. radio strength?
Markus
@Links2004
Dec 06 2015 12:16
yes,
WiFi.channel();  
WiFi.RSSI();
brutzler
@brutzler
Dec 06 2015 12:17
thx....will try....
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 12:22
Thanx @Links2004 can you plz explain what was the essue
brutzler
@brutzler
Dec 06 2015 12:23
working :-) RSSI-value is negative. ok... will have its reason!?
And have seen, when switching off the AP nearby ESP8266 is changing to mainrouter. But it is not changing, to the stronger signal, when restarting the AP again.
This means: no active rescan for the better signal, but rescan on signal loss.
Markus
@Links2004
Dec 06 2015 12:23
the do while where blocking the SDK from running with the delay inside the SDK / networkstack get time to work and all is good
@brutzler its in dbm, the rssi is only updatet when packages coming in.
when there where a rescan you will loss the connection.
scanning an holding the connection is not possible at the same time (ask espressif why)
brutzler
@brutzler
Dec 06 2015 12:28
but higher values means better signal? Hope so!
Markus
@Links2004
Dec 06 2015 12:29
yes (less negativ is better)
brutzler
@brutzler
Dec 06 2015 12:32
hmmm
-46 for the AP 20cm nearby?
-94 for a router 10m away. only one brick wall between.....
Markus
@Links2004
Dec 06 2015 12:32
yes all good -46 is less negative the -94 ;)
Chris Elsworth
@celsworth
Dec 06 2015 12:33
remember its an exponential scale as well
brutzler
@brutzler
Dec 06 2015 12:34
yes, but theoretical "0" would be best. Therefore -46 is imho not too good for this little distance...
Chris Elsworth
@celsworth
Dec 06 2015 12:34
assuming it starts at 0
best I've ever seen is -30 or so, I think, with the module sat on the router
Markus
@Links2004
Dec 06 2015 12:35
yes but we looking here at a analog signal you will always have interference
Chris Elsworth
@celsworth
Dec 06 2015 12:35
honestly there's not much you can do about it other than get a more powerful router, so..
if it works, why worry
brutzler
@brutzler
Dec 06 2015 12:36
@brutzler its in dbm, the rssi is only updatet when packages coming in.
Sure? I look at it every 5 seconds, and the values are aleays changing. No (known) network traffic to the ESP.
Markus
@Links2004
Dec 06 2015 12:36
more power not mean better, at some point you "overload" the input signal handling and noting will work
Chris Elsworth
@celsworth
Dec 06 2015 12:37
maybe, but I've never seen that happen to be honest.. works fine right next to the router (apple airport extreme)
brutzler
@brutzler
Dec 06 2015 12:37
I do not worry, I only looking for explanations ;-)
Markus
@Links2004
Dec 06 2015 12:37
@brutzler the AP announce itself that also a package
"package" is not only referring to TCP or UDP data here ;)
brutzler
@brutzler
Dec 06 2015 12:38
OK, thx
anybody knows a good android tool for getting detailed radio infos of the WLAN?
Markus
@Links2004
Dec 06 2015 12:39
@celsworth with a home router you will not get to this point to less power there.
@brutzler i use Wifianalyzer
brutzler
@brutzler
Dec 06 2015 12:40
will try
OMG there are plenty of "Wifianalyzers" which one do you use exactly?
farproc, webprovider...
brutzler
@brutzler
Dec 06 2015 12:45
ok farproc...
brutzler
@brutzler
Dec 06 2015 13:11
A lot of infos :-) But do I see what is the actual AP, I am connected to?
Markus
@Links2004
Dec 06 2015 13:39
@brutzler in the ap list of the left side i have this infos
brutzler
@brutzler
Dec 06 2015 14:00
back to AP-choice: a reset (button on the NodeMCU or reboot from the IDE) makes the ESP only take the last of two available APs. Even if it is the worse Signal.
Only a Power OFF/ON makes my ESP to take the AP with the better signal.
Markus
@Links2004
Dec 06 2015 14:02
I have work around this problem with:
ESP8266WiFiMulti
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino
it selects the best AP :)
brutzler
@brutzler
Dec 06 2015 16:29

OK, I only use the normal ESP8266Wifi.h

Can this work with two different APs and with the same SSID/PW?

    wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1");
    wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
    wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
Markus
@Links2004
Dec 06 2015 16:30
yes, then you need the line only once.
brutzler
@brutzler
Dec 06 2015 16:43

No...doesn't come back to the better AP. Loop() is this:

void loop() {
    if(wifiMulti.run() != WL_CONNECTED) {
        Serial.println("WiFi not connected!");
        delay(1000);
    }
    Serial << "Funkkanal: " << WiFi.channel() << endl; 
    Serial << "Signalstaerke: " << WiFi.RSSI() << endl;   
    delay(3000);
}

Starting -> connecting to the better AP. Switching off the better AP -> changing to the second AP. Switching on the first AP -> still connected to the second (worse) AP.
And I have only one line with SSID/PW

Markus
@Links2004
Dec 06 2015 17:37
the switch back only happens when the connection get lost
Michael Graff
@skandragon
Dec 06 2015 17:54
I'm really quite convinced that large data streams on the ESP always result in failure. That is, the ESP eventually closes the stream, but it feels like at a lower level than the Arduino code, and then the Arduino code times out.
Markus
@Links2004
Dec 06 2015 17:55
do you get a LmacRxBlk, when debug is enabled?
Michael Graff
@skandragon
Dec 06 2015 17:56
Which form of debugging?
Markus
@Links2004
Dec 06 2015 17:56
Serial.setDebugOutput(true);
Michael Graff
@skandragon
Dec 06 2015 17:56
Let me check the gist I attached to that issue :)
Nope.
Markus
@Links2004
Dec 06 2015 17:57
you also can link to the issue :)
Michael Graff
@skandragon
Dec 06 2015 17:57
This is the nginx one. #1157
Markus
@Links2004
Dec 06 2015 17:59
large data streams are general possible, i have a VNC client running on the ESP.
without problems.
Michael Graff
@skandragon
Dec 06 2015 17:59
Is that primary sending or receiving?
Markus
@Links2004
Dec 06 2015 17:59
the most reason for problem is that the SDK / lwip has to less time.
its most receiving
Michael Graff
@skandragon
Dec 06 2015 18:00
hmm. So is this.
brutzler
@brutzler
Dec 06 2015 18:01
--> the switch back only happens when the connection get lost
Then its the same for me as with the normal WiFi.
But its OK!
Michael Graff
@skandragon
Dec 06 2015 18:02
I'm having two different issues really here. One is that the updates seem to fail, and two I'm getting a WDT killing my code, I assume in the loop.
(long code post coming up)
Ivan Grokhotkov
@igrr
Dec 06 2015 18:03
@skandragon can you give me an URL of this nginx server where you get the binary from?
Michael Graff
@skandragon
Dec 06 2015 18:04
This message was deleted
Markus
@Links2004
Dec 06 2015 18:04
for long code use https://gist.github.com/
@igrr, I can, but you can only reach it if you have IPv6. Do you?
Ivan Grokhotkov
@igrr
Dec 06 2015 18:05
I do, but ESP doesn't.
ok, never mind
Michael Graff
@skandragon
Dec 06 2015 18:06
I know the ESP doesn't have V6, but it's behind a NAT here at home, and while it's reachable externally via V6, it's not via V4.
Markus
@Links2004
Dec 06 2015 18:07
@skandragon the code looks not complete.
note: if you name it ".cpp" it get code highlighting
Michael Graff
@skandragon
Dec 06 2015 18:07
I know it's not complete, but it's the lifting part.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:07
I did quite a few updates by pulling binaries from github over HTTPS, and i don't know what github is using for a server. It would be nice to figure out what goes wrong in your environment.
Michael Graff
@skandragon
Dec 06 2015 18:07
@igrr, true story :)
I could put this binary somewhere else (I still have an apache laying around somewhere off-site) but here's what seems to be happening.
(and this is in the tcpdump)
The transfer is going along fine, but then suddenly the ESP sends a FIN (which is fine, it can close its side) and then starts sending resets.
Only AFTER that does the update code claim the timeout has occurred.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:11
how did you figure out the sequence of events?
Michael Graff
@skandragon
Dec 06 2015 18:12
tcpdump, and increasing the read timeout in the update code from 2 seconds to 10 seconds.
Watching tcpdump, I see data flow and then without a pause in the timing, the ESP sends out a FIN followed by three RST. This happens every time it fails. The update tries longer, but once that happens it will time out.
I'm not new to programming network apps, and I'm not new to programming at all. I am new to the ESP, and somewhat new to the Arduino. I know there are lots of quirks in the ESP that sometimes cause issues with "standard" Arduino code.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:17
That's an interesting observation, given that there are no errors from network stack reported (i'm looking at your "failure" log).
Michael Graff
@skandragon
Dec 06 2015 18:17
The WDT is one; but I am exiting the loop. I originally had a standard Arduino while (client->connected()) { while (client->available()) { read, do things }} loop, but this meant the loop never returned.
@igrr, now you know why I'm totally confused.
I can reproduce this problem trivially.
Which is annoying, but also great for debugging. :)
Ivan Grokhotkov
@igrr
Dec 06 2015 18:18
ok, i think WDT is a separate issue. let's not mix stuff :) Also client->available() does guard against WDT inside, so the issue is somewhere else.
https://gist.github.com/skandragon/f22078c2337db4b3ed18
I can't compile this, it looks like only a part of a sketch
could you post something that I could use to reproduce as well?
Michael Graff
@skandragon
Dec 06 2015 18:20
It's only partial; let me strip out the lifting part and see if it still fails. If it does, then I have a compilable gist I can upload.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:20
Cool, thanks.
Michael Graff
@skandragon
Dec 06 2015 18:28
This is what debugging at 5am does for you. I am wrong about the sequence of events. Hold please.
(five monitors is sometimes too many...)
No, I'm right (and wrong)
Once the update fails, it fails consistently. The tcpdump I attached to that ticket is from a repeated attempt at an upgrade.
18:28:54.222408 IP 10.42.120.1.80 > 10.42.0.47.4098: Flags [P.], seq 5841:7301, ack 342, win 30016, length 1460
18:28:54.222422 IP 10.42.120.1.80 > 10.42.0.47.4098: Flags [.], seq 7301:8761, ack 342, win 30016, length 1460
18:28:54.222430 IP 10.42.120.1.80 > 10.42.0.47.4098: Flags [.], seq 8761:10221, ack 342, win 30016, length 1460
18:28:54.222438 IP 10.42.120.1.80 > 10.42.0.47.4098: Flags [P.], seq 10221:11681, ack 342, win 30016, length 1460
18:28:54.222446 IP 10.42.0.47.4098 > 10.42.120.1.80: Flags [F.], seq 342, ack 5841, win 5840, length 0
18:28:54.225931 IP 10.42.0.47.4098 > 10.42.120.1.80: Flags [R.], seq 343, ack 7301, win 5840, length 0
18:28:54.230699 IP 10.42.0.47.4098 > 10.42.120.1.80: Flags [R.], seq 342, ack 8761, win 5840, length 0
18:28:54.230721 IP 10.42.0.47.4098 > 10.42.120.1.80: Flags [R.], seq 342, ack 10221, win 5840, length 0
18:28:54.231885 IP 10.42.0.47.4098 > 10.42.120.1.80: Flags [R.], seq 342, ack 11681, win 5840, length 0
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 18:32
goof evening all @Links2004 about the code i sent you earlier u see that i sent a message to my server with client.print how can i start a socket communication from the client side is there a command? in java i'll i do is include the socket libary and open a socket server with this line of code sock = new Socket(ip, port);
@igrr how do i open a client tcp communication with an esp8266
first line creates a connection object (like Socket in Java)
next line opens a connection
Alexandro Todeschini
@asetyde
Dec 06 2015 18:45
Screen Shot 2015-12-06 at 19.41.28.png
@igrr i've found sdk description of wdtfeed but no alf wit enable (millisecond -> 6000 6 sec ? )
Screen Shot 2015-12-06 at 19.41.53.png
is sdk 1.5 but is same of all sdk description
Michael Graff
@skandragon
Dec 06 2015 18:50
@igrr, well if I don't actually update the LEDs, I get no timeout. However, that doesn't make me get what's broken any better as that code basically shifts out the bits in a bit-bang fashion. I wonder if it's not properly yielding enough.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:51
Are LEDs required to reproduce the issue?
Michael Graff
@skandragon
Dec 06 2015 18:51
For the WDT yes
For the update, no.
I think. Let me ensure that.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:51
i.e. if you don't have LEDs connected, will it crash?
Michael Graff
@skandragon
Dec 06 2015 18:52
LEDs are connected in all cases, I'm just not updating them.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:52
(i.e., if you give me the code that crashes, can I run it without LEDs?)
Michael Graff
@skandragon
Dec 06 2015 18:53
I can't get the WDT timer to trigger with LED updating code #if'd out.
It still fails to pull an update though, so that part is still broken. Let me make a gist.
Ivan Grokhotkov
@igrr
Dec 06 2015 18:53
I mean, if I run LED updating code without the actual LEDs connected, will I be able to reproduce your WDT issue?
Michael Graff
@skandragon
Dec 06 2015 18:55
hmm, yes.
But you need an external lib to drive them.
(which I have made mods to... of course)
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 18:59
@igrr i opened the connection and i don't want it to stop so i commented the client.stop(); but even doing that it keeps opening connection when it goes back in the loop i want ti to start a connection just even there is no connection already opened
Endre Karlson
@ekarlso
Dec 06 2015 18:59
@igrr concidered doing OTA like Particle does it using CoaP and DTLS ?
Ivan Grokhotkov
@igrr
Dec 06 2015 19:01
@Hassanbenlebsir just move client to global scope and check if it's connected
WiFiClient client;
void loop() {
    if (!client.connected()) { client.connect(....); }
    // do stuff with client
}
@ekarlso we don't have DTLS on the ESP.
Michael Graff
@skandragon
Dec 06 2015 19:02
(check a second time too, the connect can fail)
DTLS isn't that difficult, but its application-level fragmentation is annoyingly a resource hog.
Markus
@Links2004
Dec 06 2015 19:04
@ekarlso OTA over https is possible, then its encrypted and the cert can be pined.
Michael Graff
@skandragon
Dec 06 2015 19:04
@igrr How do I get a multi-file sketch do you in the easiest way? :)
Ivan Grokhotkov
@igrr
Dec 06 2015 19:15
zip it and drag'n'drop here
Michael Graff
@skandragon
Dec 06 2015 19:20
There ya go.
In theory that's self-contained.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:23
Ok, compiled and flashed.
Now how would i go about triggering a WDT?
Michael Graff
@skandragon
Dec 06 2015 19:24
Edit the ruby "controller.rb" script to point to your device, and run it. Wait about 10-20 seconds.
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 19:29
is there a way to debug a file in arduino ide?
Michael Graff
@skandragon
Dec 06 2015 19:30
It's not so much an IDE as an editor, from my experience...
And not a very good editor.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:32
Oh...
Michael Graff
@skandragon
Dec 06 2015 19:32
@igrr, I'm running the device @ 160 Mhz too, if that matters
Ivan Grokhotkov
@igrr
Dec 06 2015 19:32
you are using noInterrupts
Markus
@Links2004
Dec 06 2015 19:32
yes, no debugging, but Realtime debugging on the ESP itself is very hard to impossible,
best way is to xtensa-lx106-elf-obdjump after a stack trace to see where it happend.
Michael Graff
@skandragon
Dec 06 2015 19:32
That section of code should be less than 900 uS long though
Ivan Grokhotkov
@igrr
Dec 06 2015 19:32
no wonder it crashes
The latest SDK changelog mentioned that you shouldn't disable interrupts for more than 20us
Michael Graff
@skandragon
Dec 06 2015 19:33
huh.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:33
let me look it up for you.
Michael Graff
@skandragon
Dec 06 2015 19:33
How can I ensure timing is accurate when bit-banging then?
Ivan Grokhotkov
@igrr
Dec 06 2015 19:33
You can't
Michael Graff
@skandragon
Dec 06 2015 19:33
well then, I guess it's back to an actual Arduino. :/
Ivan Grokhotkov
@igrr
Dec 06 2015 19:33
This is why libraries like NeoPixel now use UART, SPI and I2S peripherals to achieve accurate timing
This behaviour has changed between SDK 1.1 and 1.2 i think. Before that, you were allowed to disable interrupts for long periods of time, and the system didn't detect that.
Michael Graff
@skandragon
Dec 06 2015 19:35
Sure, but then there's existing hardware that isn't SPI or i2c...
I could go back to my old plan of feeding data to an Arduino (which can do actual timing on real world devices) and use the the esp only to feed data to it.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:37
Well, that's true, and I understand your need for accurate timing.
This is always an issue in single-core systems that happen to run radio communication protocols in software. The best thing SDK designers can do is to open some sort of timeslot mechanism for you.
This is how Nordic does it in their nRF51/52 series for instance.
Michael Graff
@skandragon
Dec 06 2015 19:38
I wonder if the timing is "good enough" if I just don't disable interrupts.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:39
You may try that. Or just have an I2C bridge to an AVR arduino driving LEDs for you.
Michael Graff
@skandragon
Dec 06 2015 19:39
I thought the ESP i2c uses bit-banging still :)
Ivan Grokhotkov
@igrr
Dec 06 2015 19:40
That's true, but i2c isn't affected by inaccurate timing, so it doesn't need to disable interrupts.
Michael Graff
@skandragon
Dec 06 2015 19:40
True.
Well, sort of true.
Ivan Grokhotkov
@igrr
Dec 06 2015 19:40
here's an example of I2C bridge to Arduino:
https://github.com/esp8266/Arduino/tree/master/variants/wifio
Michael Graff
@skandragon
Dec 06 2015 19:41
I'm also the one who had some serious issues with clock stretching on the ESP.
So far just not disabling interrupts seems to work well enough.
Thanks for the WDT help, @igrr. Any idea what's going on with the update? :)
Ivan Grokhotkov
@igrr
Dec 06 2015 19:45
If you can help me reproduce that, I might have some ideas. Perhaps forward an external port to your server or something?
Michael Graff
@skandragon
Dec 06 2015 19:45
I could also see if I can put the binary on an externally reachable nginx and reproduce it there.
I'll open a hole. Just a sec.
Can I send private messages here? :)
Markus
@Links2004
Dec 06 2015 19:49
click on the avatare
Ivan Grokhotkov
@igrr
Dec 06 2015 19:49
sure, click my user pic and the click "chat privately" in the popup
Michael Graff
@skandragon
Dec 06 2015 19:49
I tried clicking on your name, didn't think to use the avatar. heh.
Mario Mikočević
@mozgy
Dec 06 2015 19:51
@igrr dst is not yet implemented in time.c ?
Michael Graff
@skandragon
Dec 06 2015 19:52
time zones are really hard.
Michael Graff
@skandragon
Dec 06 2015 20:00
Does readBytes() always return the proper number, or can it also fail in non-socket-error conditions?
The Arduino API docs are really rotten, like no return values shown...
Markus
@Links2004
Dec 06 2015 20:01
readBytes read all possible can be less then you want eaven 0
Michael Graff
@skandragon
Dec 06 2015 20:04
I'm pretty sure the socket should not be starving for data. I'm basically keeping it full, so full in fact that if I stop my sender, my local OS buffers for another 20 seconds of data headed to the ESP. heh.
I suppose it's time to implement yet another read_fully() method.
Markus
@Links2004
Dec 06 2015 20:06
tcp.read((uint8_t*) out, tcp.available()); `read all that is there.
Michael Graff
@skandragon
Dec 06 2015 20:12
Sure, but if I am sending data faster than the application can process it, there should always be at least those 5 bytes available or available before the 1 second default timeout expires.
Short of a network issue of course. I will just have to implement a read_fully() which will return only after it guarantees a full read, or the socket is disconnected. It'd be nice if SDKs just implemented this sort of thing... but it seems like every time I touch networking code, I end up writing it again.
Michael Graff
@skandragon
Dec 06 2015 20:29
What's the easiest way to use what is currently on master? Build it and rsync from the build tree to my running arduino area?
Never mind, found the easy to follow docs. :)
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 21:23
switch(cansend){
case 1: WiFiClient client;
        client.connect(host, port); 
        delay(5000);
        client.print("username + :has connected.:Connect:+lastname+:+txt_Time.getText()"); 
        cansend=2;
        break; 
case 2: client.stop();
        client.print("username + : :Disconnect:+ lastname + :ClockedOut at :+txt_Time.getText()");   
        cansend=1;
        break;
}
isi'm trying to test this code but it keeps giving me an error
error: jump to case label [-fpermissive]
Markus
@Links2004
Dec 06 2015 21:26
thats ok you need to define WiFiClient client; out side of the function
Hassanbenlebsir
@Hassanbenlebsir
Dec 06 2015 21:35
yes now no error but not shows at the server side
but no worries no fear i'll find away
i declared cansend=1 so normally it should go in case 1: connect to the server and send the message
Stavros Korokithakis
@skorokithakis
Dec 06 2015 23:58
guys
i made a pastebin
what do you think? https://www.pastery.net/cqgdcg/