diff --git a/interface/src/network/NetworkStatusForm.tsx b/interface/src/network/NetworkStatusForm.tsx index ed4c3ca8e..6098f04c6 100644 --- a/interface/src/network/NetworkStatusForm.tsx +++ b/interface/src/network/NetworkStatusForm.tsx @@ -40,7 +40,22 @@ class NetworkStatusForm extends Component { if (!status.dns_ip_1) { return 'none'; } - return status.dns_ip_1 + (status.dns_ip_2 ? ',' + status.dns_ip_2 : ''); + if (!status.dns_ip_2 || status.dns_ip_2 === '0.0.0.0') { + return status.dns_ip_1; + } + return status.dns_ip_1 + ', ' + status.dns_ip_2; + } + IPs(status: NetworkStatus) { + if ( + !status.local_ipv6 || + status.local_ipv6 === '0000:0000:0000:0000:0000:0000:0000:0000' + ) { + return status.local_ip; + } + if (!status.local_ip || status.local_ip === '0.0.0.0') { + return status.local_ipv6; + } + return status.local_ip + ', ' + status.local_ipv6; } createListItems() { @@ -77,7 +92,7 @@ class NetworkStatusForm extends Component { IP - + diff --git a/interface/src/network/types.ts b/interface/src/network/types.ts index 03d56240d..538020903 100644 --- a/interface/src/network/types.ts +++ b/interface/src/network/types.ts @@ -21,6 +21,7 @@ export enum WiFiEncryptionType { export interface NetworkStatus { status: NetworkConnectionStatus; local_ip: string; + local_ipv6: string; mac_address: string; rssi: number; ssid: string; diff --git a/lib/framework/NetworkStatus.cpp b/lib/framework/NetworkStatus.cpp index cb0369d0e..fb369386c 100644 --- a/lib/framework/NetworkStatus.cpp +++ b/lib/framework/NetworkStatus.cpp @@ -25,6 +25,7 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) { // for Wifi if (wifi_status == WL_CONNECTED) { root["local_ip"] = WiFi.localIP().toString(); + root["local_ipv6"] = WiFi.localIPv6().toString(); root["mac_address"] = WiFi.macAddress(); root["rssi"] = WiFi.RSSI(); root["ssid"] = WiFi.SSID(); @@ -47,6 +48,7 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) { } else if (ethernet_connected) { // Ethernet root["local_ip"] = ETH.localIP().toString(); + root["local_ipv6"] = ETH.localIPv6().toString(); root["mac_address"] = ETH.macAddress(); root["subnet_mask"] = ETH.subnetMask().toString(); root["gateway_ip"] = ETH.gatewayIP().toString(); diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 36a16cf49..3ab848e21 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -640,8 +640,14 @@ void Mqtt::on_connect() { #ifndef EMSESP_STANDALONE if (EMSESP::system_.ethernet_connected()) { doc["ip"] = ETH.localIP().toString(); + if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { + doc["ipv6"] = ETH.localIPv6().toString(); + } } else { doc["ip"] = WiFi.localIP().toString(); + if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { + doc["ipv6"] = WiFi.localIPv6().toString(); + } } #endif publish(F_(info), doc.as()); // topic called "info" diff --git a/src/system.cpp b/src/system.cpp index d752ba4ba..43c432303 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -279,6 +279,8 @@ void System::start(uint32_t heap_start) { get_settings(); #ifndef EMSESP_STANDALONE + // disable bluetooth module + periph_module_disable(PERIPH_BT_MODULE); if (low_clock_) { setCpuFrequencyMhz(160); } @@ -305,12 +307,8 @@ void System::adc_init(bool refresh) { get_settings(); } #ifndef EMSESP_STANDALONE - // setCpuFrequencyMhz(160); // default is 240 - - // disable bluetooth & ADC + // disable ADC /* - btStop(); - esp_bt_controller_disable(); if (!analog_enabled_) { adc_power_release(); // turn off ADC to save power if not needed } @@ -719,6 +717,9 @@ void System::show_system(uuid::console::Shell & shell) { shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str()); shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str()); shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str()); + if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { + shell.printfln(F("IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str()); + } break; case WL_CONNECT_FAILED: @@ -749,6 +750,9 @@ void System::show_system(uuid::console::Shell & shell) { shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str()); shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str()); + if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { + shell.printfln(F("IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str()); + } } else { shell.printfln(F("Ethernet: disconnected")); }