Set framework esp-idf by default

This commit is contained in:
Edward Firmo
2023-11-01 21:29:06 +01:00
parent b105d83b12
commit fce2c5e4be
2 changed files with 5 additions and 29 deletions

View File

@@ -83,7 +83,6 @@ script:
bool is_updating_ = false;
size_t transfer_buffer_size_ = 0;
bool upload_first_chunk_sent_ = false;
int content_length_ = 0;
@@ -175,6 +174,7 @@ script:
};
#ifdef ARDUINO // arduino # To do: Move to Nextion component on ESPHome
size_t transfer_buffer_size_ = 0;
uint8_t *transfer_buffer_{nullptr};
auto upload_by_chunks_arduino = [&](HTTPClient *http, const std::string &url, int range_start) -> int
{
@@ -455,8 +455,6 @@ script:
int range_end = (range_start == 0) ? std::min(tft_size_, 16383) : tft_size_;
ESP_LOGVV(TAG, "range_end: %i", range_end);
//int range = range_end - range_start;
//ESP_LOGVV(TAG, "range size: %i", range);
esp_http_client_config_t config = {
.url = url.c_str(),
@@ -645,19 +643,8 @@ script:
return upload_end_(false);
}
// Nextion wants 4096 bytes at a time. Make chunk_size a multiple of 4096
uint32_t chunk_size = 8192;
if (esp_get_free_heap_size() > 81920) { // Ensure some FreeHeap to other things and limit chunk size
chunk_size = esp_get_free_heap_size() - 65536;
chunk_size = int(chunk_size / 4096) * 4096;
chunk_size = chunk_size > ${upload_tft_chunk_size_max} ? ${upload_tft_chunk_size_max} : chunk_size;
} else if (esp_get_free_heap_size() < 32768) {
chunk_size = 4096;
}
transfer_buffer_size_ = chunk_size;
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d using %zu chunksize, Heap Size %d",
url.c_str(), content_length_, transfer_buffer_size_, esp_get_free_heap_size());
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d, Heap Size %d",
url.c_str(), content_length_, esp_get_free_heap_size());
ESP_LOGV(TAG, "Starting transfer by chunks loop");
int result = 0;
@@ -672,17 +659,6 @@ script:
ESP_LOGV(TAG, "Heap Size %d, Bytes left %d", esp_get_free_heap_size(), content_length_);
}
//int result = 0;
//while (content_length_ > 0) {
// result = upload_range_esp_idf_(http, url, result);
// if (result < 0) {
// ESP_LOGD(TAG, "Error updating Nextion!");
// esp_http_client_cleanup(http);
// return upload_end_(false);
// }
// App.feed_wdt();
// ESP_LOGD(TAG, "Heap Size %d, Bytes left %d", esp_get_free_heap_size(), content_length_);
//}
is_updating_ = false;
ESP_LOGD(TAG, "Successfully updated Nextion!");

View File

@@ -48,8 +48,8 @@ esphome:
##### TYPE OF ESP BOARD #####
esp32:
board: esp32dev
# framework:
# type: esp-idf
framework:
type: esp-idf
##### WIFI SETUP #####
wifi: