ESPHome 2025.10.0-dev
Loading...
Searching...
No Matches
nextion_upload.cpp
Go to the documentation of this file.
1#include "nextion.h"
2
3#ifdef USE_NEXTION_TFT_UPLOAD
4
6
7namespace esphome {
8namespace nextion {
9static const char *const TAG = "nextion.upload";
10
11bool Nextion::upload_end_(bool successful) {
12 if (successful) {
13 ESP_LOGD(TAG, "Upload successful");
14 for (uint8_t i = 0; i <= 5; i++) {
15 delay(1000); // NOLINT
16 App.feed_wdt(); // Feed the watchdog timer.
17 }
19 } else {
20 ESP_LOGE(TAG, "Upload failed");
21
22 this->connection_state_.is_updating_ = false;
23 this->connection_state_.ignore_is_setup_ = false;
24
25 uint32_t baud_rate = this->parent_->get_baud_rate();
26 if (baud_rate != this->original_baud_rate_) {
27 ESP_LOGD(TAG, "Baud: %" PRIu32 "->%" PRIu32, baud_rate, this->original_baud_rate_);
29 this->parent_->load_settings();
30 }
31 }
32
33 return successful;
34}
35
36} // namespace nextion
37} // namespace esphome
38
39#endif // USE_NEXTION_TFT_UPLOAD
void feed_wdt(uint32_t time=0)
bool upload_end_(bool successful)
Ends the upload process, restart Nextion and, if successful, restarts ESP.
struct esphome::nextion::Nextion::@139 connection_state_
Status flags for Nextion display state management.
virtual void load_settings(bool dump_config)
Load the UART settings.
void set_baud_rate(uint32_t baud_rate)
UARTComponent * parent_
Definition uart.h:74
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
void IRAM_ATTR HOT delay(uint32_t ms)
Definition core.cpp:29
Application App
Global storage of Application pointer - only one Application can exist.