mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Nextion - Review types (#6565)
This commit is contained in:
		| @@ -50,6 +50,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will set the `txt` property of the component `textview` to `Hello World`. | ||||
|    */ | ||||
|   void set_component_text(const char *component, const char *text); | ||||
|  | ||||
|   /** | ||||
|    * Set the text of a component to a formatted string | ||||
|    * @param component The component name. | ||||
| @@ -66,6 +67,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * For example when `uptime_sensor` = 506, then, `The uptime is: 506` will be displayed. | ||||
|    */ | ||||
|   void set_component_text_printf(const char *component, const char *format, ...) __attribute__((format(printf, 3, 4))); | ||||
|  | ||||
|   /** | ||||
|    * Set the integer value of a component | ||||
|    * @param component The component name. | ||||
| @@ -78,7 +80,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * | ||||
|    * This will change the property `value` of the component `gauge` to 50. | ||||
|    */ | ||||
|   void set_component_value(const char *component, int value); | ||||
|   void set_component_value(const char *component, int32_t value); | ||||
|  | ||||
|   /** | ||||
|    * Set the picture of an image component. | ||||
|    * @param component The component name. | ||||
| @@ -92,6 +95,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the image of the component `pic` to the image with ID `4`. | ||||
|    */ | ||||
|   void set_component_picture(const char *component, uint8_t picture_id); | ||||
|  | ||||
|   /** | ||||
|    * Set the background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -107,6 +111,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_background_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -121,6 +126,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_background_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -135,6 +141,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the background color of the component `button` to blue. | ||||
|    */ | ||||
|   void set_component_background_color(const char *component, Color color) override; | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -151,6 +158,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_pressed_background_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -166,6 +174,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_pressed_background_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed background color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -181,6 +190,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * is shown when the component is pressed. | ||||
|    */ | ||||
|   void set_component_pressed_background_color(const char *component, Color color) override; | ||||
|  | ||||
|   /** | ||||
|    * Set the foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -196,6 +206,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_foreground_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -210,6 +221,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_foreground_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -223,6 +235,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the foreground color of the component `button` to black. | ||||
|    */ | ||||
|   void set_component_foreground_color(const char *component, Color color) override; | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -239,6 +252,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_pressed_foreground_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -254,6 +268,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_pressed_foreground_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed foreground color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -283,6 +298,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the picture id of the component `textview`. | ||||
|    */ | ||||
|   void set_component_pic(const char *component, uint8_t pic_id); | ||||
|  | ||||
|   /** | ||||
|    * Set the background picture id of component. | ||||
|    * @param component The component name. | ||||
| @@ -312,6 +328,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_font_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the font color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -326,6 +343,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_font_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the font color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -339,6 +357,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the font color of the component `textview` to black. | ||||
|    */ | ||||
|   void set_component_font_color(const char *component, Color color) override; | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed font color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -354,6 +373,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void set_component_pressed_font_color(const char *component, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed font color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -368,6 +388,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void set_component_pressed_font_color(const char *component, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Set the pressed font color of a component. | ||||
|    * @param component The component name. | ||||
| @@ -381,6 +402,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * This will change the pressed font color of the component `button` to black. | ||||
|    */ | ||||
|   void set_component_pressed_font_color(const char *component, Color color) override; | ||||
|  | ||||
|   /** | ||||
|    * Set the coordinates of a component on screen. | ||||
|    * @param component The component name. | ||||
| @@ -394,7 +416,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * | ||||
|    * This will move the position of the component `pic` to the x coordinate `55` and y coordinate `100`. | ||||
|    */ | ||||
|   void set_component_coordinates(const char *component, int x, int y); | ||||
|   void set_component_coordinates(const char *component, uint16_t x, uint16_t y); | ||||
|  | ||||
|   /** | ||||
|    * Set the font id for a component. | ||||
|    * @param component The component name. | ||||
| @@ -408,6 +431,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Changes the font of the component named `textveiw`. Font IDs are set in the Nextion Editor. | ||||
|    */ | ||||
|   void set_component_font(const char *component, uint8_t font_id) override; | ||||
|  | ||||
|   /** | ||||
|    * Send the current time to the nextion display. | ||||
|    * @param time The time instance to send (get this with id(my_time).now() ). | ||||
| @@ -426,6 +450,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Switches to the page named `main`. Pages are named in the Nextion Editor. | ||||
|    */ | ||||
|   void goto_page(const char *page); | ||||
|  | ||||
|   /** | ||||
|    * Show the page with a given id. | ||||
|    * @param page The id of the page. | ||||
| @@ -438,6 +463,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Switches to the page named `main`. Pages are named in the Nextion Editor. | ||||
|    */ | ||||
|   void goto_page(uint8_t page); | ||||
|  | ||||
|   /** | ||||
|    * Hide a component. | ||||
|    * @param component The component name. | ||||
| @@ -450,6 +476,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Hides the component named `button`. | ||||
|    */ | ||||
|   void hide_component(const char *component) override; | ||||
|  | ||||
|   /** | ||||
|    * Show a component. | ||||
|    * @param component The component name. | ||||
| @@ -462,6 +489,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Shows the component named `button`. | ||||
|    */ | ||||
|   void show_component(const char *component) override; | ||||
|  | ||||
|   /** | ||||
|    * Enable touch for a component. | ||||
|    * @param component The component name. | ||||
| @@ -474,6 +502,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Enables touch for component named `button`. | ||||
|    */ | ||||
|   void enable_component_touch(const char *component); | ||||
|  | ||||
|   /** | ||||
|    * Disable touch for a component. | ||||
|    * @param component The component name. | ||||
| @@ -486,14 +515,17 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Disables touch for component named `button`. | ||||
|    */ | ||||
|   void disable_component_touch(const char *component); | ||||
|  | ||||
|   /** | ||||
|    * Add waveform data to a waveform component | ||||
|    * @param component_id The integer component id. | ||||
|    * @param channel_number The channel number to write to. | ||||
|    * @param value The value to write. | ||||
|    */ | ||||
|   void add_waveform_data(int component_id, uint8_t channel_number, uint8_t value); | ||||
|   void open_waveform_channel(int component_id, uint8_t channel_number, uint8_t value); | ||||
|   void add_waveform_data(uint8_t component_id, uint8_t channel_number, uint8_t value); | ||||
|  | ||||
|   void open_waveform_channel(uint8_t component_id, uint8_t channel_number, uint8_t value); | ||||
|  | ||||
|   /** | ||||
|    * Display a picture at coordinates. | ||||
|    * @param picture_id The picture id. | ||||
| @@ -507,7 +539,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * | ||||
|    * Displays the picture who has the id `2` at the x coordinates `15` and y coordinates `25`. | ||||
|    */ | ||||
|   void display_picture(int picture_id, int x_start, int y_start); | ||||
|   void display_picture(uint16_t picture_id, uint16_t x_start, uint16_t y_start); | ||||
|  | ||||
|   /** | ||||
|    * Fill a rectangle with a color. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -526,7 +559,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use this [color picker](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to convert color codes to | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void fill_area(int x1, int y1, int width, int height, uint16_t color); | ||||
|   void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Fill a rectangle with a color. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -544,7 +578,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * the red color. | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void fill_area(int x1, int y1, int width, int height, const char *color); | ||||
|   void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Fill a rectangle with a color. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -562,7 +597,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Fills an area that starts at x coordinate `50` and y coordinate `50` with a height of `100` and width of `100` with | ||||
|    * blue color. | ||||
|    */ | ||||
|   void fill_area(int x1, int y1, int width, int height, Color color); | ||||
|   void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a line on the screen. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -581,7 +617,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use this [color picker](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to convert color codes to | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void line(int x1, int y1, int x2, int y2, uint16_t color); | ||||
|   void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a line on the screen. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -599,7 +636,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * `75` with the blue color. | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void line(int x1, int y1, int x2, int y2, const char *color); | ||||
|   void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a line on the screen. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -617,7 +655,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Makes a line that starts at x coordinate `50` and y coordinate `50` and ends at x coordinate `75` and y coordinate | ||||
|    * `75` with blue color. | ||||
|    */ | ||||
|   void line(int x1, int y1, int x2, int y2, Color color); | ||||
|   void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, Color color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a rectangle outline. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -636,7 +675,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use this [color picker](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to convert color codes to | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void rectangle(int x1, int y1, int width, int height, uint16_t color); | ||||
|   void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a rectangle outline. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -654,7 +694,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * length of `50` with the blue color. | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void rectangle(int x1, int y1, int width, int height, const char *color); | ||||
|   void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a rectangle outline. | ||||
|    * @param x1 The starting x coordinate. | ||||
| @@ -672,7 +713,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Makes a outline of a rectangle that starts at x coordinate `25` and y coordinate `35` and has a width of `40` and a | ||||
|    * length of `50` with blue color. | ||||
|    */ | ||||
|   void rectangle(int x1, int y1, int width, int height, Color color); | ||||
|   void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a circle outline | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -682,7 +724,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use this [color picker](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to convert color codes to | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void circle(int center_x, int center_y, int radius, uint16_t color); | ||||
|   void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a circle outline | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -691,7 +734,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * @param color The color to draw with (as a string). | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void circle(int center_x, int center_y, int radius, const char *color); | ||||
|   void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a circle outline | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -699,7 +743,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * @param radius The circle radius. | ||||
|    * @param color The color to draw with (as Color). | ||||
|    */ | ||||
|   void circle(int center_x, int center_y, int radius, Color color); | ||||
|   void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a filled circled. | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -716,7 +761,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Use this [color picker](https://nodtem66.github.io/nextion-hmi-color-convert/index.html) to convert color codes to | ||||
|    * Nextion HMI colors. | ||||
|    */ | ||||
|   void filled_circle(int center_x, int center_y, int radius, uint16_t color); | ||||
|   void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a filled circled. | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -732,7 +778,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Makes a filled circle at the x coordinate `25` and y coordinate `25` with a radius of `10` with the blue color. | ||||
|    * Use [Nextion Instruction Set](https://nextion.tech/instruction-set/#s5) for a list of Nextion HMI colors constants. | ||||
|    */ | ||||
|   void filled_circle(int center_x, int center_y, int radius, const char *color); | ||||
|   void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color); | ||||
|  | ||||
|   /** | ||||
|    * Draw a filled circled. | ||||
|    * @param center_x The center x coordinate. | ||||
| @@ -748,7 +795,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * | ||||
|    * Makes a filled circle at the x coordinate `25` and y coordinate `25` with a radius of `10` with blue color. | ||||
|    */ | ||||
|   void filled_circle(int center_x, int center_y, int radius, Color color); | ||||
|   void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color); | ||||
|  | ||||
|   /** | ||||
|    * Draws a QR code in the screen | ||||
| @@ -768,8 +815,9 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * | ||||
|    * Draws a QR code with a Wi-Fi network credentials starting at the given coordinates (25,25). | ||||
|    */ | ||||
|   void qrcode(int x1, int y1, const char *content, int size = 200, uint16_t background_color = 65535, | ||||
|               uint16_t foreground_color = 0, int logo_pic = -1, uint8_t border_width = 8); | ||||
|   void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size = 200, uint16_t background_color = 65535, | ||||
|               uint16_t foreground_color = 0, uint8_t logo_pic = -1, uint8_t border_width = 8); | ||||
|  | ||||
|   /** | ||||
|    * Draws a QR code in the screen | ||||
|    * @param x1 The top left x coordinate to start the QR code. | ||||
| @@ -791,8 +839,9 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Draws a QR code with a Wi-Fi network credentials starting at the given coordinates (25,25) with size of 150px in | ||||
|    * red on a blue background. | ||||
|    */ | ||||
|   void qrcode(int x1, int y1, const char *content, int size, Color background_color = Color(255, 255, 255), | ||||
|               Color foreground_color = Color(0, 0, 0), int logo_pic = -1, uint8_t border_width = 8); | ||||
|   void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size, | ||||
|               Color background_color = Color(255, 255, 255), Color foreground_color = Color(0, 0, 0), | ||||
|               uint8_t logo_pic = -1, uint8_t border_width = 8); | ||||
|  | ||||
|   /** Set the brightness of the backlight. | ||||
|    * | ||||
| @@ -806,6 +855,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Changes the brightness of the display to 30%. | ||||
|    */ | ||||
|   void set_backlight_brightness(float brightness); | ||||
|  | ||||
|   /** | ||||
|    * Set the touch sleep timeout of the display. | ||||
|    * @param timeout Timeout in seconds. | ||||
| @@ -819,6 +869,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * `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 | ||||
| @@ -832,6 +883,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * 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 | ||||
| @@ -859,6 +911,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * 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 | ||||
| @@ -872,11 +925,13 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * The display will be requested to leave active reparse mode before setup. | ||||
|    */ | ||||
|   void set_exit_reparse_on_start(bool exit_reparse); | ||||
|  | ||||
|   /** | ||||
|    * Sets Nextion mode between sleep and awake | ||||
|    * @param True or false. Sleep=true to enter sleep mode or sleep=false to exit sleep mode. | ||||
|    */ | ||||
|   void sleep(bool sleep); | ||||
|  | ||||
|   /** | ||||
|    * @brief Sets the Nextion display's protocol reparse mode. | ||||
|    * | ||||
| @@ -928,7 +983,6 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|    * Set the tft file URL. https seems problematic with arduino.. | ||||
|    */ | ||||
|   void set_tft_url(const std::string &tft_url) { this->tft_url_ = tft_url; } | ||||
|  | ||||
| #endif | ||||
|  | ||||
|   /** | ||||
| @@ -992,9 +1046,9 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|   void set_nextion_sensor_state(NextionQueueType queue_type, const std::string &name, float state); | ||||
|   void set_nextion_text_state(const std::string &name, const std::string &state); | ||||
|  | ||||
|   void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value) override; | ||||
|   void add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value) override; | ||||
|   void add_no_result_to_queue_with_set(const std::string &variable_name, const std::string &variable_name_to_send, | ||||
|                                        int state_value) override; | ||||
|                                        int32_t state_value) override; | ||||
|  | ||||
|   void add_no_result_to_queue_with_set(NextionComponentBase *component, const std::string &state_value) override; | ||||
|   void add_no_result_to_queue_with_set(const std::string &variable_name, const std::string &variable_name_to_send, | ||||
| @@ -1070,8 +1124,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|   void process_serial_(); | ||||
|   bool is_updating_ = false; | ||||
|   uint32_t touch_sleep_timeout_ = 0; | ||||
|   int wake_up_page_ = -1; | ||||
|   int start_up_page_ = -1; | ||||
|   int16_t wake_up_page_ = -1; | ||||
|   int16_t start_up_page_ = -1; | ||||
|   bool auto_wake_on_touch_ = true; | ||||
|   bool exit_reparse_on_start_ = false; | ||||
|  | ||||
| @@ -1089,7 +1143,7 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|       __attribute__((format(printf, 3, 4))); | ||||
|  | ||||
|   void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, | ||||
|                                                  const std::string &variable_name_to_send, int state_value, | ||||
|                                                  const std::string &variable_name_to_send, int32_t state_value, | ||||
|                                                  bool is_sleep_safe = false); | ||||
|  | ||||
|   void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, | ||||
| @@ -1099,13 +1153,21 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|   void check_pending_waveform_(); | ||||
|  | ||||
| #ifdef USE_NEXTION_TFT_UPLOAD | ||||
|   uint32_t content_length_ = 0; | ||||
|   int tft_size_ = 0; | ||||
|   uint32_t original_baud_rate_ = 0; | ||||
|   bool upload_first_chunk_sent_ = false; | ||||
|  | ||||
|   std::string tft_url_; | ||||
|   uint8_t *transfer_buffer_{nullptr}; | ||||
|   size_t transfer_buffer_size_; | ||||
|  | ||||
| #ifdef USE_ESP8266 | ||||
|   WiFiClient *wifi_client_{nullptr}; | ||||
|   BearSSL::WiFiClientSecure *wifi_client_secure_{nullptr}; | ||||
|   WiFiClient *get_wifi_client_(); | ||||
| #endif | ||||
|   int content_length_ = 0; | ||||
|   int tft_size_ = 0; | ||||
|  | ||||
| #ifdef ARDUINO | ||||
|   /** | ||||
|    * will request chunk_size chunks from the web server | ||||
| @@ -1178,13 +1240,6 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|  | ||||
|   void remove_front_no_sensors_(); | ||||
|  | ||||
| #ifdef USE_NEXTION_TFT_UPLOAD | ||||
|   std::string tft_url_; | ||||
|   uint8_t *transfer_buffer_{nullptr}; | ||||
|   size_t transfer_buffer_size_; | ||||
|   bool upload_first_chunk_sent_ = false; | ||||
| #endif | ||||
|  | ||||
| #ifdef NEXTION_PROTOCOL_LOG | ||||
|   void print_queue_members_(); | ||||
| #endif | ||||
| @@ -1192,8 +1247,8 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe | ||||
|  | ||||
|   std::string command_data_; | ||||
|   bool is_connected_ = false; | ||||
|   uint32_t startup_override_ms_ = 8000; | ||||
|   uint32_t max_q_age_ms_ = 8000; | ||||
|   const uint16_t startup_override_ms_ = 8000; | ||||
|   const uint16_t max_q_age_ms_ = 8000; | ||||
|   uint32_t started_ms_ = 0; | ||||
|   bool sent_setup_commands_ = false; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user