Fix reference to tft_size_

Solves https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/1213#issuecomment-1791035711
This commit is contained in:
Edward Firmo
2023-11-02 17:55:42 +01:00
parent e96329f976
commit 58132cb189

View File

@@ -21,7 +21,7 @@ external_components:
- source: github://pr#3256 # adds esp-idf support to http_request
components:
- http_request
- source: github://pr#5484 # adds exit reparse to Nextion library
- source: github://pr#5484 #5660 # adds exit reparse to Nextion library
components:
- nextion
@@ -69,7 +69,20 @@ api:
state: false
- lambda: 'id(upload_tft).execute(url.c_str());'
#display:
# - id: !extend disp1
# tft_url: ${nextion_update_url}
script:
- id: upload_tft_new
mode: single
parameters:
url: string
then:
- lambda: |-
static const char *const TAG = "script.upload_tft";
ESP_LOGD(TAG, "Starting...");
- id: upload_tft
mode: single
parameters:
@@ -443,10 +456,10 @@ script:
auto upload_range_esp_idf_ = [&](const std::string &url, int range_start) -> int {
static const char *const TAG = "script.upload_tft.upload_range_esp_idf_";
ESP_LOGVV(TAG, "url: %s", url.c_str());
uint range_size_ = this->tft_size_ - range_start;
ESP_LOGVV(TAG, "tft_size_: %i", this->tft_size_);
uint range_size_ = tft_size_ - range_start;
ESP_LOGVV(TAG, "tft_size_: %i", tft_size_);
ESP_LOGV(TAG, "Available heap: %u", esp_get_free_heap_size());
int range_end = (range_start == 0) ? std::min(this->tft_size_, 16383) : this->tft_size_;
int range_end = (range_start == 0) ? std::min(tft_size_, 16383) : tft_size_;
if (range_size_ <= 0 or range_end <= range_start) {
ESP_LOGE(TAG, "Invalid range");
ESP_LOGD(TAG, "Range start: %i", range_start);