esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
16.08k stars 13.33k forks source link

ethernet object does not have a dnsIP method. #9168

Closed nopnop2002 closed 4 months ago

nopnop2002 commented 4 months ago

Basic Infos

Platform

Settings in IDE

Problem Description

The WiFi object has a dnsIP method.

The ethernet object does not have a dnsIP method.

MCVE Sketch


#include <SPI.h>
#include <ESP8266WiFi.h>
#include <W5500lwIP.h>
//#include <W5100lwIP.h>
//#include <ENC28J60lwIP.h>

#define CSPIN 16

Wiznet5500lwIP eth(CSPIN);
//Wiznet5100lwIP eth(CSPIN);
//ENC28J60lwIP eth(CSPIN);
byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02};

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();
  Serial.print(ESP.getFullVersion());
  Serial.println();

  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);
  SPI.setFrequency(4000000);

  eth.setDefault(); // use ethernet for default route

  int present = eth.begin(mac);
  if (!present) {
    Serial.println("no ethernet hardware present");
    while(1);
  }

  Serial.print("connecting ethernet");
  while (!eth.connected()) {
    Serial.print(".");
    delay(1000);
  }
  Serial.println();
  Serial.print("ethernet ip address: ");
  Serial.println(eth.localIP());
  Serial.print("ethernet subnetMask: ");
  Serial.println(eth.subnetMask());
  Serial.print("ethernet gateway: ");
  Serial.println(eth.gatewayIP());
  Serial.println(eth.dnsIP());
}

void loop() {
  if (eth.status() == WL_CONNECTED) {
    //Serial.println("Ethernet Connected!");
  } else {
    Serial.println("Ethernet Not Connected!");
  }
  delay(1000);
}

Debug Messages

\\LANDISK-HDL-AA1\disk1\Arduino\ESP8266_Ethernet\connectEthernet\connectEthernet.ino: In function 'void setup()':
connectEthernet:57:22: error: 'using Wiznet5500lwIP = class LwipIntfDev<Wiznet5500>' {aka 'class LwipIntfDev<Wiznet5500>'} has no member named 'dnsIP'
   57 |   Serial.println(eth.dnsIP());
      |                      ^~~~~
JAndrassy commented 4 months ago

it will be in the next version https://github.com/esp8266/Arduino/blob/7e0d20e2b9034994f573a236364e0aef17fd66de/cores/esp8266/LwipIntfDev.h#L103