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

[FEATURE REQUEST] Compatible library code #43

Closed
mathertel opened this issue Jun 16, 2024 · 3 comments
Closed

[FEATURE REQUEST] Compatible library code #43

mathertel opened this issue Jun 16, 2024 · 3 comments

Comments

@mathertel
Copy link

mathertel commented Jun 16, 2024

Please consider implementing a library version that is compatible with 3.x and pre-3.x.
using if (ESP_ARDUINO_VERSION_MAJOR < 3)

It is hard for typical Arduino users to distinguish between versions so a version 2.0 that runs with both ESP32 board adoptions is probably welcome.

e.g.:

  IPAddress SSDPClass::localIP() {

#if (ESP_ARDUINO_VERSION_MAJOR < 3)
    tcpip_adapter_ip_info_t ip;
    if (WiFi.getMode() == WIFI_STA) {
      if (tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip)) {
        return IPAddress();
      }
    } else if (WiFi.getMode() == WIFI_OFF) {
      if (tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)) {
        return IPAddress();
      }
    }
    return IPAddress(ip.ip.addr);
  }

#else
    esp_netif_ip_info_t ip;
    if (WiFi.getMode() == WIFI_STA) {
      if (esp_netif_get_ip_info(get_esp_interface_netif(ESP_IF_WIFI_STA), &ip)) {
        return IPAddress();
      }
    } else if (WiFi.getMode() == WIFI_OFF) {
      if (esp_netif_get_ip_info(get_esp_interface_netif(ESP_IF_ETH), &ip)) {
        return IPAddress();
      }
    }
#endif
    return IPAddress(ip.ip.addr);
  }

Thanks for your library.

Copy link

Thank your for submiting, please be sure you followed template or your issue may be dismissed.

@luc-github
Copy link
Owner

luc-github commented Jun 17, 2024

thank you is that working with platformio also ? Is this define ESP_ARDUINO_VERSION_MAJOR present when using platformio ?

EDIT: tested and seems yes

@luc-github
Copy link
Owner

Merged thank you

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

No branches or pull requests

2 participants