Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On AyncUDP branch, Callbacks don't work with knx.start(nullptr) #51

Closed
ascillato opened this issue Apr 7, 2018 · 5 comments
Closed

Comments

@ascillato
Copy link
Contributor

Hi,

On the AyncUDP branch, if I start ESP-KNX-IP with knx.start(WebServer); or with knx.start(); the library works perfectly.

But if I use the non webserver version: knx.start(nullptr);, callbacks don't work. Nevertheless, in this mode I can send telegrams without problem but I can not receive any.

What can I do?

@ascillato
Copy link
Contributor Author

I made the PR #48 and #52 for making ESP-KNX-IP work for a modification to Sonoff Tasmota to add KNX IP to its features.

What do you think of these Pull Requests?

@envy
Copy link
Owner

envy commented Apr 9, 2018

Hi,

callbacks work for me, even without a webserver.

Also, your changes don't actually change anything? You just replaced the server != nullptr with a dedicated bool and moved the website registrations to another function. The UDP part at the end of __start is called with and without your patch and that is reponsible for registering a packet handler function.

Did you check with debugging enabled that really no packet arrives?

@ascillato
Copy link
Contributor Author

Hi,

Yes, using the async-udp branch, I check with debug on (ESP_KNX_DEBUG) and there was no message on reception. Everything works for sending data, but for receiving, the __loop_knx(packet); was never called.

When I pass to the ESP-KNX-IP the object with the webserver, the __loop_knx(packet); is called again.

It seems that the ESPAsyncUDP Library requires to have the Webserver variable? I could not find why.

But just not passing the variable makes this behaviour.

I'm compiling using Arduino IDE and the lwIP v1.4. I was not using v2 because it has problems with sleep()

So, it is like you say, those changes seems to do nothing but only makes available the webserver object to the ESP-KNX-IP.

@envy
Copy link
Owner

envy commented Apr 9, 2018

I'm also using the async-udp branch with lwip 1.4 and as I said, I have no problems when passing nullptr for the webserver.

You can try adding a print into the lambda like so:

udp.onPacket([this](AsyncUDPPacket &packet) {
  DEBUG_PRINTLN("got packet");
  __loop_knx(packet);
});

to see if really no packet arrives.

@ascillato
Copy link
Contributor Author

Hi,

I found the bug! Was not a problem of ESP-KNX-IP.

When I started to add KNX to Tasmota I was using the webpage of the library. So the knx.start(webserver); was after the declaration of the Tasmota webserver.

Then, when change to use knx.start(nullptr); I moved it to an internal Tasmota function that calls all the drivers on device start. And that start is BEFORE Wifi. That's why the UPD listen was not working.

Now everything works. I ran several tests and goes smooth, So, I'm closing this issue and the PR #52.

Nico, thanks a lot for your time. It is very appreciated 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants