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

NETWORK_CONTROLLER switched by user #55

Closed
Sampozzo opened this issue Nov 10, 2021 · 3 comments
Closed

NETWORK_CONTROLLER switched by user #55

Sampozzo opened this issue Nov 10, 2021 · 3 comments
Labels

Comments

@Sampozzo
Copy link

Sampozzo commented Nov 10, 2021

Hello, thank you very much for this library, i'm using it in my project and it works very well.

I'm building an ESP32 device with an angular client that talks with the controller on websocket and it works well over ethernet, over wifi and over softAP.
My device at boot load the configuration from SPIFFS and start.

What i'm trying to do now is to add the ability for the user to choose the connection type (Eth/softAP/Wifi), save it in config and reboot with the new configuration.

But i think it is not possible because NETWORK_CONTROLLER must be defined in the config.h and can't be changed later.
Any idea how i can do?

Thank you very much and sorry for my english.

@skaarj1989
Copy link
Owner

Hi @Sampozzo

(...) NETWORK_CONTROLLER must be defined in the config.h and can't be changed later. Any idea how i can do?

This is correct, you have to specify network controller at compile time. This can't be changed without major refactoring.

@Sampozzo
Copy link
Author

Hi, thank you for your reply!

i'm using platform.io and i did those steps:

  1. moved the library from the libdeps folder to lib folder and removed from platformio.ini
  2. made a copy of the library, named mWebSocketWifi
  3. changed the second namespace to netWifi
  4. solved some little compile errors
  5. declared EthernetClient ethClient; and WiFiClient wifiClient; as globals
  6. in setup, read config from SPIFFS and start ethernet client OR wificlient

now i can switch from wifi to ethernet without reflash.
I know this isn't the way, but it's works and i'm only learning :) next step is to go deeper in your library to learn how to write single one :)

Thank you very much!

@stale
Copy link

stale bot commented Dec 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 11, 2021
@stale stale bot closed this as completed Dec 18, 2021
@skaarj1989 skaarj1989 pinned this issue Feb 20, 2022
@skaarj1989 skaarj1989 unpinned this issue Feb 20, 2022
@skaarj1989 skaarj1989 pinned this issue Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants