picloud ping and fix big bugs

This commit is contained in:
2021-08-19 18:13:05 +03:00
parent f5af8a1da9
commit 4c0530d89a
13 changed files with 58 additions and 30 deletions

View File

@@ -32,6 +32,9 @@ PICloudServer::PICloudServer(const PIString & path, PIIODevice::DeviceMode mode)
opened_ = false;
piMSleep(100);
});
CONNECTL(&ping_timer, tickEvent, [this] (void *, int){
if (eth.isConnected()) tcp.sendPing();
});
}
@@ -58,8 +61,10 @@ bool PICloudServer::openDevice() {
bool op = eth.connect(PIEthernet::Address::resolve(path()), false);
if (op) {
eth.startThreadedRead();
ping_timer.start(5000);
return true;
}
ping_timer.stop();
eth.close();
return false;
}