Skip to content

Commit 6dcc060

Browse files
committed
fix(eppp_link): Updated per iperf
1 parent cba0160 commit 6dcc060

File tree

4 files changed

+44
-38
lines changed

4 files changed

+44
-38
lines changed

components/eppp_link/eppp_link.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ esp_err_t eppp_perform(esp_netif_t *netif)
559559
if (head->channel == 0) {
560560
esp_netif_receive(netif, in_buf + sizeof(struct header), head->short_size, NULL);
561561
} else {
562-
ESP_LOGE(TAG, "Got channel %d size %d", head->channel, head->short_size);
562+
// ESP_LOGE(TAG, "Got channel %d size %d", head->channel, head->short_size);
563563
if (s_rx != NULL) {
564564
s_rx(netif, in_buf + sizeof(struct header), head->short_size);
565565
}
@@ -616,7 +616,7 @@ esp_err_t eppp_perform(esp_netif_t *netif)
616616
if (head->channel == 0) {
617617
esp_netif_receive(netif, in_buf + sizeof(struct header), head->size, NULL);
618618
} else {
619-
ESP_LOGE(TAG, "Got channel %d size %d", head->channel, head->size);
619+
// ESP_LOGE(TAG, "Got channel %d size %d", head->channel, head->size);
620620
if (s_rx != NULL) {
621621
s_rx(netif, in_buf + sizeof(struct header), head->size);
622622
}

components/eppp_link/examples/rpc/client/main/app_main.c

+38-32
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static eppp_channel_fn_t s_tx;
137137
static esp_err_t remote_wifi_receive(void *h, void *buffer, size_t len)
138138
{
139139
if (s_wifi_netif) {
140-
printf("recv %d\n", len);
140+
// printf("recv %d\n", len);
141141
return esp_netif_receive(s_wifi_netif, buffer, len, NULL);
142142
}
143143
return ESP_OK;
@@ -146,7 +146,7 @@ static esp_err_t remote_wifi_receive(void *h, void *buffer, size_t len)
146146
esp_err_t remote_wifi_transmit_wrap(void *h, void *buffer, size_t len, void *netstack_buffer)
147147
{
148148
if (s_tx) {
149-
printf("send %d\n", len);
149+
// printf("send %d\n", len);
150150
return s_tx(s_ppp_netif, buffer, len);
151151
}
152152
return ESP_OK;
@@ -162,7 +162,7 @@ static esp_err_t remote_wifi_transmit(void *h, void *buffer, size_t len)
162162

163163
static void wifi_free(void *h, void *buffer)
164164
{
165-
printf("wifi_free %p\n", buffer);
165+
// printf("wifi_free %p\n", buffer);
166166
}
167167

168168
static void remote_wifi_netif(void)
@@ -183,6 +183,38 @@ static void remote_wifi_netif(void)
183183
s_wifi_netif = esp_netif_new(&netif_config);
184184
}
185185

186+
static void wifi_init(void *ctx)
187+
{
188+
client_init();
189+
190+
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
191+
ESP_ERROR_CHECK(esp_wifi_remote_init(&cfg));
192+
193+
wifi_config_t wifi_config = {
194+
.sta = {
195+
.ssid = CONFIG_ESP_WIFI_SSID,
196+
.password = CONFIG_ESP_WIFI_PASSWORD,
197+
},
198+
};
199+
200+
esp_err_t err = esp_wifi_remote_set_mode(WIFI_MODE_STA);
201+
ESP_LOGI(TAG, "esp_wifi_remote_set_mode() returned = %x", err);
202+
ESP_ERROR_CHECK(esp_wifi_remote_set_config(WIFI_IF_STA, &wifi_config) );
203+
ESP_ERROR_CHECK(esp_wifi_remote_start() );
204+
vTaskDelay(pdMS_TO_TICKS(1000));
205+
uint8_t mac[6];
206+
ESP_ERROR_CHECK(esp_wifi_remote_get_mac(WIFI_IF_STA, mac) );
207+
208+
esp_netif_set_mac(s_wifi_netif, mac);
209+
vTaskDelay(pdMS_TO_TICKS(1000));
210+
211+
esp_netif_action_start(s_wifi_netif, 0, 0, 0);
212+
ESP_ERROR_CHECK(esp_wifi_remote_connect() );
213+
214+
esp_netif_action_connected(s_wifi_netif, 0, 0, 0);
215+
vTaskDelete(NULL);
216+
}
217+
186218
void app_main(void)
187219
{
188220
ESP_LOGI(TAG, "[APP] Startup..");
@@ -198,7 +230,8 @@ void app_main(void)
198230
eppp_config_t config = EPPP_DEFAULT_CLIENT_CONFIG();
199231
#if CONFIG_EPPP_LINK_DEVICE_SPI
200232
config.transport = EPPP_TRANSPORT_SPI;
201-
config.task.priority = 5;
233+
config.task.priority = 14;
234+
config.spi.freq = 28000000;
202235
#else
203236
config.transport = EPPP_TRANSPORT_UART;
204237
config.uart.tx_io = 10;
@@ -217,35 +250,8 @@ void app_main(void)
217250
return ;
218251
}
219252

220-
client_init();
221-
222-
223-
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
224-
ESP_LOG_BUFFER_HEXDUMP("cfg", &cfg, sizeof(cfg), ESP_LOG_WARN);
225-
ESP_ERROR_CHECK(esp_wifi_remote_init(&cfg));
226-
227-
wifi_config_t wifi_config = {
228-
.sta = {
229-
.ssid = CONFIG_ESP_WIFI_SSID,
230-
.password = CONFIG_ESP_WIFI_PASSWORD,
231-
},
232-
};
233-
234-
esp_err_t err = esp_wifi_remote_set_mode(WIFI_MODE_STA);
235-
ESP_LOGI(TAG, "esp_wifi_remote_set_mode() returned = %x", err);
236-
ESP_ERROR_CHECK(esp_wifi_remote_set_config(WIFI_IF_STA, &wifi_config) );
237-
ESP_ERROR_CHECK(esp_wifi_remote_start() );
238-
vTaskDelay(pdMS_TO_TICKS(1000));
239-
uint8_t mac[6];
240-
ESP_ERROR_CHECK(esp_wifi_remote_get_mac(WIFI_IF_STA, mac) );
241253

242-
esp_netif_set_mac(s_wifi_netif, mac);
243-
vTaskDelay(pdMS_TO_TICKS(1000));
244-
245-
esp_netif_action_start(s_wifi_netif, 0, 0, 0);
246-
ESP_ERROR_CHECK(esp_wifi_remote_connect() );
247-
248-
esp_netif_action_connected(s_wifi_netif, 0, 0, 0);
254+
xTaskCreate(&wifi_init, "initwifi", 8192, NULL, 18, NULL);
249255
// // Setup global DNS
250256
// esp_netif_dns_info_t dns;
251257
// dns.ip.u_addr.ip4.addr = esp_netif_htonl(CONFIG_EXAMPLE_GLOBAL_DNS);

components/eppp_link/examples/rpc/common/rpc.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class RpcEngine {
5151
size_t size;
5252
auto buf = req.marshall(t, size);
5353
ESP_LOGI("rpc", "Sending API id:%d", (int)id);
54-
ESP_LOG_BUFFER_HEXDUMP("rpc", buf, size, ESP_LOG_INFO);
54+
ESP_LOG_BUFFER_HEXDUMP("rpc", buf, size, ESP_LOG_VERBOSE);
5555
int len = esp_tls_conn_write(tls_, buf, size);
5656
if (len <= 0) {
5757
ESP_LOGE("rpc", "Failed to write data to the connection");

components/eppp_link/examples/rpc/server/main/station_example_main.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ static esp_netif_t *s_ppp_netif;
120120
static esp_err_t netif_recv(void *h, void *buffer, size_t len)
121121
{
122122
// printf("recv %d\n", len);
123-
ESP_LOG_BUFFER_HEXDUMP("cfg", buffer, len, ESP_LOG_WARN);
123+
// ESP_LOG_BUFFER_HEXDUMP("cfg", buffer, len, ESP_LOG_WARN);
124124
return esp_wifi_internal_tx(WIFI_IF_STA, buffer, len);
125125
}
126126

127127
static esp_err_t wifi_recv(void *buffer, uint16_t len, void *eb)
128128
{
129-
printf("send %d\n", len);
129+
// printf("send %d\n", len);
130130
if (s_tx) {
131-
printf("send %d\n", len);
131+
// printf("send %d\n", len);
132132
esp_err_t ret = s_tx(s_ppp_netif, buffer, len);
133133
esp_wifi_internal_free_rx_buffer(eb);
134134
return ret;

0 commit comments

Comments
 (0)