Increase number of SSID reported by scan-for-SSID in ESP32

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
jandidden
Posts: 110
http://meble-kuchenne.info.pl
Joined: Mon Feb 13, 2023 7:56 pm
Has thanked: 28 times
Been thanked: 12 times

Increase number of SSID reported by scan-for-SSID in ESP32

Post by jandidden »

I am using an ESP32_wroom_32 for a Wifi-connected project.
The function ScanForSSID reports the WiFi networks visible at the location, so you can select the one you want to connect to.
Unfortunately, it only reports the first 8 networks it sees.
In my location, there are currently 18 (!) networks visible, and only 8 are reported.
It's a toss-up if the network I need is within the first 8, depending on momentary signal strength I guess.
So this is a show stopper for my project.

Is it a big deal to increase the number of reported networks, like to 256, to be future-proof?

Edit: the number of networks reported is correct, and the correct number of names can be displayed, but only the first 8 have a meaningful string, the remaining are either empty or show gibberish. See attached with 18 detected networks.

Jan
Attachments
ssid help.PNG
ssid help.PNG (13.28 KiB) Viewed 1697 times
SSID list.jpg
SSID list.jpg (200.09 KiB) Viewed 1699 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by BenR »

Hello,

The problem with increasing the max number to 256 is that there is a RAM usage hit for each additional SSID slot that is created.

If you want to increase the max count yourself then you can do so by looking at the ESP_CAL_WIFI.c file here using a text editor.

v9

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\ESP
v10

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\ESP
Copy and paste the path into your Windows file explorer to get to the directory.

Inside the file look for this line, around line 70.

Code: Select all

#define WIFI_SCAN_LIST_MAX 8
Then change to suit your needs, e.g.

Code: Select all

#define WIFI_SCAN_LIST_MAX 30
Save the file and then recompile and hopefully it will work as expected now.

I'll investigate and see if we can increase the stock amount a bit without having too much of an impact on existing projects.

kersing
Valued Contributor
Posts: 158
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 64 times
Been thanked: 58 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by kersing »

Could it be a configurable parameter for the component?

jandidden
Posts: 110
Joined: Mon Feb 13, 2023 7:56 pm
Has thanked: 28 times
Been thanked: 12 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by jandidden »

Thanks Ben, I'll try that.
The 256 was a bit tongue-in-cheek of course - but something like 16 or 32 should be doable. The mem in that ESP32 is huge.

Jan

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by BenR »

kersing wrote:
Mon Jun 12, 2023 3:36 pm
Could it be a configurable parameter for the component?
Yes good idea. I'll make that change now in v10.

jandidden
Posts: 110
Joined: Mon Feb 13, 2023 7:56 pm
Has thanked: 28 times
Been thanked: 12 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by jandidden »

Set it to 32 and all is fine.
Now that people get home from work I'm flooded with no less than 23 active networks.

Next is to figger out to make a scrollable list and how to select from it.
Should be fun.

Thanks Ben!

Jan

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by chipfryer27 »

Hi Jan

Ages ago I used a mobile phone to configure. Basically if the ESP couldn't connect it then went it to a "configure routine". This routine created an AP and published a page with all found SSIDs. You could then select the required one and enter a password.

The ESP can remember the last connection so this only ran if things changed.

If I remember correctly I think Benj published something similar.

Maybe that would help?

Regards

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by BenR »


jandidden
Posts: 110
Joined: Mon Feb 13, 2023 7:56 pm
Has thanked: 28 times
Been thanked: 12 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by jandidden »

Great topic! Will certainly come in handy for me!

Jan

jandidden
Posts: 110
Joined: Mon Feb 13, 2023 7:56 pm
Has thanked: 28 times
Been thanked: 12 times

Re: Increase number of SSID reported by scan-for-SSID in ESP32

Post by jandidden »

chipfryer27 wrote:
Mon Jun 12, 2023 5:44 pm
Ages ago I used a mobile phone to configure. Basically if the ESP couldn't connect it then went it to a "configure routine". This routine created an AP and published a page with all found SSIDs. You could then select the required one and enter a password.
That is the way my audio streamer works; it goes into AP mode, you can connect to it and tell it which network to connect to.
It's not reliable though, so if I go that way I definitely need a soft button to force it into that mode.
It's attractive; I don't look forward to fiddle with a soft keyboard on the small display to enter password strings and such.
Much easier on a phone or tablet.

At this point I have no idea how to publish a 'setup' page to say a phone though.

Jan

Post Reply