From 06a0e3dc23b84cadd09da12ad8e0be5ccb27c1a6 Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Thu, 22 Jul 2021 16:46:57 +1000 Subject: [PATCH] idf4: part 3.2 - fix bug in updated eth module Updated docs to reflect new WiFi station connect behaviour. --- components/modules/eth.c | 4 ++-- docs/modules/wifi.md | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/modules/eth.c b/components/modules/eth.c index 284687a5..50e7cbd4 100644 --- a/components/modules/eth.c +++ b/components/modules/eth.c @@ -220,7 +220,7 @@ static int leth_init( lua_State *L ) eth_phy_config_t phy_cfg = ETH_PHY_DEFAULT_CONFIG(); - phy_cfg.phy_addr = opt_checkint_range( L, "addr", -1, 0, 31 ); + phy_cfg.phy_addr = opt_checkint_range( L, "addr", -1, -1, 31 ); phy_cfg.reset_gpio_num = opt_checkint_range( L, "power", -1, -1, GPIO_NUM_MAX-1 ); // optional @@ -240,7 +240,7 @@ static int leth_init( lua_State *L ) esp_netif_config_t netif_cfg = ESP_NETIF_DEFAULT_ETH(); esp_netif_t *new_eth = esp_netif_new(&netif_cfg); - err = esp_eth_set_default_handlers(eth); + err = esp_eth_set_default_handlers(new_eth); if (err != ESP_OK) goto cleanup_netif; diff --git a/docs/modules/wifi.md b/docs/modules/wifi.md index 15be8fed..8eb1e9be 100644 --- a/docs/modules/wifi.md +++ b/docs/modules/wifi.md @@ -186,8 +186,10 @@ wifi.sta.config(station_cfg) ## wifi.sta.connect() Connects to the configured AP in station mode. You will want to call this -on start-up after [`wifi.start()`](#wifistart), and probably also in -response to getting `disconnected` events in order to reconnect. +on start-up after [`wifi.start()`](#wifistart). The system will attempt +to connect until it succeeds or [`wifi.sta.disconnect()`](#wifistadisconnect) +is called. Each failed connect attempt will fire the `disconnected` +event. #### Syntax `wifi.sta.connect()`