tcsaba101 / SG21

Adding sensor code to OS217
GNU General Public License v3.0
0 stars 0 forks source link

check_network #5

Open pbecchi opened 7 years ago

pbecchi commented 7 years ago

Check_network has been modified from original 2.1.7 code . Since ESP32 do not have a ping function like Arduinos and ESP8266 the code need to be rewritten. Could you tell me the reason for your changes and essential features you have added to this routine? If necessary a logic diagram will be usefull.

tcsaba101 commented 7 years ago

This cheking the internet connection status in 3 steps, performing a light fault detection too. Three levels of connection checking: check Ethernet controller is ok? not: FAIL, break; yes: check Router IP exist (DHCP in operation) not: FAIL, break; yes: check Internet access exists (ping local Google dns) not: FAIL yes: TRUE

The reason is the fact the EtherCard module doesn't care about the existing connection, and when a network call has launched and connection is missing it stacks at some point and after a long time comes back to the program cycle. Sometimes one cycle has been 30 secs. This way if there is no connection the Network calls are disabled and it operates as a dumb controller still the network comes back. If you need more info let me know.

pbecchi commented 7 years ago

For Esp we have a different situation : WiFi reconnect automatically We can only check with Ping to see if target is reachable (not yet on Esp32!) Then we can send PUT or GET with a timeout to avoid program hang!

tcstmarkt commented 7 years ago

That will be ok. The important is to avoid http comm when no connection.

And how Ethernet works? this will be similar to SG21: controller, router, service host. That looks the same.

pbecchi commented 7 years ago

Ethernet will be the last to develop