fix esp_modem switch mode timeout

Closes https://github.com/espressif/esp-idf/issues/3506
Closes https://github.com/espressif/esp-idf/issues/4324
This commit is contained in:
morris 2020-05-26 13:54:57 +08:00
parent 7cbdc3ea66
commit 6d70b7c352
2 changed files with 3 additions and 1 deletions

View file

@ -52,7 +52,7 @@ typedef struct modem_dte modem_dte_t;
*/ */
#define MODEM_COMMAND_TIMEOUT_DEFAULT (500) /*!< Default timeout value for most commands */ #define MODEM_COMMAND_TIMEOUT_DEFAULT (500) /*!< Default timeout value for most commands */
#define MODEM_COMMAND_TIMEOUT_OPERATOR (75000) /*!< Timeout value for getting operator status */ #define MODEM_COMMAND_TIMEOUT_OPERATOR (75000) /*!< Timeout value for getting operator status */
#define MODEM_COMMAND_TIMEOUT_MODE_CHANGE (3000) /*!< Timeout value for changing working mode */ #define MODEM_COMMAND_TIMEOUT_MODE_CHANGE (5000) /*!< Timeout value for changing working mode */
#define MODEM_COMMAND_TIMEOUT_HANG_UP (90000) /*!< Timeout value for hang up */ #define MODEM_COMMAND_TIMEOUT_HANG_UP (90000) /*!< Timeout value for hang up */
#define MODEM_COMMAND_TIMEOUT_POWEROFF (1000) /*!< Timeout value for power down */ #define MODEM_COMMAND_TIMEOUT_POWEROFF (1000) /*!< Timeout value for power down */

View file

@ -412,6 +412,8 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
res = uart_driver_install(esp_dte->uart_port, config->rx_buffer_size, config->tx_buffer_size, res = uart_driver_install(esp_dte->uart_port, config->rx_buffer_size, config->tx_buffer_size,
config->event_queue_size, &(esp_dte->event_queue), 0); config->event_queue_size, &(esp_dte->event_queue), 0);
MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config); MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config);
res = uart_set_rx_timeout(esp_dte->uart_port, 1);
MODEM_CHECK(res == ESP_OK, "set rx timeout failed", err_uart_config);
/* Set pattern interrupt, used to detect the end of a line. */ /* Set pattern interrupt, used to detect the end of a line. */
res = uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); res = uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);