picloud ping and fix big bugs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user