[WiFi] Fix scanning WiFi returns no networks found

This commit is contained in:
TD-er
2025-09-21 15:15:06 +02:00
parent a9b6c532b0
commit 4bcf990a68
22 changed files with 179 additions and 113 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ extra_scripts = ${esp82xx_common.extra_scripts}
; ESP_IDF 5.5.0
[core_esp32_IDF5_5_0__3_2_0_LittleFS]
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF55_gcc15
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1609-1652-5.5/framework-arduinoespressif32-release_v5.5-a942e2d1.tar.xz
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1809-0958-5.5/framework-arduinoespressif32-release_v5.5-b24d7e0b.tar.xz
build_flags = -DESP32_STAGE
-DESP_IDF_VERSION_MAJOR=5
-DLIBRARIES_NO_LOG=1
@@ -31,22 +31,26 @@ static void tx_rx_event_handler(void *arg, esp_event_base_t event_base,
{
if (event_data == nullptr) { return; }
ip_event_tx_rx_t *event = (ip_event_tx_rx_t *)event_data;
const int key = esp_netif_get_netif_impl_index(event->esp_netif);
if (event->dir == ESP_NETIF_TX) {
interfaceTrafficCount[key]._tx_count += event->len;
} else if (event->dir == ESP_NETIF_RX) {
interfaceTrafficCount[key]._rx_count += event->len;
if (event->len > 0) {
const int key = esp_netif_get_netif_impl_index(event->esp_netif);
/*
addLog(LOG_LEVEL_INFO, strformat(
F("RX: %s key: %d len: %d total: %d"),
esp_netif_get_desc(event->esp_netif),
key,
event->len,
interfaceTrafficCount[key]._rx_count
));
*/
if (event->dir == ESP_NETIF_TX) {
interfaceTrafficCount[key]._tx_count += event->len;
} else if (event->dir == ESP_NETIF_RX) {
interfaceTrafficCount[key]._rx_count += event->len;
/*
addLog(LOG_LEVEL_INFO, strformat(
F("RX: %s key: %d len: %d total: %d"),
esp_netif_get_desc(event->esp_netif),
key,
event->len,
interfaceTrafficCount[key]._rx_count
));
*/
}
}
}
@@ -95,11 +99,12 @@ void NWPluginData_static_runtime::clear(networkIndex_t networkIndex)
#endif
_operationalStats.clear();
#if FEATURE_NETWORK_TRAFFIC_COUNT
if (_netif) {
const int key = _netif->impl_index();
interfaceTrafficCount[key].clear();
}
#endif
#endif // if FEATURE_NETWORK_TRAFFIC_COUNT
_networkIndex = networkIndex;
#ifdef ESP32
@@ -126,8 +131,17 @@ void NWPluginData_static_runtime::processEvent_and_clear()
bool NWPluginData_static_runtime::operational() const
{
return connected() && hasIP()
&& Settings.getNetworkEnabled(_networkIndex);
if (!Settings.getNetworkEnabled(_networkIndex)) { return false; }
if (_isAP) {
return
#ifdef ESP32
WiFi.AP.stationCount() > 0;
#else
WiFi.softAPgetStationNum() > 0;
#endif // ifdef ESP32
}
return connected() && hasIP();
// FIXME TD-er: WiFi STA keeps reporting it is
// connected and has IP even after call to networkdisable,1
@@ -156,11 +170,7 @@ void NWPluginData_static_runtime::processEvents()
}
}
// if (connected_changed || establishConnect_changed || gotIP_changed) {
// _operationalStats.forceSet(operational());
// } else {
_operationalStats.set(operational());
// }
_operationalStats.set(operational());
if (_operationalStats.changedSinceLastCheck_and_clear()) {
#if FEATURE_NETWORK_TRAFFIC_COUNT
@@ -185,6 +195,14 @@ void NWPluginData_static_runtime::processEvents()
}
statusLED(true);
}
if (_startStopStats.changedSinceLastCheck_and_clear() && _isAP && Settings.UseRules) {
if (_startStopStats.isOn()) {
eventQueue.add(F("WiFi#APmodeEnabled"));
} else if (_startStopStats.isOff()) {
eventQueue.add(F("WiFi#APmodeDisabled"));
}
}
}
String NWPluginData_static_runtime::statusToString() const
@@ -18,10 +18,16 @@ namespace net {
struct NWPluginData_static_runtime {
#ifdef ESP32
NWPluginData_static_runtime(NetworkInterface *netif,
const String & eventInterfaceName = EMPTY_STRING);
NWPluginData_static_runtime(
NetworkInterface *netif,
const String & eventInterfaceName = EMPTY_STRING);
NWPluginData_static_runtime(
bool isAP,
NetworkInterface *netif,
const String & eventInterfaceName = EMPTY_STRING);
#else // ifdef ESP32
NWPluginData_static_runtime(bool isSTA,
NWPluginData_static_runtime(bool isAP,
const char *eventInterfaceName);
#endif // ifdef ESP32
@@ -134,9 +140,7 @@ private:
#endif // ifdef ESP32
networkIndex_t _networkIndex = INVALID_NETWORK_INDEX;
#ifdef ESP8266
const bool _isSTA;
#endif
const bool _isAP;
String _eventInterfaceName;
@@ -14,8 +14,21 @@
namespace ESPEasy {
namespace net {
NWPluginData_static_runtime::NWPluginData_static_runtime(NetworkInterface *netif, const String& eventInterfaceName)
: _netif(netif), _eventInterfaceName(eventInterfaceName)
NWPluginData_static_runtime::NWPluginData_static_runtime(
NetworkInterface *netif,
const String & eventInterfaceName)
: _netif(netif),
_isAP(false),
_eventInterfaceName(eventInterfaceName)
{}
NWPluginData_static_runtime::NWPluginData_static_runtime(
bool isAP,
NetworkInterface *netif,
const String & eventInterfaceName)
: _netif(netif),
_isAP(isAP),
_eventInterfaceName(eventInterfaceName)
{}
bool NWPluginData_static_runtime::started() const
@@ -7,8 +7,8 @@
namespace ESPEasy {
namespace net {
NWPluginData_static_runtime::NWPluginData_static_runtime(bool isSTA, const char * eventInterfaceName)
: _isSTA(isSTA), _eventInterfaceName(eventInterfaceName) {}
NWPluginData_static_runtime::NWPluginData_static_runtime(bool isAP, const char *eventInterfaceName)
: _isAP(isAP), _eventInterfaceName(eventInterfaceName) {}
bool NWPluginData_static_runtime::started() const
{
@@ -18,14 +18,14 @@ bool NWPluginData_static_runtime::started() const
bool NWPluginData_static_runtime::connected() const
{
if (_isSTA) { return WiFi.status() == WL_CONNECTED; }
if (!_isAP) { return WiFi.status() == WL_CONNECTED; }
return false;
}
bool NWPluginData_static_runtime::isDefaultRoute() const
{
// FIXME TD-er: Should I just return connected() here?
return _isSTA;
return !_isAP;
}
bool NWPluginData_static_runtime::hasIP() const
@@ -37,7 +37,7 @@ void NWPluginData_static_runtime::mark_start()
{
_startStopStats.setOn();
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_INFO, _isSTA ? F("STA: Started") : F("AP: Started"));
addLog(LOG_LEVEL_INFO, _isAP ? F("AP: Started") : F("STA: Started"));
# endif
}
@@ -45,7 +45,7 @@ void NWPluginData_static_runtime::mark_stop()
{
_startStopStats.setOff();
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_INFO, _isSTA ? F("STA: Stopped") : F("AP: Stopped"));
addLog(LOG_LEVEL_INFO, _isAP ? F("AP: Stopped") : F("STA: Stopped"));
# endif
}
@@ -54,7 +54,7 @@ void NWPluginData_static_runtime::mark_got_IP()
// Set OnOffTimer to off so we can also count how often we het new IP
_gotIPStats.forceSet(true);
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_INFO, _isSTA ? F("STA: Got IP") : F("AP: Got IP"));
addLog(LOG_LEVEL_INFO, _isAP ? F("AP: Got IP") : F("STA: Got IP"));
# endif
}
@@ -62,7 +62,7 @@ void NWPluginData_static_runtime::mark_lost_IP()
{
_gotIPStats.setOff();
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_INFO, _isSTA ? F("STA: Lost IP") : F("AP: Lost IP"));
addLog(LOG_LEVEL_INFO, _isAP ? F("AP: Lost IP") : F("STA: Lost IP"));
# endif
}
@@ -107,7 +107,7 @@ void NWPluginData_static_runtime::log_disconnected()
{
# ifndef BUILD_NO_DEBUG
if (_isSTA && loglevelActiveFor(LOG_LEVEL_INFO)) {
if (!_isAP && loglevelActiveFor(LOG_LEVEL_INFO)) {
addLog(LOG_LEVEL_INFO, concat(
F("STA: Disconnected. Connected for: "),
format_msec_duration_HMS(_connectedStats.getLastOnDuration_ms())));
+21
View File
@@ -104,5 +104,26 @@ void CheckRunningServices() {
#endif
}
uint64_t NetworkConnectDuration_ms()
{
auto data = getDefaultRoute_NWPluginData_static_runtime();
if (data == nullptr) {
return 0ull;
}
return data->_connectedStats.getLastOnDuration_ms();
}
uint32_t NetworkConnectCount()
{
auto data = getDefaultRoute_NWPluginData_static_runtime();
if (data == nullptr) {
return 0ul;
}
return data->_connectedStats.getCycleCount();
}
} // namespace net
} // namespace ESPEasy
+3
View File
@@ -27,6 +27,9 @@ IPAddress NetworkBroadcast();
IPAddress NetworkSubnetMask();
IPAddress NetworkGatewayIP();
IPAddress NetworkDnsIP(uint8_t dns_no);
uint64_t NetworkConnectDuration_ms();
uint32_t NetworkConnectCount();
#if FEATURE_USE_IPV6
IPAddress NetworkLocalIP6();
+6 -3
View File
@@ -16,6 +16,7 @@ namespace ESPEasy {
namespace net {
#define NETWORK_INDEX_WIFI_STA 0 // Always the first network index
#define NETWORK_INDEX_WIFI_AP 1 // Always the 2nd network index
bool NWPluginCall(NWPlugin::Function Function, EventStruct *event) {
#ifdef USE_SECOND_HEAP
@@ -392,10 +393,12 @@ String getNWPluginNameFromNWPluginID(nwpluginID_t nwpluginID) {
NWPluginData_static_runtime* getWiFi_STA_NWPluginData_static_runtime()
{
auto NW_data = getNWPluginData(NETWORK_INDEX_WIFI_STA);
return getNWPluginData_static_runtime(NETWORK_INDEX_WIFI_STA);
}
if (!NW_data) { return nullptr; }
return NW_data->getNWPluginData_static_runtime();
NWPluginData_static_runtime* getWiFi_AP_NWPluginData_static_runtime()
{
return getNWPluginData_static_runtime(NETWORK_INDEX_WIFI_AP);
}
NWPluginData_static_runtime* getNWPluginData_static_runtime(networkIndex_t index)
+1
View File
@@ -45,6 +45,7 @@ String getNWPluginNameFromNetworkDriverIndex(networkDriverIndex_t
String getNWPluginNameFromNWPluginID(nwpluginID_t nwpluginID);
NWPluginData_static_runtime* getWiFi_STA_NWPluginData_static_runtime();
NWPluginData_static_runtime* getWiFi_AP_NWPluginData_static_runtime();
NWPluginData_static_runtime* getNWPluginData_static_runtime(networkIndex_t index);
const NWPluginData_static_runtime* getDefaultRoute_NWPluginData_static_runtime();
@@ -31,14 +31,18 @@ namespace wifi {
# define WIFI_CUSTOM_SUPPORT_KEY_INDEX 4
# define WIFI_CREDENTIALS_FALLBACK_SSID_INDEX 5
static LongTermOnOffTimer _last_scan;
WiFi_AP_CandidatesList::WiFi_AP_CandidatesList() {
_last_scan.clear();
known.clear();
candidates.clear();
known_it = known.begin();
}
WiFi_AP_CandidatesList::~WiFi_AP_CandidatesList() {
_last_scan.clear();
candidates.clear();
known.clear();
scanned.clear();
@@ -104,11 +108,11 @@ void WiFi_AP_CandidatesList::force_reload() {
RTC.clearLastWiFi(); // Invalidate the RTC WiFi data.
candidates.clear();
load_knownCredentials();
loadCandidatesFromScanned();
}
void WiFi_AP_CandidatesList::begin_scan() {
_last_scan.setNow();
void WiFi_AP_CandidatesList::begin_scan(uint8_t channel) {
_last_scan.setOn();
_last_scan_channel = channel;
candidates.clear();
_addedKnownCandidate = false;
}
@@ -126,15 +130,21 @@ void WiFi_AP_CandidatesList::purge_expired() {
# if !FEATURE_ESP8266_DIRECT_WIFI_SCAN
void WiFi_AP_CandidatesList::process_WiFiscan() {
// Append or update found APs from scan.
int scancount = WiFi.scanComplete();
for (int i = 0; i < scancount; ++i) {
const WiFi_AP_Candidate tmp(i);
// if (_last_scan.isOn()) {
// Append or update found APs from scan.
int scancount = WiFi.scanComplete();
if (scancount < 0) {
scanned_new.push_back(tmp);
}
} else {
for (int i = 0; i < scancount; ++i) {
const WiFi_AP_Candidate tmp(i);
after_process_WiFiscan();
scanned_new.push_back(tmp);
}
after_process_WiFiscan();
}
// }
}
# endif // if !FEATURE_ESP8266_DIRECT_WIFI_SCAN
@@ -152,6 +162,7 @@ void WiFi_AP_CandidatesList::process_WiFiscan(const bss_info& ap) {
# endif // ifdef ESP8266
void WiFi_AP_CandidatesList::after_process_WiFiscan() {
_last_scan.setOff();
scanned_new.sort();
scanned_new.unique();
_mustLoadCredentials = true;
@@ -165,14 +176,6 @@ bool WiFi_AP_CandidatesList::getNext(bool scanAllowed) {
if (candidates.empty()) {
return false;
/* if (scanAllowed) {
return false;
}
loadCandidatesFromScanned();
attemptsLeft = WiFi_CONNECT_ATTEMPTS;
if (candidates.empty()) { return false; }
*/
}
currentCandidate = candidates.front();
@@ -275,11 +278,11 @@ void WiFi_AP_CandidatesList::markCurrentConnectionStable() {
}
int8_t WiFi_AP_CandidatesList::scanComplete() const {
if (!_last_scan.isSet() ||
(_last_scan.millisPassedSince() > WIFI_AP_CANDIDATE_MAX_AGE)) return -3;
// if (!_last_scan.isOn() ||
// (_last_scan.getLastOnDuration_ms() > WIFI_AP_CANDIDATE_MAX_AGE)) return -3;
const int8_t scanCompleteStatus = WiFi.scanComplete();
if (scanCompleteStatus < 0) {
if (scanCompleteStatus == -1) {
// Still scanning
return scanCompleteStatus;
}
@@ -3,7 +3,7 @@
#include "../../../ESPEasy_common.h"
#include "../DataStructs/WiFi_AP_Candidate.h"
#include "../../../src/Helpers/LongTermTimer.h"
#include "../../../src/Helpers/LongTermOnOffTimer.h"
#include <list>
@@ -31,7 +31,7 @@ struct WiFi_AP_CandidatesList {
// Called after WiFi credentials have changed.
void force_reload();
void begin_scan();
void begin_scan(uint8_t channel = 0);
void purge_expired();
@@ -124,7 +124,7 @@ private:
bool _mustLoadCredentials = true;
bool _addedKnownCandidate = false;
LongTermTimer _last_scan;
uint8_t _last_scan_channel{};
public:
@@ -27,9 +27,9 @@ namespace net {
namespace wifi {
# ifdef ESP32
static NWPluginData_static_runtime stats_and_cache(&NW_PLUGIN_INTERFACE);
static NWPluginData_static_runtime stats_and_cache(true, &NW_PLUGIN_INTERFACE);
# else
static NWPluginData_static_runtime stats_and_cache(false, "AP"); // Cannot use flash strings during init of static objects
static NWPluginData_static_runtime stats_and_cache(true, "AP"); // Cannot use flash strings during init of static objects
# endif // ifdef ESP32
static bool nw002_initialized{};
# ifdef ESP32
@@ -24,7 +24,7 @@ namespace ESPEasy {
namespace net {
namespace wifi {
static NWPluginData_static_runtime stats_and_cache(true, "WiFi"); // Cannot use flash strings during init of static objects
static NWPluginData_static_runtime stats_and_cache(false, "WiFi"); // Cannot use flash strings during init of static objects
static WiFiDisconnectReason _wifi_disconnect_reason = WiFiDisconnectReason::WIFI_DISCONNECT_REASON_UNSPECIFIED;
static uint8_t _authmode{};
@@ -131,7 +131,6 @@ void ESPEasyWiFi_STA_EventHandler::onWiFiScanDone(void ESPEasyWiFi_STA_EventHand
++scanCount;
}
WiFi_AP_Candidates.after_process_WiFiscan();
WiFiEventData.lastGetScanMoment.setNow();
// WiFiEventData.processedScanDone = true;
# ifndef BUILD_NO_DEBUG
@@ -174,13 +174,13 @@ void ESPEasyWiFi_t::loop()
# endif // ifndef BUILD_NO_DEBUG
} else if (scanCompleteStatus == -2) { // WIFI_SCAN_FAILED
addLog(LOG_LEVEL_ERROR, F("WiFi : Scan failed"));
WiFi.scanDelete();
// WiFi.scanDelete();
setState(WiFiState_e::WiFiOFF, 1000);
WiFiEventData.processedScanDone = true;
}
if (_state_timeout.timeReached() || (scanCompleteStatus >= 0)) {
WiFi.scanDelete();
// WiFi.scanDelete();
if (_state_timeout.timeReached()) {
# ifndef BUILD_NO_DEBUG
@@ -211,13 +211,13 @@ void ESPEasyWiFi_t::loop()
# endif // ifndef BUILD_NO_DEBUG
} else if (scanCompleteStatus == -2) { // WIFI_SCAN_FAILED
addLog(LOG_LEVEL_ERROR, F("WiFi : Scan failed"));
WiFi.scanDelete();
// WiFi.scanDelete();
setState(WiFiState_e::WiFiOFF, 1000);
WiFiEventData.processedScanDone = true;
}
if (_state_timeout.timeReached() || (scanCompleteStatus >= 0)) {
WiFi.scanDelete();
// WiFi.scanDelete();
if (_state_timeout.timeReached()) {
# ifndef BUILD_NO_DEBUG
@@ -331,7 +331,7 @@ void ESPEasyWiFi_t::setState(WiFiState_e newState, uint32_t timeout) {
if ((_state == WiFiState_e::STA_AP_Scanning) ||
(_state == WiFiState_e::STA_Scanning))
{
WiFi.scanDelete();
WiFi_AP_Candidates.process_WiFiscan();
}
if (timeout == 0)
+2 -1
View File
@@ -230,13 +230,14 @@ void WiFiScan_log_to_serial()
if (WiFi_AP_Candidates.scanComplete() <= 0) {
WiFiMode_t cur_wifimode = WiFi.getMode();
WifiScan(false);
WiFi_AP_Candidates.process_WiFiscan();
setWifiMode(cur_wifimode);
}
const int8_t scanCompleteStatus = WiFi_AP_Candidates.scanComplete();
if (scanCompleteStatus <= 0) {
serialPrintln(F("WIFI : No networks found"));
serialPrintln(concat(F("WIFI : No networks found. Status: "), scanCompleteStatus));
}
else
{
@@ -109,25 +109,23 @@ void handle_unprocessedNetworkEvents()
// Functions to process the data gathered from the events.
// These functions are called from Setup() or Loop() and thus may call delay() or yield()
// ********************************************************************************
/*
void processDisconnect() {}
void processConnect() {
if (WiFiEventData.processedConnect) { return; }
/*
// delay(100); // FIXME TD-er: See https://github.com/letscontrolit/ESPEasy/issues/1987#issuecomment-451644424
if (checkAndResetWiFi()) {
return;
}
*/
// if (checkAndResetWiFi()) {
// return;
// }
WiFiEventData.processedConnect = true;
/*
if (WiFi.status() == WL_DISCONNECTED) {
// Apparently not really connected
return;
}
*/
// if (WiFi.status() == WL_DISCONNECTED) {
// Apparently not really connected
// return;
// }
WiFiEventData.setWiFiConnected();
++WiFiEventData.wifi_reconnects;
@@ -201,6 +199,7 @@ void processConnect() {
logConnectionStatus();
}
void processGotIP() {
if (WiFiEventData.processedGotIP) {
return;
@@ -290,6 +289,7 @@ void processGotIP() {
logConnectionStatus();
}
# if FEATURE_USE_IPV6
void processGotIPv6() {
@@ -308,6 +308,7 @@ void processGotIPv6() {
# endif // if FEATURE_USE_IPV6
// A client disconnected from the AP on this node.
void processDisconnectAPmode() {
if (WiFiEventData.processedDisconnectAPmode) { return; }
@@ -451,6 +452,7 @@ void processScanDone() {
}
}
*/
} // namespace wifi
} // namespace net
@@ -8,16 +8,16 @@ namespace net {
namespace wifi {
//void handle_unprocessedNetworkEvents();
void processDisconnect();
void processConnect();
void processGotIP();
//void processDisconnect();
//void processConnect();
//void processGotIP();
# if FEATURE_USE_IPV6
void processGotIPv6();
//void processGotIPv6();
# endif
void processDisconnectAPmode();
void processConnectAPmode();
void processDisableAPmode();
void processScanDone();
//void processDisconnectAPmode();
//void processConnectAPmode();
//void processDisableAPmode();
//void processScanDone();
} // namespace wifi
} // namespace net
@@ -116,7 +116,8 @@ void doSetAPinternal(bool enable)
}
if (WiFi.softAP(softAPSSID.c_str(), pwd.c_str(), channel)) {
eventQueue.add(F("WiFi#APmodeEnabled"));
auto data = getWiFi_AP_NWPluginData_static_runtime();
if (data) data->mark_start();
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
addLogMove(LOG_LEVEL_INFO, strformat(
@@ -162,6 +163,8 @@ void doSetAPinternal(bool enable)
dnsServer.stop();
}
# endif // if FEATURE_DNS_SERVER
auto data = getWiFi_AP_NWPluginData_static_runtime();
if (data) data->mark_stop();
}
}
@@ -104,7 +104,7 @@ bool doSetWifiMode(WiFiMode_t new_mode)
doWiFiDisconnect();
// delay(100);
processDisconnect();
//processDisconnect();
// WiFiEventData.clear_processed_flags();
}
@@ -265,7 +265,8 @@ void doWifiScan(bool async, uint8_t channel) {
if (!async) {
FeedSW_watchdog();
processScanDone();
WiFi_AP_Candidates.process_WiFiscan();
// processScanDone();
}
}
# if FEATURE_TIMING_STATS
@@ -200,7 +200,10 @@ void doWifiScan(bool async, uint8_t channel) {
if (!async) {
FeedSW_watchdog();
processScanDone();
WiFi_AP_Candidates.process_WiFiscan();
// FIXME TD-er: This should call WiFi_AP_Candidates.process_WiFiscan();
// processScanDone();
}
}
# if FEATURE_TIMING_STATS
+3 -13
View File
@@ -520,24 +520,14 @@ String getValue(LabelType::Enum label) {
WiFi_encryptionType(WiFiEventData.auth_mode);
#endif
case LabelType::CONNECTED:
#if FEATURE_ETHERNET
if(active_network_medium == ESPEasy::net::NetworkMedium_t::Ethernet) {
return format_msec_duration(EthEventData.lastConnectMoment.millisPassedSince());
}
#endif // if FEATURE_ETHERNET
return format_msec_duration(WiFiEventData.lastConnectMoment.millisPassedSince());
return format_msec_duration(ESPEasy::net::NetworkConnectDuration_ms());
// Use only the nr of seconds to fit it in an int32, plus append '000' to have msec format again.
case LabelType::CONNECTED_MSEC:
#if FEATURE_ETHERNET
if(active_network_medium == ESPEasy::net::NetworkMedium_t::Ethernet) {
return String(static_cast<int32_t>(EthEventData.lastConnectMoment.millisPassedSince() / 1000ll)) + F("000");
}
#endif // if FEATURE_ETHERNET
return String(static_cast<int32_t>(WiFiEventData.lastConnectMoment.millisPassedSince() / 1000ll)) + F("000");
return String(static_cast<int32_t>(ESPEasy::net::NetworkConnectDuration_ms() / 1000ll)) + F("000");
case LabelType::LAST_DISCONNECT_REASON: return String(WiFiEventData.lastDisconnectReason);
case LabelType::LAST_DISC_REASON_STR: return getLastDisconnectReason();
case LabelType::NUMBER_RECONNECTS: retval = WiFiEventData.wifi_reconnects; break;
case LabelType::NUMBER_RECONNECTS: retval = ESPEasy::net::NetworkConnectCount(); break;
case LabelType::WIFI_STORED_SSID1: return String(SecuritySettings.WifiSSID);
case LabelType::WIFI_STORED_SSID2: return String(SecuritySettings.WifiSSID2);
+1
View File
@@ -68,6 +68,7 @@ void handle_wifiscanner() {
WiFiMode_t cur_wifimode = WiFi.getMode();
ESPEasy::net::wifi::WifiScan(false);
ESPEasy::net::wifi::WiFi_AP_Candidates.process_WiFiscan();
int8_t scanCompleteStatus = ESPEasy::net::wifi::WiFi_AP_Candidates.scanComplete();
ESPEasy::net::wifi::setWifiMode(cur_wifimode);