From 2965291073ea7c09a57033ab69ec6d2b638bc233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Moska=C5=82a?= Date: Mon, 30 Jan 2023 22:03:49 +0100 Subject: [PATCH 1/4] Attempt 1 --- src/PPPOS.c | 23 ++++------------------- src/PPPOS.h | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/PPPOS.c b/src/PPPOS.c index ed21a75..2ac59f4 100644 --- a/src/PPPOS.c +++ b/src/PPPOS.c @@ -1,8 +1,8 @@ #include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/event_groups.h" +#include +//#include "freertos/task.h" +//#include "freertos/event_groups.h" #include "esp_system.h" #include "esp_wifi.h" #include "esp_event_loop.h" @@ -171,23 +171,8 @@ char* data = (char*)malloc(BUF_SIZE); } -void PPPOS_init(int txPin, int rxPin, int baudrate, int uart_number, char* user, char* pass){ +void PPPOS_init(int uart_number, char* user, char* pass){ PPPOS_uart_num = uart_number; - gpio_set_direction(txPin, GPIO_MODE_OUTPUT); - gpio_set_direction(rxPin, GPIO_MODE_INPUT); - gpio_set_pull_mode(rxPin, GPIO_PULLUP_ONLY); - - uart_config_t uart_config = { - .baud_rate = baudrate, - .data_bits = UART_DATA_8_BITS, - .parity = UART_PARITY_DISABLE, - .stop_bits = UART_STOP_BITS_1, - .flow_ctrl = UART_HW_FLOWCTRL_DISABLE - }; - - uart_param_config(PPPOS_uart_num, &uart_config) ; - uart_set_pin(PPPOS_uart_num, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); - uart_driver_install(PPPOS_uart_num, BUF_SIZE * 2, BUF_SIZE * 2, 0, NULL, 0); tcpip_adapter_init(); PPP_User = user; PPP_Pass = pass; diff --git a/src/PPPOS.h b/src/PPPOS.h index 8112c09..cf1e1cf 100644 --- a/src/PPPOS.h +++ b/src/PPPOS.h @@ -8,7 +8,7 @@ extern "C" { #define BUF_SIZE (1024) -void PPPOS_init(int txPin, int rxPin, int baudrate, int uart_number, char* user, char* pass); +void PPPOS_init(int uart_number, char* user, char* pass); bool PPPOS_isConnected(); From 17c294881fb89433e761c7a0342d690b38054fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Moska=C5=82a?= Date: Mon, 30 Jan 2023 22:10:59 +0100 Subject: [PATCH 2/4] Another change --- src/PPPOS.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/PPPOS.c b/src/PPPOS.c index 2ac59f4..3ac487d 100644 --- a/src/PPPOS.c +++ b/src/PPPOS.c @@ -3,22 +3,14 @@ #include //#include "freertos/task.h" //#include "freertos/event_groups.h" -#include "esp_system.h" -#include "esp_wifi.h" -#include "esp_event_loop.h" -#include "esp_log.h" -#include "nvs_flash.h" - -#include "driver/uart.h" -#include "driver/gpio.h" -#include "tcpip_adapter.h" -#include "netif/ppp/pppos.h" -#include "lwip/err.h" -#include "lwip/sockets.h" -#include "lwip/sys.h" -#include "lwip/netdb.h" -#include "lwip/dns.h" -#include "netif/ppp/pppapi.h" +#include +#include +#include +#include +#include +#include +#include +#include #include "PPPOS.h" From f2248c03eb67e4cd205844d757eac205e78670d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Moska=C5=82a?= Date: Mon, 30 Jan 2023 22:17:19 +0100 Subject: [PATCH 3/4] A lot of changes --- src/PPPOS.c | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/PPPOS.c b/src/PPPOS.c index 3ac487d..f18e95f 100644 --- a/src/PPPOS.c +++ b/src/PPPOS.c @@ -1,16 +1,16 @@ #include -#include +#include "FreeRTOS.h" //#include "freertos/task.h" //#include "freertos/event_groups.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "tcpip_adapter.h" +#include "netif/ppp/pppos.h" +#include "lwip/err.h" +#include "lwip/sockets.h" +#include "lwip/sys.h" +#include "lwip/netdb.h" +#include "lwip/dns.h" +#include "netif/ppp/pppapi.h" #include "PPPOS.h" @@ -45,85 +45,85 @@ static void ppp_status_cb(ppp_pcb *pcb, int err_code, void *ctx) switch (err_code) { case PPPERR_NONE: { - ESP_LOGE(TAG, "status_cb: Connected\n"); + //ESP_LOGE(TAG, "status_cb: Connected\n"); #if PPP_IPV4_SUPPORT - ESP_LOGE(TAG, " ipaddr_v4 = %s\n", ipaddr_ntoa(&pppif->ip_addr)); - ESP_LOGE(TAG, " gateway = %s\n", ipaddr_ntoa(&pppif->gw)); - ESP_LOGE(TAG, " netmask = %s\n", ipaddr_ntoa(&pppif->netmask)); + //ESP_LOGE(TAG, " ipaddr_v4 = %s\n", ipaddr_ntoa(&pppif->ip_addr)); + //ESP_LOGE(TAG, " gateway = %s\n", ipaddr_ntoa(&pppif->gw)); + //ESP_LOGE(TAG, " netmask = %s\n", ipaddr_ntoa(&pppif->netmask)); #endif /* PPP_IPV4_SUPPORT */ #if PPP_IPV6_SUPPORT - ESP_LOGE(TAG, " ipaddr_v6 = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0))); + //ESP_LOGE(TAG, " ipaddr_v6 = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0))); #endif /* PPP_IPV6_SUPPORT */ PPPOS_connected = true; break; } case PPPERR_PARAM: { - ESP_LOGE(TAG, "status_cb: Invalid parameter\n"); + //ESP_LOGE(TAG, "status_cb: Invalid parameter\n"); break; } case PPPERR_OPEN: { - ESP_LOGE(TAG, "status_cb: Unable to open PPP session\n"); + //ESP_LOGE(TAG, "status_cb: Unable to open PPP session\n"); break; } case PPPERR_DEVICE: { - ESP_LOGE(TAG, "status_cb: Invalid I/O device for PPP\n"); + //ESP_LOGE(TAG, "status_cb: Invalid I/O device for PPP\n"); break; } case PPPERR_ALLOC: { - ESP_LOGE(TAG, "status_cb: Unable to allocate resources\n"); + //ESP_LOGE(TAG, "status_cb: Unable to allocate resources\n"); break; } case PPPERR_USER: { - ESP_LOGE(TAG, "status_cb: User interrupt\n"); + //ESP_LOGE(TAG, "status_cb: User interrupt\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_CONNECT: { - ESP_LOGE(TAG, "status_cb: Connection lost\n"); + //ESP_LOGE(TAG, "status_cb: Connection lost\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_AUTHFAIL: { - ESP_LOGE(TAG, "status_cb: Failed authentication challenge\n"); + //ESP_LOGE(TAG, "status_cb: Failed authentication challenge\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_PROTOCOL: { - ESP_LOGE(TAG, "status_cb: Failed to meet protocol\n"); + //ESP_LOGE(TAG, "status_cb: Failed to meet protocol\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_PEERDEAD: { - ESP_LOGE(TAG, "status_cb: Connection timeout\n"); + //ESP_LOGE(TAG, "status_cb: Connection timeout\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_IDLETIMEOUT: { - ESP_LOGE(TAG, "status_cb: Idle Timeout\n"); + //ESP_LOGE(TAG, "status_cb: Idle Timeout\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_CONNECTTIME: { - ESP_LOGE(TAG, "status_cb: Max connect time reached\n"); + //ESP_LOGE(TAG, "status_cb: Max connect time reached\n"); PPPOS_started = false; PPPOS_connected = false; break; } case PPPERR_LOOPBACK: { - ESP_LOGE(TAG, "status_cb: Loopback detected\n"); + //ESP_LOGE(TAG, "status_cb: Loopback detected\n"); PPPOS_started = false; PPPOS_connected = false; break; } default: { - ESP_LOGE(TAG, "status_cb: Unknown error code %d\n", err_code); + //ESP_LOGE(TAG, "status_cb: Unknown error code %d\n", err_code); PPPOS_started = false; PPPOS_connected = false; break; From bf1a26201bf2484732d26c6c0425e6e4317c2052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Moska=C5=82a?= Date: Mon, 30 Jan 2023 22:20:59 +0100 Subject: [PATCH 4/4] fuuuck --- src/PPPOSClient.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/PPPOSClient.h b/src/PPPOSClient.h index a3cd128..9babb17 100644 --- a/src/PPPOSClient.h +++ b/src/PPPOSClient.h @@ -11,8 +11,6 @@ #include "Client.h" #include "lwip/dns.h" #include "lwip/inet.h" -#include "esp_system.h" -#include "esp_wifi.h" #include "lwip/err.h" #include "lwip/sockets.h" #include "lwip/sys.h"