|
@@ -451,7 +451,7 @@ esp_err_t starttime_get_handler(httpd_req_t *req)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-static esp_err_t hello_main_handler_worker(httpd_req_t *req)
|
|
|
|
|
|
|
+esp_err_t hello_main_handler(httpd_req_t *req)
|
|
|
{
|
|
{
|
|
|
#ifdef DEBUG_DETAIL_ON
|
|
#ifdef DEBUG_DETAIL_ON
|
|
|
LogFile.WriteHeapInfo("hello_main_handler - Start");
|
|
LogFile.WriteHeapInfo("hello_main_handler - Start");
|
|
@@ -544,12 +544,6 @@ static esp_err_t hello_main_handler_worker(httpd_req_t *req)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-esp_err_t hello_main_handler(httpd_req_t *req)
|
|
|
|
|
-{
|
|
|
|
|
- return dispatch_http_request_async(req, hello_main_handler_worker, "static file");
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
esp_err_t img_tmp_handler(httpd_req_t *req)
|
|
esp_err_t img_tmp_handler(httpd_req_t *req)
|
|
|
{
|
|
{
|
|
|
char filepath[50];
|
|
char filepath[50];
|
|
@@ -583,7 +577,7 @@ static esp_err_t raw_jpg_capture_worker(httpd_req_t *req)
|
|
|
return GetRawJPG(req, previewCapture);
|
|
return GetRawJPG(req, previewCapture);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static esp_err_t img_tmp_virtual_handler_worker(httpd_req_t *req)
|
|
|
|
|
|
|
+esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
|
|
|
{
|
|
{
|
|
|
#ifdef DEBUG_DETAIL_ON
|
|
#ifdef DEBUG_DETAIL_ON
|
|
|
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Start");
|
|
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Start");
|
|
@@ -604,10 +598,11 @@ static esp_err_t img_tmp_virtual_handler_worker(httpd_req_t *req)
|
|
|
const std::string fileName(filename);
|
|
const std::string fileName(filename);
|
|
|
ESP_LOGD(TAG, "File to upload: %s", fileName.c_str());
|
|
ESP_LOGD(TAG, "File to upload: %s", fileName.c_str());
|
|
|
|
|
|
|
|
- // The raw camera path is dispatched separately to the serialized camera worker.
|
|
|
|
|
|
|
+ // A raw camera capture can take several seconds. Keep it off the single
|
|
|
|
|
+ // HTTP server task so status, log and static-file requests remain responsive.
|
|
|
if (fileName == "raw.jpg")
|
|
if (fileName == "raw.jpg")
|
|
|
{
|
|
{
|
|
|
- return ESP_FAIL;
|
|
|
|
|
|
|
+ return dispatch_camera_http_request_async(req, raw_jpg_capture_worker, "raw capture");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Serve alg.jpg, alg_roi.jpg or digit and analog ROIs.
|
|
// Serve alg.jpg, alg_roi.jpg or digit and analog ROIs.
|
|
@@ -622,26 +617,6 @@ static esp_err_t img_tmp_virtual_handler_worker(httpd_req_t *req)
|
|
|
return img_tmp_handler(req);
|
|
return img_tmp_handler(req);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
|
|
|
|
|
-{
|
|
|
|
|
- char filepath[50];
|
|
|
|
|
- char *base_path = (char*) req->user_ctx;
|
|
|
|
|
- const char *filename = get_path_from_uri(filepath, base_path,
|
|
|
|
|
- req->uri + sizeof("/img_tmp/") - 1, sizeof(filepath));
|
|
|
|
|
- if (filename == NULL)
|
|
|
|
|
- {
|
|
|
|
|
- httpd_resp_send_err(req, HTTPD_414_URI_TOO_LONG, "Filename too long");
|
|
|
|
|
- return ESP_FAIL;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (strcmp(filename, "raw.jpg") == 0)
|
|
|
|
|
- {
|
|
|
|
|
- return dispatch_camera_http_request_async(req, raw_jpg_capture_worker, "raw capture");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return dispatch_http_request_async(req, img_tmp_virtual_handler_worker, "image response");
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
esp_err_t sysinfo_handler(httpd_req_t *req)
|
|
esp_err_t sysinfo_handler(httpd_req_t *req)
|
|
|
{
|
|
{
|
|
|
// Take one snapshot of resource and card information for this response.
|
|
// Take one snapshot of resource and card information for this response.
|