diff --git a/nspanel_esphome_addon_upload_tft.yaml b/nspanel_esphome_addon_upload_tft.yaml index 8e2162d..50d01e8 100644 --- a/nspanel_esphome_addon_upload_tft.yaml +++ b/nspanel_esphome_addon_upload_tft.yaml @@ -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);