Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 28823aa

Browse files
committed
Update modlte.c
Properly handle AT cmd size > LTE_AT_CMD_DATA_SIZE_MAX
1 parent c473090 commit 28823aa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

esp32/mods/modlte.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,18 @@ static bool lte_push_at_command_ext_cont (char *cmd_str, uint32_t timeout, const
223223
}
224224

225225
static bool lte_push_at_command_ext(char *cmd_str, uint32_t timeout, const char *expected_rsp, size_t len) {
226-
return lte_push_at_command_ext_cont(cmd_str, timeout, expected_rsp, len, false);
226+
if (len > LTE_AT_CMD_DATA_SIZE_MAX) {
227+
uint32_t cmd_full = len / LTE_AT_CMD_DATA_SIZE_MAX;
228+
uint32_t cmd_remain = len % LTE_AT_CMD_DATA_SIZE_MAX;
229+
for (int i=0; i < cmd_full; i++) {
230+
if (!lte_push_at_command_ext_cont(cmd_str+(i*LTE_AT_CMD_DATA_SIZE_MAX), timeout, expected_rsp, LTE_AT_CMD_DATA_SIZE_MAX, true)) {
231+
return false;
232+
}
233+
}
234+
return lte_push_at_command_ext_cont(cmd_str+(cmd_full*LTE_AT_CMD_DATA_SIZE_MAX), timeout, expected_rsp, cmd_remain, false);
235+
} else {
236+
return lte_push_at_command_ext_cont(cmd_str, timeout, expected_rsp, len, false);
237+
}
227238
}
228239

229240
static bool lte_push_at_command (char *cmd_str, uint32_t timeout) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy