Skip to content

Commit ee86085

Browse files
authored
Merge pull request #22 from jerryneedell/jerryn_ping
fix ping for esp8266
2 parents 6aa1bce + d597c23 commit ee86085

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_espatcontrol/adafruit_espatcontrol.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,11 @@ def ping(self, host):
384384
"""Ping the IP or hostname given, returns ms time or None on failure"""
385385
reply = self.at_response('AT+PING="%s"' % host.strip('"'), timeout=5)
386386
for line in reply.split(b'\r\n'):
387-
if line and line.startswith(b'+PING:'):
387+
if line and line.startswith(b'+'):
388388
try:
389-
return int(line[6:])
389+
if line[1:5] == b'PING':
390+
return int(line[6:])
391+
return int(line[1:])
390392
except ValueError:
391393
return None
392394
raise RuntimeError("Couldn't ping")

0 commit comments

Comments
 (0)