7
7
#include " knx/bits.h"
8
8
9
9
#ifndef KNX_SERIAL
10
- #define KNX_SERIAL Serial1
10
+ #define KNX_SERIAL Serial1
11
+ #pragma warn "KNX_SERIAL not defined, using Serial1"
12
+ #endif
13
+
14
+ #ifdef KNX_IP_LAN
15
+ #include " Eth.h"
16
+ #define KNX_NETIF ETH
17
+ #else // KNX_IP_WIFI
18
+ #include < WiFi.h>
19
+ #define KNX_NETIF WiFi
11
20
#endif
12
21
13
22
Esp32Platform::Esp32Platform ()
@@ -43,17 +52,17 @@ void Esp32Platform::setupUart()
43
52
44
53
uint32_t Esp32Platform::currentIpAddress ()
45
54
{
46
- return WiFi .localIP ();
55
+ return KNX_NETIF .localIP ();
47
56
}
48
57
49
58
uint32_t Esp32Platform::currentSubnetMask ()
50
59
{
51
- return WiFi .subnetMask ();
60
+ return KNX_NETIF .subnetMask ();
52
61
}
53
62
54
63
uint32_t Esp32Platform::currentDefaultGateway ()
55
64
{
56
- return WiFi .gatewayIP ();
65
+ return KNX_NETIF .gatewayIP ();
57
66
}
58
67
59
68
void Esp32Platform::macAddress (uint8_t * addr)
@@ -80,7 +89,7 @@ void Esp32Platform::setupMultiCast(uint32_t addr, uint16_t port)
80
89
IPAddress mcastaddr (htonl (addr));
81
90
82
91
KNX_DEBUG_SERIAL.printf (" setup multicast addr: %s port: %d ip: %s\n " , mcastaddr.toString ().c_str (), port,
83
- WiFi .localIP ().toString ().c_str ());
92
+ KNX_NETIF .localIP ().toString ().c_str ());
84
93
uint8_t result = _udp.beginMulticast (mcastaddr, port);
85
94
KNX_DEBUG_SERIAL.printf (" result %d\n " , result);
86
95
}
0 commit comments