From 82832a1d3e30f27bd88733b11ed8fe06a73b80ce Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 9 Aug 2020 16:52:05 +0200 Subject: sms send wait for prompt --- fw/esp32/components/eos/cell_sms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'fw/esp32/components/eos/cell_sms.c') diff --git a/fw/esp32/components/eos/cell_sms.c b/fw/esp32/components/eos/cell_sms.c index eeb80a5..1333973 100644 --- a/fw/esp32/components/eos/cell_sms.c +++ b/fw/esp32/components/eos/cell_sms.c @@ -182,6 +182,7 @@ static int sms_encode(unsigned char *buffer, uint16_t size) { void eos_cell_sms_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) { int rv; + char b[4]; buffer += 1; size -= 1; @@ -227,8 +228,11 @@ void eos_cell_sms_handler(unsigned char mtype, unsigned char *buffer, uint16_t s rv = eos_modem_take(1000); if (rv) return; at_cmd(cmd); + // wait for: '> ' (0d 0a 3e 20) + eos_modem_read(b, 4, 1000); at_cmd(pdu); - rv = at_expect("^OK", "^ERROR", 1000); + rv = at_expect("^\\+CMGS: [0-9]+", "^ERROR", 5000); + if (rv == 1) rv = at_expect("^OK", "^ERROR", 1000); eos_modem_give(); break; -- cgit v1.2.3