Direct TFT Transfer from GitHub for Arduino Users

This commit is contained in:
Edward Firmo
2024-02-07 23:57:55 +01:00
parent b02be58888
commit 0b8ac56521
6 changed files with 22 additions and 109 deletions

View File

@@ -23,7 +23,7 @@ external_components:
- source:
type: git
url: https://github.com/edwardtfn/esphome
ref: nextion-21
ref: nextion-23
components:
- nextion
refresh: 300s
@@ -74,18 +74,6 @@ display:
tft_url: ${nextion_update_url}
exit_reparse_on_start: true
esphome:
on_boot:
- priority: 601.0
then:
- lambda: |-
// Hide TFT file selectors when using arduino
#ifdef ARDUINO
tft_file_model->set_internal(true);
#elif defined(ESP_PLATFORM)
tft_file_model->set_internal(false);
#endif
globals:
- id: baud_rate_original
type: uint
@@ -286,27 +274,6 @@ script:
// Upload URL
ESP_LOGD(TAG, " Upload URL: %s", url.c_str());
#ifdef ARDUINO
auto startsWith = [](const std::string& str, const std::string& prefix) -> bool {
if (str.length() < prefix.length()) return false;
std::string lowerStr = str.substr(0, prefix.length());
std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(),
[](unsigned char c){ return std::tolower(c); });
std::string lowerPrefix = prefix;
std::transform(lowerPrefix.begin(), lowerPrefix.end(), lowerPrefix.begin(),
[](unsigned char c){ return std::tolower(c); });
return lowerStr == lowerPrefix;
};
if (startsWith(url, "https")) {
ESP_LOGE(TAG, "HTTPS is not supported by Arduino framework.");
ESP_LOGE(TAG, "This transfer will most likely fail.");
ESP_LOGE(TAG, "Please use HTTP instead.");
}
#endif
disp1->set_tft_url(url.c_str());
- lambda: if (id(tft_is_valid)) disp1->goto_page("home");
@@ -499,7 +466,7 @@ select:
initial_option: "Use nextion_update_url"
optimistic: true
restore_value: true
internal: true
internal: false
entity_category: config
disabled_by_default: false
icon: mdi:file-sync