mirror of
https://github.com/esphome/esphome.git
synced 2024-12-20 16:18:49 +01:00
[nextion] Remove _internal
from non-protected functions (#7656)
This commit is contained in:
parent
ea06740b46
commit
9816c27031
@ -119,17 +119,17 @@ async def to_code(config):
|
||||
cg.add_library("ESP8266HTTPClient", None)
|
||||
|
||||
if CONF_TOUCH_SLEEP_TIMEOUT in config:
|
||||
cg.add(var.set_touch_sleep_timeout_internal(config[CONF_TOUCH_SLEEP_TIMEOUT]))
|
||||
cg.add(var.set_touch_sleep_timeout(config[CONF_TOUCH_SLEEP_TIMEOUT]))
|
||||
|
||||
if CONF_WAKE_UP_PAGE in config:
|
||||
cg.add(var.set_wake_up_page_internal(config[CONF_WAKE_UP_PAGE]))
|
||||
cg.add(var.set_wake_up_page(config[CONF_WAKE_UP_PAGE]))
|
||||
|
||||
if CONF_START_UP_PAGE in config:
|
||||
cg.add(var.set_start_up_page_internal(config[CONF_START_UP_PAGE]))
|
||||
cg.add(var.set_start_up_page(config[CONF_START_UP_PAGE]))
|
||||
|
||||
cg.add(var.set_auto_wake_on_touch_internal(config[CONF_AUTO_WAKE_ON_TOUCH]))
|
||||
cg.add(var.set_auto_wake_on_touch(config[CONF_AUTO_WAKE_ON_TOUCH]))
|
||||
|
||||
cg.add(var.set_exit_reparse_on_start_internal(config[CONF_EXIT_REPARSE_ON_START]))
|
||||
cg.add(var.set_exit_reparse_on_start(config[CONF_EXIT_REPARSE_ON_START]))
|
||||
|
||||
cg.add(var.set_skip_connection_handshake(config[CONF_SKIP_CONNECTION_HANDSHAKE]))
|
||||
|
||||
|
@ -280,14 +280,6 @@ void Nextion::loop() {
|
||||
this->goto_page(this->start_up_page_);
|
||||
}
|
||||
|
||||
// This could probably be removed from the loop area, as those are redundant.
|
||||
this->set_auto_wake_on_touch(this->auto_wake_on_touch_);
|
||||
this->set_exit_reparse_on_start(this->exit_reparse_on_start_);
|
||||
|
||||
if (this->touch_sleep_timeout_ != 0) {
|
||||
this->set_touch_sleep_timeout(this->touch_sleep_timeout_);
|
||||
}
|
||||
|
||||
if (this->wake_up_page_ != -1) {
|
||||
this->set_wake_up_page(this->wake_up_page_);
|
||||
}
|
||||
|
@ -856,76 +856,6 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
||||
*/
|
||||
void set_backlight_brightness(float brightness);
|
||||
|
||||
/**
|
||||
* Set the touch sleep timeout of the display.
|
||||
* @param timeout Timeout in seconds.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_touch_sleep_timeout(30);
|
||||
* ```
|
||||
*
|
||||
* After 30 seconds the display will go to sleep. Note: the display will only wakeup by a restart or by setting up
|
||||
* `thup`.
|
||||
*/
|
||||
void set_touch_sleep_timeout(uint16_t timeout);
|
||||
|
||||
/**
|
||||
* Sets which page Nextion loads when exiting sleep mode. Note this can be set even when Nextion is in sleep mode.
|
||||
* @param page_id The page id, from 0 to the lage page in Nextion. Set 255 (not set to any existing page) to
|
||||
* wakes up to current page.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_wake_up_page(2);
|
||||
* ```
|
||||
*
|
||||
* The display will wake up to page 2.
|
||||
*/
|
||||
void set_wake_up_page(uint8_t page_id = 255);
|
||||
|
||||
/**
|
||||
* Sets which page Nextion loads when connecting to ESPHome.
|
||||
* @param page_id The page id, from 0 to the lage page in Nextion. Set 255 (not set to any existing page) to
|
||||
* wakes up to current page.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_start_up_page(2);
|
||||
* ```
|
||||
*
|
||||
* The display will go to page 2 when it establishes a connection to ESPHome.
|
||||
*/
|
||||
void set_start_up_page(uint8_t page_id = 255);
|
||||
|
||||
/**
|
||||
* Sets if Nextion should auto-wake from sleep when touch press occurs.
|
||||
* @param auto_wake True or false. When auto_wake is true and Nextion is in sleep mode,
|
||||
* the first touch will only trigger the auto wake mode and not trigger a Touch Event.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_auto_wake_on_touch(true);
|
||||
* ```
|
||||
*
|
||||
* The display will wake up by touch.
|
||||
*/
|
||||
void set_auto_wake_on_touch(bool auto_wake);
|
||||
|
||||
/**
|
||||
* Sets if Nextion should exit the active reparse mode before the "connect" command is sent
|
||||
* @param exit_reparse True or false. When exit_reparse is true, the exit reparse command
|
||||
* will be sent before requesting the connection from Nextion.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_exit_reparse_on_start(true);
|
||||
* ```
|
||||
*
|
||||
* The display will be requested to leave active reparse mode before setup.
|
||||
*/
|
||||
void set_exit_reparse_on_start(bool exit_reparse);
|
||||
|
||||
/**
|
||||
* Sets whether the Nextion display should skip the connection handshake process.
|
||||
* @param skip_handshake True or false. When skip_connection_handshake is true,
|
||||
@ -1172,15 +1102,75 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
||||
|
||||
void update_components_by_prefix(const std::string &prefix);
|
||||
|
||||
void set_touch_sleep_timeout_internal(uint32_t touch_sleep_timeout) {
|
||||
this->touch_sleep_timeout_ = touch_sleep_timeout;
|
||||
}
|
||||
void set_wake_up_page_internal(uint8_t wake_up_page) { this->wake_up_page_ = wake_up_page; }
|
||||
void set_start_up_page_internal(uint8_t start_up_page) { this->start_up_page_ = start_up_page; }
|
||||
void set_auto_wake_on_touch_internal(bool auto_wake_on_touch) { this->auto_wake_on_touch_ = auto_wake_on_touch; }
|
||||
void set_exit_reparse_on_start_internal(bool exit_reparse_on_start) {
|
||||
this->exit_reparse_on_start_ = exit_reparse_on_start;
|
||||
}
|
||||
/**
|
||||
* Set the touch sleep timeout of the display.
|
||||
* @param timeout Timeout in seconds.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_touch_sleep_timeout(30);
|
||||
* ```
|
||||
*
|
||||
* After 30 seconds the display will go to sleep. Note: the display will only wakeup by a restart or by setting up
|
||||
* `thup`.
|
||||
*/
|
||||
void set_touch_sleep_timeout(uint32_t touch_sleep_timeout);
|
||||
|
||||
/**
|
||||
* Sets which page Nextion loads when exiting sleep mode. Note this can be set even when Nextion is in sleep mode.
|
||||
* @param wake_up_page The page id, from 0 to the lage page in Nextion. Set 255 (not set to any existing page) to
|
||||
* wakes up to current page.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_wake_up_page(2);
|
||||
* ```
|
||||
*
|
||||
* The display will wake up to page 2.
|
||||
*/
|
||||
void set_wake_up_page(uint8_t wake_up_page = 255);
|
||||
|
||||
/**
|
||||
* Sets which page Nextion loads when connecting to ESPHome.
|
||||
* @param start_up_page The page id, from 0 to the lage page in Nextion. Set 255 (not set to any existing page) to
|
||||
* wakes up to current page.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_start_up_page(2);
|
||||
* ```
|
||||
*
|
||||
* The display will go to page 2 when it establishes a connection to ESPHome.
|
||||
*/
|
||||
void set_start_up_page(uint8_t start_up_page = 255) { this->start_up_page_ = start_up_page; }
|
||||
|
||||
/**
|
||||
* Sets if Nextion should auto-wake from sleep when touch press occurs.
|
||||
* @param auto_wake_on_touch True or false. When auto_wake is true and Nextion is in sleep mode,
|
||||
* the first touch will only trigger the auto wake mode and not trigger a Touch Event.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_auto_wake_on_touch(true);
|
||||
* ```
|
||||
*
|
||||
* The display will wake up by touch.
|
||||
*/
|
||||
void set_auto_wake_on_touch(bool auto_wake_on_touch);
|
||||
|
||||
/**
|
||||
* Sets if Nextion should exit the active reparse mode before the "connect" command is sent
|
||||
* @param exit_reparse_on_start True or false. When exit_reparse_on_start is true, the exit reparse command
|
||||
* will be sent before requesting the connection from Nextion.
|
||||
*
|
||||
* Example:
|
||||
* ```cpp
|
||||
* it.set_exit_reparse_on_start(true);
|
||||
* ```
|
||||
*
|
||||
* The display will be requested to leave active reparse mode before setup.
|
||||
*/
|
||||
void set_exit_reparse_on_start(bool exit_reparse_on_start) { this->exit_reparse_on_start_ = exit_reparse_on_start; }
|
||||
|
||||
/**
|
||||
* @brief Retrieves the number of commands pending in the Nextion command queue.
|
||||
|
@ -10,19 +10,19 @@ static const char *const TAG = "nextion";
|
||||
// Sleep safe commands
|
||||
void Nextion::soft_reset() { this->send_command_("rest"); }
|
||||
|
||||
void Nextion::set_wake_up_page(uint8_t page_id) {
|
||||
this->add_no_result_to_queue_with_set_internal_("wake_up_page", "wup", page_id, true);
|
||||
void Nextion::set_wake_up_page(uint8_t wake_up_page) {
|
||||
this->wake_up_page_ = wake_up_page;
|
||||
this->add_no_result_to_queue_with_set_internal_("wake_up_page", "wup", wake_up_page, true);
|
||||
}
|
||||
|
||||
void Nextion::set_start_up_page(uint8_t page_id) { this->start_up_page_ = page_id; }
|
||||
|
||||
void Nextion::set_touch_sleep_timeout(uint16_t timeout) {
|
||||
if (timeout < 3) {
|
||||
void Nextion::set_touch_sleep_timeout(uint32_t touch_sleep_timeout) {
|
||||
if (touch_sleep_timeout < 3) {
|
||||
ESP_LOGD(TAG, "Sleep timeout out of bounds, range 3-65535");
|
||||
return;
|
||||
}
|
||||
|
||||
this->add_no_result_to_queue_with_set_internal_("touch_sleep_timeout", "thsp", timeout, true);
|
||||
this->touch_sleep_timeout_ = touch_sleep_timeout;
|
||||
this->add_no_result_to_queue_with_set_internal_("touch_sleep_timeout", "thsp", touch_sleep_timeout, true);
|
||||
}
|
||||
|
||||
void Nextion::sleep(bool sleep) {
|
||||
@ -54,7 +54,6 @@ bool Nextion::set_protocol_reparse_mode(bool active_mode) {
|
||||
this->ignore_is_setup_ = false;
|
||||
return all_commands_sent;
|
||||
}
|
||||
void Nextion::set_exit_reparse_on_start(bool exit_reparse) { this->exit_reparse_on_start_ = exit_reparse; }
|
||||
|
||||
// Set Colors - Background
|
||||
void Nextion::set_component_background_color(const char *component, uint16_t color) {
|
||||
@ -191,8 +190,9 @@ void Nextion::set_backlight_brightness(float brightness) {
|
||||
this->add_no_result_to_queue_with_printf_("backlight_brightness", "dim=%d", static_cast<int>(brightness * 100));
|
||||
}
|
||||
|
||||
void Nextion::set_auto_wake_on_touch(bool auto_wake) {
|
||||
this->add_no_result_to_queue_with_set("auto_wake_on_touch", "thup", auto_wake ? 1 : 0);
|
||||
void Nextion::set_auto_wake_on_touch(bool auto_wake_on_touch) {
|
||||
this->auto_wake_on_touch_ = auto_wake_on_touch;
|
||||
this->add_no_result_to_queue_with_set("auto_wake_on_touch", "thup", auto_wake_on_touch ? 1 : 0);
|
||||
}
|
||||
|
||||
// General Component
|
||||
|
Loading…
Reference in New Issue
Block a user