Add error handling for memory intensive tasks (#1798)

* tflite model loading: error handling

* FlowAlignment: error handling

* CImageBasis+GetJPGStream : error handling
This commit is contained in:
Slider0007
2023-01-11 20:23:26 +01:00
committed by GitHub
parent a39092497e
commit 58816275e5
8 changed files with 465 additions and 280 deletions

View File

@@ -298,9 +298,9 @@ esp_err_t img_tmp_handler(httpd_req_t *req)
esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Start");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Start");
#endif
char filepath[50];
@@ -316,21 +316,19 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
filetosend = std::string(filename);
ESP_LOGD(TAG, "File to upload: %s", filetosend.c_str());
// Serve raw.jpg
if (filetosend == "raw.jpg")
{
return GetRawJPG(req);
}
esp_err_t zw = GetJPG(filetosend, req);
if (zw == ESP_OK)
// Serve alg.jpg, alg_roi.jpg or digital and analog ROIs
if (ESP_OK == GetJPG(filetosend, req))
return ESP_OK;
// File wird nicht intern bereit gestellt --> klassischer weg:
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("img_tmp_virtual_handler - Done");
#endif
// File was not served already --> serve with img_tmp_handler
return img_tmp_handler(req);
}