mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-02-01 15:20:58 +03:00
Restructure Image Processing
This commit is contained in:
@@ -44,10 +44,15 @@ void Init_NVS_SDCard()
|
||||
// sdmmc_host_t host = SDMMC_HOST_SLOT_1();
|
||||
// host.flags = SDMMC_HOST_FLAG_1BIT;
|
||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
||||
slot_config.width = 1; // 1 line SD mode
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = { };
|
||||
mount_config.format_if_mount_failed = false;
|
||||
mount_config.max_files = 5;
|
||||
|
||||
gpio_set_pull_mode((gpio_num_t) 15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
|
||||
gpio_set_pull_mode((gpio_num_t) 2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
|
||||
|
||||
sdmmc_card_t* card;
|
||||
ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card);
|
||||
if (ret != ESP_OK) {
|
||||
|
||||
@@ -239,30 +239,12 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
|
||||
return GetRawJPG(req);
|
||||
}
|
||||
|
||||
ImageData *zw = GetJPG(filetosend);
|
||||
esp_err_t zw = GetJPG(filetosend, req);
|
||||
|
||||
if (zw)
|
||||
{
|
||||
ESP_LOGI(TAG, "Sending file : %s (%d bytes)...", filetosend.c_str(), zw->size);
|
||||
set_content_type_from_file(req, filetosend.c_str());
|
||||
|
||||
if (httpd_resp_send_chunk(req, (char*) &(zw->data), zw->size) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "File sending failed!");
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to send file");
|
||||
delete zw;
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ESP_LOGI(TAG, "File sending complete");
|
||||
/* Respond with an empty chunk to signal HTTP response completion */
|
||||
httpd_resp_send_chunk(req, NULL, 0);
|
||||
|
||||
delete zw;
|
||||
if (zw == ESP_OK)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// File wird nicht intern bereit gestellt --> klassischer weg:
|
||||
|
||||
return img_tmp_handler(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const char* GIT_REV="f5c2810";
|
||||
const char* GIT_REV="b418525";
|
||||
const char* GIT_TAG="";
|
||||
const char* GIT_BRANCH="rolling";
|
||||
const char* BUILD_TIME="2020-12-21 22:49";
|
||||
const char* GIT_BRANCH="rolling-reduce-sd-use";
|
||||
const char* BUILD_TIME="2020-12-23 07:56";
|
||||
Reference in New Issue
Block a user