Skip to content

Commit c0275d9

Browse files
author
brentru
committed
eat lines in enumerate sms code
1 parent adc94d5 commit c0275d9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

adafruit_fona/adafruit_fona.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575

7676
# pylint: enable=bad-whitespace
7777

78+
7879
# pylint: disable=too-many-instance-attributes, too-many-public-methods
7980
class FONA:
8081
"""CircuitPython FONA module interface.
@@ -500,6 +501,10 @@ def send_sms(self, phone_number, message):
500501
:param str message: Message to send to the phone number.
501502
502503
"""
504+
self._read_line()
505+
self._read_line()
506+
# TODO: Assert phone number is an INT
507+
503508
# select SMS message format, text mode (4.2.2)
504509
if not self._send_check_reply(b"AT+CMGF=1", reply=REPLY_OK):
505510
return False
@@ -548,14 +553,19 @@ def num_sms(self, sim_storage=True):
548553
else:
549554
if self._send_parse_reply(b"AT+CPMS?", FONA_SMS_STORAGE_INTERNAL + b",", idx=1):
550555
return self._buf
556+
557+
self._read_line() # eat OK
551558
if self._send_parse_reply(b"AT+CPMS?", b"\"SM\",", idx=1):
552559
return self._buf
560+
561+
self._read_line() # eat OK
553562
if self._send_parse_reply(b"AT+CPMS?", b"\"SM_P\",", idx=1):
554563
return self._buf
555564
return False
556565

557566
def delete_all_sms(self):
558567
"""Deletes all SMS messages on the FONA SIM."""
568+
self._read_line()
559569
# text mode
560570
if not self._send_check_reply(b"AT+CMGF=1", reply=REPLY_OK):
561571
return False
@@ -593,8 +603,6 @@ def read_sms(self, sms_slot):
593603
594604
"""
595605
self._read_line()
596-
self._read_line()
597-
598606

599607
# text mode
600608
if not self._send_check_reply(b"AT+CMGF=1", reply=REPLY_OK):

0 commit comments

Comments
 (0)