mirror of
https://github.com/esphome/esphome.git
synced 2025-01-31 02:00:55 +00:00
[nextion] Publishes is_connected()
(#7961)
This commit is contained in:
parent
5877c57a35
commit
df4224e779
@ -40,7 +40,7 @@ bool Nextion::send_command_(const std::string &command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Nextion::check_connect_() {
|
bool Nextion::check_connect_() {
|
||||||
if (this->get_is_connected_())
|
if (this->is_connected_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Check if the handshake should be skipped for the Nextion connection
|
// Check if the handshake should be skipped for the Nextion connection
|
||||||
|
@ -1217,6 +1217,25 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||||||
*/
|
*/
|
||||||
bool is_updating() override;
|
bool is_updating() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if the Nextion display is successfully connected.
|
||||||
|
*
|
||||||
|
* This method returns whether a successful connection has been established with
|
||||||
|
* the Nextion display. A connection is considered established when:
|
||||||
|
*
|
||||||
|
* - The initial handshake with the display is completed successfully, or
|
||||||
|
* - The handshake is skipped via skip_connection_handshake_ flag
|
||||||
|
*
|
||||||
|
* The connection status is particularly useful when:
|
||||||
|
* - Troubleshooting communication issues
|
||||||
|
* - Ensuring the display is ready before sending commands
|
||||||
|
* - Implementing connection-dependent behaviors
|
||||||
|
*
|
||||||
|
* @return true if the Nextion display is connected and ready to receive commands
|
||||||
|
* @return false if the display is not yet connected or connection was lost
|
||||||
|
*/
|
||||||
|
bool is_connected() { return this->is_connected_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::deque<NextionQueue *> nextion_queue_;
|
std::deque<NextionQueue *> nextion_queue_;
|
||||||
std::deque<NextionQueue *> waveform_queue_;
|
std::deque<NextionQueue *> waveform_queue_;
|
||||||
@ -1315,8 +1334,6 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||||||
|
|
||||||
#endif // USE_NEXTION_TFT_UPLOAD
|
#endif // USE_NEXTION_TFT_UPLOAD
|
||||||
|
|
||||||
bool get_is_connected_() { return this->is_connected_; }
|
|
||||||
|
|
||||||
bool check_connect_();
|
bool check_connect_();
|
||||||
|
|
||||||
std::vector<NextionComponentBase *> touch_;
|
std::vector<NextionComponentBase *> touch_;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
esphome:
|
esphome:
|
||||||
on_boot:
|
on_boot:
|
||||||
|
- lambda: 'ESP_LOGD("display","is_connected(): %s", YESNO(id(main_lcd).is_connected()));'
|
||||||
|
|
||||||
# Binary sensor publish action tests
|
# Binary sensor publish action tests
|
||||||
- binary_sensor.nextion.publish:
|
- binary_sensor.nextion.publish:
|
||||||
id: r0_sensor
|
id: r0_sensor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user