Skip to content

Commit

Permalink
Add is_detected() for Nextion displays (esphome#5825)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardtfn authored Nov 25, 2023
1 parent c43518c commit ccd7f06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion esphome/components/nextion/nextion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ bool Nextion::check_connect_() {
connect_info.push_back(response.substr(start, end - start));
}

if (connect_info.size() == 7) {
this->is_detected_ = (connect_info.size() == 7);
if (this->is_detected_) {
ESP_LOGN(TAG, "Received connect_info %zu", connect_info.size());

this->device_model_ = connect_info[2];
Expand Down
2 changes: 2 additions & 0 deletions esphome/components/nextion/nextion_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ class NextionBase {

bool is_sleeping() { return this->is_sleeping_; }
bool is_setup() { return this->is_setup_; }
bool is_detected() { return this->is_detected_; }

protected:
bool is_setup_ = false;
bool is_sleeping_ = false;
bool is_detected_ = false;
};

} // namespace nextion
Expand Down

0 comments on commit ccd7f06

Please sign in to comment.