Merge pull request #872 from david-cermak/fix/eppp_minor_fixes

[eppp]: Minor fixes v1.0
This commit is contained in:
david-cermak
2025-08-27 08:57:25 +02:00
committed by GitHub
4 changed files with 15 additions and 6 deletions

View File

@@ -167,6 +167,9 @@ esp_err_t eppp_check_connection(esp_netif_t *netif)
{ {
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
esp_ping_config_t config = ESP_PING_DEFAULT_CONFIG(); esp_ping_config_t config = ESP_PING_DEFAULT_CONFIG();
#if CONFIG_LOG_MAXIMUM_LEVEL > 3
config.task_stack_size += 1024; // Some additional stack needed for verbose logs
#endif
config.count = 100; config.count = 100;
ESP_LOGI(TAG, "Checking connection on EPPP interface #%" PRIu32, config.interface); ESP_LOGI(TAG, "Checking connection on EPPP interface #%" PRIu32, config.interface);
ip_addr_t target_addr = {0}; ip_addr_t target_addr = {0};

View File

@@ -208,7 +208,9 @@ static esp_err_t init_master(struct eppp_config_spi_s *config, struct eppp_spi *
}; };
ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err_dev, TAG, "Failed to config interrupt GPIO"); ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err_dev, TAG, "Failed to config interrupt GPIO");
ESP_GOTO_ON_ERROR(gpio_install_isr_service(0), err_dev, TAG, "Failed to install GPIO ISR"); ret = gpio_install_isr_service(0);
ESP_GOTO_ON_FALSE(ret == ESP_OK || ret == ESP_ERR_INVALID_STATE /* In case the GPIO ISR already installed */,
ret, err_dev, TAG, "Failed to install GPIO ISR");
ESP_GOTO_ON_ERROR(gpio_set_intr_type(config->intr, GPIO_INTR_ANYEDGE), err_dev, TAG, "Failed to set ISR type"); ESP_GOTO_ON_ERROR(gpio_set_intr_type(config->intr, GPIO_INTR_ANYEDGE), err_dev, TAG, "Failed to set ISR type");
ESP_GOTO_ON_ERROR(gpio_isr_handler_add(config->intr, gpio_isr_handler, h), err_dev, TAG, "Failed to add ISR handler"); ESP_GOTO_ON_ERROR(gpio_isr_handler_add(config->intr, gpio_isr_handler, h), err_dev, TAG, "Failed to add ISR handler");
return ESP_OK; return ESP_OK;
@@ -468,9 +470,6 @@ err:
if (h->ready_semaphore) { if (h->ready_semaphore) {
vSemaphoreDelete(h->ready_semaphore); vSemaphoreDelete(h->ready_semaphore);
} }
if (h->out_queue) {
vQueueDelete(h->out_queue);
}
free(h); free(h);
return NULL; return NULL;
} }

View File

@@ -80,12 +80,12 @@ static esp_err_t init_uart(struct eppp_uart *h, struct eppp_config_uart_s *confi
uart_config.data_bits = UART_DATA_8_BITS; uart_config.data_bits = UART_DATA_8_BITS;
uart_config.parity = UART_PARITY_DISABLE; uart_config.parity = UART_PARITY_DISABLE;
uart_config.stop_bits = UART_STOP_BITS_1; uart_config.stop_bits = UART_STOP_BITS_1;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; uart_config.flow_ctrl = config->flow_control;
uart_config.source_clk = UART_SCLK_DEFAULT; uart_config.source_clk = UART_SCLK_DEFAULT;
ESP_RETURN_ON_ERROR(uart_driver_install(h->uart_port, config->rx_buffer_size, 0, config->queue_size, &h->uart_event_queue, 0), TAG, "Failed to install UART"); ESP_RETURN_ON_ERROR(uart_driver_install(h->uart_port, config->rx_buffer_size, 0, config->queue_size, &h->uart_event_queue, 0), TAG, "Failed to install UART");
ESP_RETURN_ON_ERROR(uart_param_config(h->uart_port, &uart_config), TAG, "Failed to set params"); ESP_RETURN_ON_ERROR(uart_param_config(h->uart_port, &uart_config), TAG, "Failed to set params");
ESP_RETURN_ON_ERROR(uart_set_pin(h->uart_port, config->tx_io, config->rx_io, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE), TAG, "Failed to set UART pins"); ESP_RETURN_ON_ERROR(uart_set_pin(h->uart_port, config->tx_io, config->rx_io, config->rts_io, config->cts_io), TAG, "Failed to set UART pins");
ESP_RETURN_ON_ERROR(uart_set_rx_timeout(h->uart_port, 1), TAG, "Failed to set UART Rx timeout"); ESP_RETURN_ON_ERROR(uart_set_rx_timeout(h->uart_port, 1), TAG, "Failed to set UART Rx timeout");
return ESP_OK; return ESP_OK;
} }
@@ -269,6 +269,7 @@ eppp_transport_handle_t eppp_uart_init(struct eppp_config_uart_s *config)
ESP_GOTO_ON_ERROR(init_uart(h, config), err, TAG, "Failed to init UART"); ESP_GOTO_ON_ERROR(init_uart(h, config), err, TAG, "Failed to init UART");
return &h->parent; return &h->parent;
err: err:
free(h);
return NULL; return NULL;
} }

View File

@@ -34,6 +34,9 @@ extern "C" {
.rx_io = 26, \ .rx_io = 26, \
.queue_size = 16, \ .queue_size = 16, \
.rx_buffer_size = 1024, \ .rx_buffer_size = 1024, \
.rts_io = -1, \
.cts_io = -1, \
.flow_control = 0, \
}, \ }, \
#define EPPP_DEFAULT_SDIO_CONFIG() \ #define EPPP_DEFAULT_SDIO_CONFIG() \
@@ -135,6 +138,9 @@ typedef struct eppp_config_t {
int rx_io; int rx_io;
int queue_size; int queue_size;
int rx_buffer_size; int rx_buffer_size;
int rts_io;
int cts_io;
int flow_control;
} uart; } uart;
struct eppp_config_sdio_s { struct eppp_config_sdio_s {