gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

Slight improvements to use this library with native ESP8266 Ethernet drivers such as lwIP_enc28j60 #32

Open Nourbakhsh-Rad opened 2 years ago

Nourbakhsh-Rad commented 2 years ago

Hi @gmag11 I added some weak functions to use this library with native ESP8266 Ethernet drivers such as lwIP_enc28j60 ( Sorry I made a mistake in creating pull request, please delete my invalid pull requests )

gmag11 commented 2 years ago

I'd rather a solution that do not force to modify existing examples. This direction would break all former code using older versions. I guess using preprocessor directives like #define USE_ETHERNET would make a cleaner integration of ethernet on ESP8266.

Nourbakhsh-Rad commented 2 years ago

Only by restarting the device and applying the connection settings, it is possible to change the mode from WiFi to Ethernet at runtime. In this case, the preprocessor is not a good solution. While using weak functions allows you to use this library on other platforms ( which support AsyncUDP ) with a few changes.

Nourbakhsh-Rad commented 2 years ago

I changed the default of weak functions to be compatible with the old versions ..... (old version users can use the new version without any changes)

Nourbakhsh-Rad commented 2 years ago

Conflicts were resolved .....