diff --git a/esp32/mods/modlte.c b/esp32/mods/modlte.c index 5afdc7e9c..3ed5f756e 100644 --- a/esp32/mods/modlte.c +++ b/esp32/mods/modlte.c @@ -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