Add is_detected() for Nextion displays (#5825)

This commit is contained in:
Edward Firmo 2023-11-25 09:38:45 +01:00 committed by GitHub
parent c43518c391
commit ccd7f0661c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -93,7 +93,8 @@ bool Nextion::check_connect_() {
connect_info.push_back(response.substr(start, end - start)); 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()); ESP_LOGN(TAG, "Received connect_info %zu", connect_info.size());
this->device_model_ = connect_info[2]; this->device_model_ = connect_info[2];

View file

@ -48,10 +48,12 @@ class NextionBase {
bool is_sleeping() { return this->is_sleeping_; } bool is_sleeping() { return this->is_sleeping_; }
bool is_setup() { return this->is_setup_; } bool is_setup() { return this->is_setup_; }
bool is_detected() { return this->is_detected_; }
protected: protected:
bool is_setup_ = false; bool is_setup_ = false;
bool is_sleeping_ = false; bool is_sleeping_ = false;
bool is_detected_ = false;
}; };
} // namespace nextion } // namespace nextion