Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed network scan #2906

Merged
merged 5 commits into from
Oct 31, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_records(&number, ap_info));
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_num(&ap_count));

// TODO: Handle hidden APs
for(unsigned i = 0; (i < event->number) && (i < ap_count); i++) {
for(unsigned i = 0; (i < event->number); i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this loop should use number instead of event->number as it's the more recently aquired value. Presumably these values should always be the same, so could include an assert(number == event->number) but I think that's overkill.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, especially as it's unclear if esp_wifi_scan_get_ap_records changes number and what it would mean if those diverge

list.addElement(new BssInfoImpl(&ap_info[i]));
}
station.scanCompletedCallback(true, list);
Expand Down
Loading