Skip to content

Commit

Permalink
Merge pull request #103 from t1m0thyj/support-wifiesp
Browse files Browse the repository at this point in the history
Add support for WifiEsp library
  • Loading branch information
ropg authored Nov 6, 2020
2 parents 0b64aae + f53a95b commit 7b3c8aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/ezTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#elif defined(EZTIME_WIFIESP)
#include <WifiEsp.h>
#include <WifiEspUdp.h>
#else
#include <WiFi.h>
#include <WiFiUdp.h>
Expand Down Expand Up @@ -416,7 +419,11 @@ namespace ezt {

#ifndef EZTIME_ETHERNET
if (WiFi.status() != WL_CONNECTED) { triggerError(NO_NETWORK); return false; }
WiFiUDP udp;
#ifndef EZTIME_WIFIESP
WiFiUDP udp;
#else
WiFiEspUDP udp;
#endif
#else
EthernetUDP udp;
#endif
Expand Down Expand Up @@ -799,7 +806,11 @@ String Timezone::getPosix() { return _posix; }

#ifndef EZTIME_ETHERNET
if (WiFi.status() != WL_CONNECTED) { triggerError(NO_NETWORK); return false; }
WiFiUDP udp;
#ifndef EZTIME_WIFIESP
WiFiUDP udp;
#else
WiFiEspUDP udp;
#endif
#else
EthernetUDP udp;
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/ezTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// Arduino Ethernet shields
// #define EZTIME_ETHERNET

// Arduino board with ESP8266 shield
// #define EZTIME_WIFIESP

// Uncomment one of the below to only put only messages up to a certain level in the compiled code
// (You still need to turn them on with setDebug(someLevel) to see them)
// #define EZTIME_MAX_DEBUGLEVEL_NONE
Expand Down

0 comments on commit 7b3c8aa

Please sign in to comment.