Update esp-knx-ip.cpp

This commit is contained in:
Adrian Scillato 2018-04-07 21:27:50 -03:00 committed by GitHub
parent 059d02147c
commit e71c7e7689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 42 deletions

View File

@ -27,22 +27,22 @@ void ESPKNXIP::load()
restore_from_eeprom();
}
void ESPKNXIP::start(ESP8266WebServer *srv)
void ESPKNXIP::start(ESP8266WebServer *srv, bool espknxip_webpage)
{
server = srv;
if (espknxip_webpage) { __start_espknxip_webpage(); }
__start();
}
void ESPKNXIP::start()
{
server = new ESP8266WebServer(80);
__start_espknxip_webpage();
__start();
}
void ESPKNXIP::__start()
void ESPKNXIP::__start_espknxip_webpage()
{
if (server != nullptr)
{
server->on(ROOT_PREFIX, [this](){
__handle_root();
});
@ -80,8 +80,10 @@ void ESPKNXIP::__start()
});
#endif
server->begin();
}
}
void ESPKNXIP::__start()
{
udp.listenMulticast(MULTICAST_IP, MULTICAST_PORT);
udp.onPacket([this](AsyncUDPPacket &packet) { __loop_knx(packet); });
}