From 9f0c1a2c83a6f10f21137d75e8d28832848364da Mon Sep 17 00:00:00 2001 From: scgan Date: Thu, 2 Mar 2023 19:35:31 +0800 Subject: [PATCH] fix order: add_mdns_main reply on camera init --- components/modules/web/app_mdns.c | 1 + examples/cat_face_detection/web/main/app_main.cpp | 4 ++-- examples/human_face_detection/web/main/app_main.cpp | 2 +- examples/motion_detection/web/main/app_main.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/modules/web/app_mdns.c b/components/modules/web/app_mdns.c index bb3558f..b6d1785 100644 --- a/components/modules/web/app_mdns.c +++ b/components/modules/web/app_mdns.c @@ -180,6 +180,7 @@ void app_mdns_main() } xSemaphoreGive(query_lock); + // must be called after camera initialization sensor_t * s = esp_camera_sensor_get(); if(s == NULL){ ESP_LOGE(TAG, "esp_camera_sensor_get() Failed"); diff --git a/examples/cat_face_detection/web/main/app_main.cpp b/examples/cat_face_detection/web/main/app_main.cpp index 41c3a28..281b4b0 100755 --- a/examples/cat_face_detection/web/main/app_main.cpp +++ b/examples/cat_face_detection/web/main/app_main.cpp @@ -10,12 +10,12 @@ static QueueHandle_t xQueueHttpFrame = NULL; extern "C" void app_main() { app_wifi_main(); - app_mdns_main(); xQueueAIFrame = xQueueCreate(2, sizeof(camera_fb_t *)); xQueueHttpFrame = xQueueCreate(2, sizeof(camera_fb_t *)); register_camera(PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, xQueueAIFrame); + app_mdns_main(); register_cat_face_detection(xQueueAIFrame, NULL, NULL, xQueueHttpFrame); register_httpd(xQueueHttpFrame, NULL, true); -} +} \ No newline at end of file diff --git a/examples/human_face_detection/web/main/app_main.cpp b/examples/human_face_detection/web/main/app_main.cpp index e208a83..97c7795 100755 --- a/examples/human_face_detection/web/main/app_main.cpp +++ b/examples/human_face_detection/web/main/app_main.cpp @@ -10,12 +10,12 @@ static QueueHandle_t xQueueHttpFrame = NULL; extern "C" void app_main() { app_wifi_main(); - app_mdns_main(); xQueueAIFrame = xQueueCreate(2, sizeof(camera_fb_t *)); xQueueHttpFrame = xQueueCreate(2, sizeof(camera_fb_t *)); register_camera(PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, xQueueAIFrame); + app_mdns_main(); register_human_face_detection(xQueueAIFrame, NULL, NULL, xQueueHttpFrame); register_httpd(xQueueHttpFrame, NULL, true); } diff --git a/examples/motion_detection/web/main/app_main.cpp b/examples/motion_detection/web/main/app_main.cpp index 42769ca..45135de 100755 --- a/examples/motion_detection/web/main/app_main.cpp +++ b/examples/motion_detection/web/main/app_main.cpp @@ -10,12 +10,12 @@ static QueueHandle_t xQueueHttpFrame = NULL; extern "C" void app_main() { app_wifi_main(); - app_mdns_main(); xQueueAIFrame = xQueueCreate(2, sizeof(camera_fb_t *)); xQueueHttpFrame = xQueueCreate(2, sizeof(camera_fb_t *)); register_camera(PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, xQueueAIFrame); + app_mdns_main(); register_motion_detection(xQueueAIFrame, NULL, NULL, xQueueHttpFrame); register_httpd(xQueueHttpFrame, NULL, true); }