mirror of
https://github.com/thelsing/knx.git
synced 2025-05-12 01:15:12 +02:00
adapt esp plattform using KNX_NETIF
This commit is contained in:
parent
2cd5a28d8e
commit
5528888b72
@ -7,7 +7,16 @@
|
||||
#include "knx/bits.h"
|
||||
|
||||
#ifndef KNX_SERIAL
|
||||
#define KNX_SERIAL Serial1
|
||||
#define KNX_SERIAL Serial1
|
||||
#pragma warn "KNX_SERIAL not defined, using Serial1"
|
||||
#endif
|
||||
|
||||
#ifdef KNX_IP_LAN
|
||||
#include "Eth.h"
|
||||
#define KNX_NETIF ETH
|
||||
#else // KNX_IP_WIFI
|
||||
#include <WiFi.h>
|
||||
#define KNX_NETIF WiFi
|
||||
#endif
|
||||
|
||||
Esp32Platform::Esp32Platform()
|
||||
@ -43,17 +52,17 @@ void Esp32Platform::setupUart()
|
||||
|
||||
uint32_t Esp32Platform::currentIpAddress()
|
||||
{
|
||||
return WiFi.localIP();
|
||||
return KNX_NETIF.localIP();
|
||||
}
|
||||
|
||||
uint32_t Esp32Platform::currentSubnetMask()
|
||||
{
|
||||
return WiFi.subnetMask();
|
||||
return KNX_NETIF.subnetMask();
|
||||
}
|
||||
|
||||
uint32_t Esp32Platform::currentDefaultGateway()
|
||||
{
|
||||
return WiFi.gatewayIP();
|
||||
return KNX_NETIF.gatewayIP();
|
||||
}
|
||||
|
||||
void Esp32Platform::macAddress(uint8_t * addr)
|
||||
@ -80,7 +89,7 @@ void Esp32Platform::setupMultiCast(uint32_t addr, uint16_t port)
|
||||
IPAddress mcastaddr(htonl(addr));
|
||||
|
||||
KNX_DEBUG_SERIAL.printf("setup multicast addr: %s port: %d ip: %s\n", mcastaddr.toString().c_str(), port,
|
||||
WiFi.localIP().toString().c_str());
|
||||
KNX_NETIF.localIP().toString().c_str());
|
||||
uint8_t result = _udp.beginMulticast(mcastaddr, port);
|
||||
KNX_DEBUG_SERIAL.printf("result %d\n", result);
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include "arduino_platform.h"
|
||||
#include <WiFi.h>
|
||||
#include <WiFiUdp.h>
|
||||
|
||||
|
||||
|
||||
#include <WiFiUdp.h>
|
||||
|
||||
class Esp32Platform : public ArduinoPlatform
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user