From 12779a38e7a644da4b62d513b223988556fe2882 Mon Sep 17 00:00:00 2001 From: henriquebueno1996 Date: Wed, 10 Jul 2024 12:08:08 -0300 Subject: [PATCH] fix: possibility of identfy the "+CIPRXGET: 4" response for the "AT+CIPRXGET=4,0" command, even if modem returns "+CIPRXGET: 1" and "+CIPRXGET: 4" in the same response Sometimes, the SIM7000 modem returns "+CIPRXGET: 1" and "+CIPRXGET: 4" in the same response for the command AT+CIPRXGET=4,0. This commit resolves this situation --- src/TinyGsmClientSIM7000.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index dc2ab41d..f5be48cf 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -412,9 +412,16 @@ class TinyGsmSim7000 : public TinyGsmSim70xx, sendAT(GF("+CIPRXGET=4,"), mux); size_t result = 0; + if (waitResponse(GF("+CIPRXGET:")) == 1) { - streamSkipUntil(','); // Skip mode 4 + int16_t first_mode_to_appear = streamGetIntBefore(','); // Skip and get first mode to appear + streamSkipUntil(','); // Skip mux + + if (first_mode_to_appear == 1) { + streamSkipUntil(','); // Skip last comma, if appears +CIPRXGET: 1,0 first than +CIPRXGET: 4 in response + } + result = streamGetIntBefore('\n'); waitResponse(); }