mirror of
https://github.com/esphome/esphome.git
synced 2025-10-03 02:22:25 +01:00
set Nextion protocol reparse mode (#5484)
This commit is contained in:
@@ -32,6 +32,25 @@ void Nextion::sleep(bool sleep) {
|
||||
}
|
||||
// End sleep safe commands
|
||||
|
||||
// Protocol reparse mode
|
||||
void Nextion::set_protocol_reparse_mode(bool active_mode) {
|
||||
const uint8_t to_send[3] = {0xFF, 0xFF, 0xFF};
|
||||
if (active_mode) { // Sets active protocol reparse mode
|
||||
this->write_str(
|
||||
"recmod=1"); // send_command_ cannot be used as Nextion might not be setup if incorrect reparse mode
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
} else { // Sets passive protocol reparse mode
|
||||
this->write_str("DRAKJHSUYDGBNCJHGJKSHBDN"); // To exit active reparse mode this sequence must be sent
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
this->write_str("recmod=0"); // Sending recmode=0 twice is recommended
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
this->write_str("recmod=0");
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
}
|
||||
this->write_str("connect");
|
||||
this->write_array(to_send, sizeof(to_send));
|
||||
}
|
||||
|
||||
// Set Colors
|
||||
void Nextion::set_component_background_color(const char *component, uint32_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_background_color", "%s.bco=%d", component, color);
|
||||
|
Reference in New Issue
Block a user