Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[PYFW-356] support for sending bytes in lte.send_at_cmd() #close
# Conflicts:
#	esp32/lte/lteppp.c
#	esp32/mods/modlte.c
  • Loading branch information
iwahdan88 committed Oct 30, 2019
commit 5f6d7b2a7a61438d17e59ce22b4d26b14e37926c
14 changes: 4 additions & 10 deletions esp32/lte/lteppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,6 @@ void lteppp_send_at_command (lte_task_cmd_data_t *cmd, lte_task_rsp_data_t *rsp)
xQueueReceive(xRxQueue, rsp, (TickType_t)portMAX_DELAY);
}

void lteppp_send_at_command_delay (lte_task_cmd_data_t *cmd, lte_task_rsp_data_t *rsp, TickType_t delay) {
xQueueSend(xCmdQueue, (void *)cmd, (TickType_t)portMAX_DELAY);
vTaskDelay(delay);
xQueueReceive(xRxQueue, rsp, (TickType_t)portMAX_DELAY);
}

bool lteppp_wait_at_rsp (const char *expected_rsp, uint32_t timeout, bool from_mp, void* data_rem) {

uint32_t rx_len = 0;
Expand Down Expand Up @@ -519,7 +513,7 @@ static void TASK_LTE (void *pvParameters) {
xSemaphoreGive(xLTESem);
state = lteppp_get_state();
if (xQueueReceive(xCmdQueue, lteppp_trx_buffer, 0)) {
lteppp_send_at_cmd_exp(lte_task_cmd->data, lte_task_cmd->timeout, NULL, &(lte_task_rsp->data_remaining));
lteppp_send_at_cmd_exp(lte_task_cmd->data, lte_task_cmd->timeout, NULL, &(lte_task_rsp->data_remaining), lte_task_cmd->dataLen);
xQueueSend(xRxQueue, (void *)lte_task_rsp, (TickType_t)portMAX_DELAY);
}
else if(state == E_LTE_PPP && lte_uart_break_evt)
Expand Down Expand Up @@ -606,7 +600,7 @@ static void TASK_UART_EVT (void *pvParameters)
}


static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const char *expected_rsp, void* data_rem) {
static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const char *expected_rsp, void* data_rem, size_t len) {

if(strstr(cmd, "Pycom_Dummy") != NULL)
{
Expand All @@ -628,7 +622,7 @@ static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const cha
}
else
{
uint32_t cmd_len = strlen(cmd);
size_t cmd_len = len;
// char tmp_buf[128];
#ifdef LTE_DEBUG_BUFF
if (lteppp_log.ptr < (LTE_LOG_BUFF_SIZE - strlen("[CMD]:") - cmd_len + 1))
Expand Down Expand Up @@ -662,7 +656,7 @@ static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const cha
}

static bool lteppp_send_at_cmd(const char *cmd, uint32_t timeout) {
return lteppp_send_at_cmd_exp (cmd, timeout, LTE_OK_RSP, NULL);
return lteppp_send_at_cmd_exp (cmd, timeout, LTE_OK_RSP, NULL, strlen(cmd) );
}

static bool lteppp_check_sim_present(void) {
Expand Down
3 changes: 1 addition & 2 deletions esp32/lte/lteppp.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typedef struct {
typedef struct {
uint32_t timeout;
char data[LTE_AT_CMD_SIZE_MAX - 4];
size_t dataLen;
} lte_task_cmd_data_t;
#pragma pack(1)
typedef struct {
Expand Down Expand Up @@ -111,8 +112,6 @@ extern void lteppp_deinit (void);

extern void lteppp_send_at_command (lte_task_cmd_data_t *cmd, lte_task_rsp_data_t *rsp);

extern void lteppp_send_at_command_delay (lte_task_cmd_data_t *cmd, lte_task_rsp_data_t *rsp, TickType_t delay);

extern bool lteppp_wait_at_rsp (const char *expected_rsp, uint32_t timeout, bool from_mp, void* data_rem);

lte_modem_conn_state_t lteppp_modem_state(void);
Expand Down