Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion app/src/sm_at_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct sm_at_host_ctx {

/* AT command reception state (for cmd_rx_handler) */
bool inside_quotes;
bool executing;
size_t at_cmd_len;
size_t echo_len;
uint8_t prev_character;
Expand Down Expand Up @@ -1128,16 +1129,20 @@ static void cmd_send(struct sm_at_host_ctx *ctx, uint8_t *buf, size_t cmd_length
return;
}

/* Block URCs while command is executing, even if idle timer triggers */
ctx->executing = true;
/* Send to modem.
* Reserve space for CRLF in the response buffer.
*/
err = nrf_modem_at_cmd(sm_response_buf + strlen(CRLF_STR),
sizeof(sm_response_buf) - strlen(CRLF_STR), "%s", at_cmd);
if (err == -SILENT_AT_COMMAND_RET) {
ctx->executing = false;
return;
} else if (err < 0) {
LOG_ERR("AT command failed: %d", err);
rsp_send_error();
ctx->executing = false;
return;
} else if (err > 0) {
LOG_ERR("AT command error (%d), type: %d: value: %d", err,
Expand All @@ -1158,6 +1163,7 @@ static void cmd_send(struct sm_at_host_ctx *ctx, uint8_t *buf, size_t cmd_length
LOG_ERR("AT command response failed: %d", err);
}
}
ctx->executing = false;
}

static size_t cmd_rx_handler(struct sm_at_host_ctx *ctx, uint8_t c)
Expand Down Expand Up @@ -1523,7 +1529,7 @@ bool in_at_mode_pipe(struct modem_pipe *pipe)
bool is_idle_ctx(struct sm_at_host_ctx *ctx)
{
return (sm_at_ctx_check(ctx) && in_at_mode_ctx(ctx) &&
k_timer_remaining_ticks(&ctx->idle_timer) == 0);
ctx->executing == false && k_timer_remaining_ticks(&ctx->idle_timer) == 0);
}

bool is_idle_pipe(struct modem_pipe *pipe)
Expand Down
2 changes: 1 addition & 1 deletion app/src/sm_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ static int handle_at_ppp(enum at_parser_cmd_type cmd_type, struct at_parser *par
} else {
rsp_send_ok();
sm_ppp_set_auto_start(false);
sm_ppp_detach();
delegate_ppp_event(PPP_STOP, PPP_REASON_CMD);
}
return -SILENT_AT_COMMAND_RET;
}
Expand Down
Loading