Hi folks,
Does anybody know how to solve a TCPClient random disconnect?
I'm running a personal weather station and uploading data to Weather Underground (WU) using a Photon 2. The Photon never drops the Wi-Fi connection ā I can always see it connected via my phone ā but the upload to WU intermittently fails.
At the top of my file, I'm trying to make sure WiFiClient maps to TCPClient, as Arduino code often uses WiFiClient successfully:
// Whenever we write WiFiClient, treat it as TCPClient.
#if defined(PARTICLE)
using WiFiClient = TCPClient;
#endif
This doesn't seem to help.
Here's how I start the Weather Underground setup:
char server[] = "rtupdate.wunderground.com";
char WEBPAGE[] = "GET /weatherstation/updateweatherstation.php?";
char ID[] = "KCAPALMD170";
char Key[] = "XXXXXXXX";
void wxUnderground()
{
TCPClient client;
...
}
To work around the issue, I implemented a watchdog, and that does work ā the device resets the WU connection, and recovers when it fails. But ideally, I want to prevent the disconnects in the first place.
Any ideas on why the TCPClient connection is dropping, or tips to make it more stable when uploading to WU?
Have a good one,
Alex