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

Adding support for AT commands that are longer than 124 bytes #544

Open
wants to merge 1 commit into
base: Dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
recommiting: adding support for AT commands that are longer than 124 …
…bytes.
ftylitak committed Apr 28, 2021

Verified

This commit was signed with the committer’s verified signature.
blink1073 Steven Silvester
commit a5461530de7bdd53f2a130079b20f3130796dea7
28 changes: 27 additions & 1 deletion esp32/mods/modlte.c
Original file line number Diff line number Diff line change
@@ -1279,8 +1279,34 @@ STATIC mp_obj_t lte_send_at_cmd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_m
}
if (MP_OBJ_IS_STR_OR_BYTES(args[0].u_obj))
{
uint32_t timeout = LTE_RX_TIMEOUT_MAX_MS;
size_t len;
lte_push_at_command_ext((char *)(mp_obj_str_get_data(args[0].u_obj, &len)), args[1].u_int, NULL, len);
char* command = (char *)(mp_obj_str_get_data(args[0].u_obj, &len));

if(argLength > 1) {
timeout = args[1].u_int;
}

if(len <= LTE_AT_CMD_DATA_SIZE_MAX)
lte_push_at_command_ext_cont(command, timeout, NULL, len, false);
else {
size_t chunk_count = len / LTE_AT_CMD_DATA_SIZE_MAX;
size_t remaining_bytes = len % LTE_AT_CMD_DATA_SIZE_MAX;

bool expect_continuation = false;
char* chunk_start = command;
for(size_t i=0; i<chunk_count; ++i) {
expect_continuation = (i < (chunk_count - 1)) || remaining_bytes;

lte_push_at_command_ext_cont(chunk_start, timeout, NULL, LTE_AT_CMD_DATA_SIZE_MAX, expect_continuation);

chunk_start += LTE_AT_CMD_DATA_SIZE_MAX;
}

if(remaining_bytes) {
lte_push_at_command_ext_cont(chunk_start, timeout, NULL, remaining_bytes, false);
}
}
}
else
{