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 local broadcast address calculation and MAC address when in AP mode #23

Open
alf45tar opened this issue Jun 9, 2023 · 7 comments

Comments

@alf45tar
Copy link

alf45tar commented Jun 9, 2023

Hi @rstephan,
I fixed your library when using EPS8266 in AP mode. Do you want me to submit a PR?

Thanks
alf45tar

@rstephan
Copy link
Owner

Sure, why not.

@rstephan
Copy link
Owner

Sorry for the delay.

I don't like the fact, that there is a hard-coded value in the code.
Apart from that, it is looking good.

But you can get the CIDR with softAPSubnetCIDR() and compute the subnet mask form that.

@rstephan
Copy link
Owner

Maybe I can convince the Espressif folks to have a shortcut ;-)

espressif/arduino-esp32#8358

@alf45tar
Copy link
Author

Sorry for the delay.

I don't like the fact, that there is a hard-coded value in the code. Apart from that, it is looking good.

But you can get the CIDR with softAPSubnetCIDR() and compute the subnet mask form that.

Thanks for let me know the softAPSubnetCIDR(). I will use it and submit the new fix.

@alf45tar
Copy link
Author

softAPSubnetCIDR() is not available for ESP8266.

@alf45tar
Copy link
Author

Hard coded netmask removed in AP mode using wifi_get_ip_info().
PR ready to merge.

@rstephan
Copy link
Owner

Hi,

and sadly, the function wifi_get_ip_info() is not available in ESP32. Or at least not in the Arduino board package 2.0.9. So this is also not a valid solution.

My library should work with every board or at least with as many as possible.
Therefore, and due to the fact that every board (ESP8266, ESP32, RP2040, ...) hast a different API for the AP-Mode, I am going into a other direction. It is not a good solution to build exceptions for all controller into my library.

I am seeing this more like this:

uint8_t ArtnetnodeWifi::begin(String hostname); // "Normal", client mode
uint8_t ArtnetnodeWifi::begin(String hostname, IPAddress ip, IPAddress netmask, IPAddress gateway);
uint8_t ArtnetnodeWifi::begin(String hostname, IPAddress ip, IPAddress netmask, IPAddress gateway, byte* mac);

You have the information during setup for the softAPConfig() function, why not using this information for the ArtnetnodeWifi::begin() call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants