|
@@ -806,7 +806,7 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
*/
|
|
*/
|
|
|
}
|
|
}
|
|
|
else if (status.find("Take Image") != -1) {
|
|
else if (status.find("Take Image") != -1) {
|
|
|
- if (flowalignment && flowalignment->AlgROI) {
|
|
|
|
|
|
|
+ if (flowalignment != NULL) {
|
|
|
std::string filename = "/sdcard/html/Flowstate_take_image.jpg";
|
|
std::string filename = "/sdcard/html/Flowstate_take_image.jpg";
|
|
|
result = send_file(req, filename);
|
|
result = send_file(req, filename);
|
|
|
/*
|
|
/*
|
|
@@ -847,21 +847,19 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- if (flowalignment && flowalignment->AlgROI &&
|
|
|
|
|
- flowalignment->AlgROI->size > 0 && flowalignment->AlgROI->size <= MAX_JPG_SIZE) {
|
|
|
|
|
- httpd_resp_set_type(req, "image/jpeg");
|
|
|
|
|
- result = httpd_resp_send(req, (const char *)flowalignment->AlgROI->data, flowalignment->AlgROI->size);
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ClassFlowControll::GetJPGStream: alg_roi.jpg is unavailable -> alg.jpg is going to be served!");
|
|
|
|
|
- if (flowalignment && flowalignment->ImageBasis && flowalignment->ImageBasis->ImageOkay()) {
|
|
|
|
|
- _send = flowalignment->ImageBasis;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- httpd_resp_send(req, NULL, 0);
|
|
|
|
|
- return ESP_OK;
|
|
|
|
|
|
|
+ if (flowalignment != NULL) {
|
|
|
|
|
+ result = flowalignment->SendAlgROIToHTTP(req);
|
|
|
|
|
+ if (result != ESP_ERR_NOT_FOUND && result != ESP_ERR_TIMEOUT) {
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // A missing preview must not fall back to ImageBasis: that would
|
|
|
|
|
+ // make the single HTTP server task wait on the global image lock.
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_WARN, TAG, "ClassFlowControll::GetJPGStream: ROI preview is not ready");
|
|
|
|
|
+ httpd_resp_set_status(req, "503 Service Unavailable");
|
|
|
|
|
+ httpd_resp_set_type(req, "text/plain");
|
|
|
|
|
+ return httpd_resp_send(req, "ROI preview not ready", HTTPD_RESP_USE_STRLEN);
|
|
|
}
|
|
}
|
|
|
#else
|
|
#else
|
|
|
if (!flowalignment) {
|
|
if (!flowalignment) {
|