From 6a9d5158eb459f833df6669139e9bb88fd8ff388 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Mon, 1 Jul 2024 19:14:24 +0200 Subject: [PATCH] Fix for #116, WebUI not working --- main/driver.c | 2 +- main/wifi.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/main/driver.c b/main/driver.c index 2c7eaf5..e527d70 100644 --- a/main/driver.c +++ b/main/driver.c @@ -2811,7 +2811,7 @@ bool driver_init (void) #else hal.info = "ESP32"; #endif - hal.driver_version = "240418"; + hal.driver_version = "240701"; hal.driver_url = GRBL_URL "/ESP32"; #ifdef BOARD_NAME hal.board = BOARD_NAME; diff --git a/main/wifi.c b/main/wifi.c index a76e57b..ee2417a 100644 --- a/main/wifi.c +++ b/main/wifi.c @@ -188,18 +188,12 @@ network_info_t *networking_get_info (void) { static network_info_t info; - memcpy(&info.status, &network, sizeof(network_settings_t)); - uint8_t bmac[6]; - - if(esp_wifi_get_mac(ESP_IF_WIFI_STA, bmac) == ESP_OK) - strcpy(info.mac, networking_mac_to_string(bmac)); - else - *info.mac = '\0'; - ip4_addr_t *ip; -#if NETWORK_IPMODE_STATIC + memcpy(&info.status, &network, sizeof(network_settings_t)); + + #if NETWORK_IPMODE_STATIC ip = (ip4_addr_t *)&wifi.sta.network.ip; #else ip = ap_list.ap_selected ? &ap_list.ip_addr : (ip4_addr_t *)&wifi.ap.network.ip; @@ -210,6 +204,15 @@ network_info_t *networking_get_info (void) else *info.status.ip = '\0'; + #if WIFI_SOFTAP + if(esp_read_mac(bmac, ESP_MAC_WIFI_SOFTAP) == ESP_OK) { + #else + if(esp_read_mac(bmac, ESP_MAC_WIFI_STA) == ESP_OK) { + #endif + strcpy(info.mac, networking_mac_to_string(bmac)); + } else + *info.mac = '\0'; + if(info.status.ip_mode == IpMode_DHCP) { *info.status.gateway = '\0'; *info.status.mask = '\0';