From 94812d870f8bb2c1342566c23a6f483145a5f6f8 Mon Sep 17 00:00:00 2001 From: Peter Jakobs Date: Thu, 31 Oct 2024 09:07:38 +0100 Subject: [PATCH 1/5] fixed network scan --- Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index 1c4af61451..ce6dbb5a58 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -420,8 +420,8 @@ void StationImpl::staticScanCompleted(wifi_event_sta_scan_done_t* event, uint8_t wifi_ap_record_t ap_info[number]; uint16_t ap_count{0}; memset(ap_info, 0, sizeof(ap_info)); - ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count)); + ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); // TODO: Handle hidden APs for(unsigned i = 0; (i < event->number) && (i < ap_count); i++) { list.addElement(new BssInfoImpl(&ap_info[i])); From f2fbdc5aa4c8fd36d621dc3a61c3c04591fef6b4 Mon Sep 17 00:00:00 2001 From: Peter Jakobs Date: Thu, 31 Oct 2024 10:51:53 +0100 Subject: [PATCH 2/5] removed call to `esp_wifi_scan_get_ap_num` entirely --- .../Components/Network/Arch/Esp32/Platform/StationImpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index ce6dbb5a58..304f5ef073 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -418,12 +418,12 @@ void StationImpl::staticScanCompleted(wifi_event_sta_scan_done_t* event, uint8_t if(station.scanCompletedCallback) { uint16_t number = event->number; wifi_ap_record_t ap_info[number]; - uint16_t ap_count{0}; + memset(ap_info, 0, sizeof(ap_info)); - ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); + // TODO: Handle hidden APs - for(unsigned i = 0; (i < event->number) && (i < ap_count); i++) { + for(unsigned i = 0; (i < event->number); i++) { list.addElement(new BssInfoImpl(&ap_info[i])); } station.scanCompletedCallback(true, list); From 2b2897efba15c1ae4db14b820e27e36973231f94 Mon Sep 17 00:00:00 2001 From: Peter Jakobs Date: Thu, 31 Oct 2024 11:10:10 +0100 Subject: [PATCH 3/5] fixed coding style --- Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index 304f5ef073..073ebf62a6 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -418,10 +418,10 @@ void StationImpl::staticScanCompleted(wifi_event_sta_scan_done_t* event, uint8_t if(station.scanCompletedCallback) { uint16_t number = event->number; wifi_ap_record_t ap_info[number]; - + memset(ap_info, 0, sizeof(ap_info)); ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); - + // TODO: Handle hidden APs for(unsigned i = 0; (i < event->number); i++) { list.addElement(new BssInfoImpl(&ap_info[i])); From cdc6fe6614dabb0785e43b549f22090c4aca7bf8 Mon Sep 17 00:00:00 2001 From: Peter Jakobs Date: Thu, 31 Oct 2024 11:40:55 +0100 Subject: [PATCH 4/5] changed from event->number to number as the loop variable when filling the list of wlans --- Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index 073ebf62a6..d85d94bd31 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -423,7 +423,7 @@ void StationImpl::staticScanCompleted(wifi_event_sta_scan_done_t* event, uint8_t ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); // TODO: Handle hidden APs - for(unsigned i = 0; (i < event->number); i++) { + for(unsigned i = 0; (i < number); i++) { list.addElement(new BssInfoImpl(&ap_info[i])); } station.scanCompletedCallback(true, list); From c8059f863e74ee527fabd16e17b0e9534636fc29 Mon Sep 17 00:00:00 2001 From: Peter Jakobs Date: Thu, 31 Oct 2024 11:53:03 +0100 Subject: [PATCH 5/5] removed redundand () --- Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index d85d94bd31..bbaddc46c9 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -423,7 +423,7 @@ void StationImpl::staticScanCompleted(wifi_event_sta_scan_done_t* event, uint8_t ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&number, ap_info)); // TODO: Handle hidden APs - for(unsigned i = 0; (i < number); i++) { + for(unsigned i = 0; i < number; i++) { list.addElement(new BssInfoImpl(&ap_info[i])); } station.scanCompletedCallback(true, list);