espressif/esp-who

Cannot use mdns from examples (AIV-584)

remipch opened this issue · 0 comments

First of all, thank you for this great ESP frameworks (esp-idf, esp-who, etc).
I've just spent a few days playing with them and it's very cool to have all these features running on small ESP32 boards !

I open this issue because I haven't been able to use mdns from the esp-who examples.

How to reproduce the problem

Extra tools I use for my test:
sudo apt install avahi-discover minicom

What did I do :

  • clone esp-idf(release/v4.4 branch) and install as explained in the doc
  • clone esp-who
  • cd exp-who/examples/motion_detection/web
  • idf.py set-target esp32
  • idf.py menuconfig and manually setup wifi and camera in esp-who section
  • idf.py build
  • idf.py -p /dev/ttyUSB0 flash
  • minicom -D /dev/ttyUSB0 -b 115200

Now I want to use mdns :

  • avahi-discover
  • Problem : it does not see my esp32 device

Problem cause and fix

After investigation, the problem seems to be related to component initialization order in examples :

  • app_main calls app_mdns_main before register_camera
  • but app_mdns_main try to fetch the camera properties to initialize itself correctly
  • so it fails because camera is not yet initialized
  • and it skip everything silently

I'm opening a PR to :

  • add a log to show the problem happening
  • suggest a small fix