Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add callback to allow Static IP per SSID in WiFiMulti#9232

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Sojourneer wants to merge4 commits intoesp8266:master
base:master
Choose a base branch
Loading
fromSojourneer:master

Conversation

@Sojourneer
Copy link

Callback before WiFi.begin allows user to configure selected SSID.

Callback before WiFi.begin allows user to configure selected SSID
@mcspr
Copy link
Collaborator

Wouldn't extending 'add' method arguments be more a appropriate solution? Internally, only ssid & pass are stored. No reason not to keep 'IPAddress'es for static config as well

@Sojourneer
Copy link
Author

Wouldn't extending 'add' method arguments be more a appropriate solution? Internally, only ssid & pass are stored. No reason not to keep 'IPAddress'es for static config as well

That is the more obvious solution. But it has a higher impact on existing API and is less flexible. This solution adds two lines to the code (and two lines of declaration), and zero impact on existing API.

@mcspr
Copy link
Collaborator

Meaning, there are other use-cases besides config() call?

fwiw, default arguments passed at the end of the method can be omitted and .add() call stays the same. IPAddress has default constructor, ::isSet() would notify whether IPAddress was set by the user or not.

@Sojourneer
Copy link
Author

Sojourneer commentedMar 1, 2025
edited
Loading

Meaning, there are other use-cases besides config() call?

In my use-case, I am setting the config parameters based on the MAC address (because of various router issues). Yes, that could be done upfront rather than when the SSID is decided.
But it seems cleaner, as well as more efficient, to have the config calculated when needed rather than preemptively. I have a library that takes a JSON config (IP, as well as optionally MQTT etc.) and applies it in the callback to call config per the found SSID. Again, decoupling that from the code for the physical connection is beneficial.

@mcspr
Copy link
Collaborator

Ok, agreed

Style suggestion then - useonSsidSelected(...) as one word without underscores. This is also the style used for other event-related things in the WiFi class.
Can you also update the example .ino (sketch) and documentation, or do you want me to do it?

@Sojourneer
Copy link
Author

Ok, I'll do it, and change the name as you recommend. Do I need to redo the pull (I'm a noobie at this process)?

@mcspr
Copy link
Collaborator

Just push more commits to Sojourneer:master

Sojourneerand others added3 commitsMarch 4, 2025 00:31
- callback has no return type- private types for the wifimulti class- explici WiFi.config(0U, 0U, 0U); for other APs- formatting, whitespace, uppercase SSID
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Sojourneer@mcspr

[8]ページ先頭

©2009-2025 Movatter.jp