Skip to content

Commit 6189d64

Browse files
author
brentru
committed
oneline the uart write
1 parent ebd9b36 commit 6189d64

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

adafruit_fona/adafruit_fona.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@
6767
FONA_HTTP_POST = const(0x01)
6868
FONA_HTTP_HEAD = const(0x02)
6969

70-
# TCP/IP
71-
TCP_MODE = const(0)
72-
UDP_MODE = const(1)
73-
7470
FONA_MAX_SOCKETS = const(6)
7571

7672
# pylint: enable=bad-whitespace
@@ -83,6 +79,10 @@ class FONA:
8379
:param bool debug: Enable debugging output.
8480
8581
"""
82+
83+
# Connection modes
84+
TCP_MODE = const(0)
85+
UDP_MODE = const(1)
8686

8787
# pylint: disable=too-many-arguments
8888
def __init__(self, uart, rst, debug=False):
@@ -513,11 +513,8 @@ def get_host_by_name(self, hostname):
513513
if isinstance(hostname, str):
514514
hostname = bytes(hostname, "utf-8")
515515

516-
self._uart.write(b'AT+CDNSGIP=')
517-
self._uart.write(b'"')
518-
self._uart.write(hostname)
519-
self._uart.write(b'"')
520-
self._uart.write(b"\r\n")
516+
self._uart.write(b'AT+CDNSGIP="' + hostname + b'"\r\n')
517+
521518

522519
if not self._expect_reply(REPLY_OK):
523520
print("retin")

0 commit comments

Comments
 (0)